Archive for the ‘win32’ Category

How to Send an Outlook Email with VBA (Macros)

Wednesday, January 23rd, 2008

Here’s an example of a simple macro that sends an Outlook email.

Sub sl()
    Dim olApp As Outlook.Application
    Dim objMail As Outlook.MailItem
    Set olApp = Outlook.Application
    Set objMail = olApp.CreateItem(olMailItem)
    objMail.BodyFormat = olFormatPlain
    objMail.Subject = "Hi buddy"
    objMail.Body = "Whats up" + Chr(13) + Chr(10) + "Greg"
    objMail.To = "goofus@doofus.com"
    objMail.Send
End Sub

SQL Server – How to Get the Owner of a Table

Friday, October 12th, 2007

I find the stored procedure sp_table_privileges [table name] works best.

One of the fields it returns is table owner. Yay!

Here is the full documentation for it.

Here are all my search queries:

  1. sql server find owner of table
  2. tsql + (find OR get) + object owner -change
  3. mssql find object owner

A Fix for When All Your Firefox Extensions Die

Thursday, September 13th, 2007

Enthusiast Answer My Searches reader, Jody writes in with this Firefox tip:

For some absurd reason (I believe PDF downloader – now incompatible with Firefox 2.0.0.6) all of my Firefox extensions stopped working. Upon opening the add-ons screen, every extension said “This add-on will be installed when Firefox is restarted.”

The simple solution is to close Firefox, and delete the following file. Everything should be fine after that. C:\Documents and Settings\[windows user]\Application Data\Mozilla\Firefox\Profiles\[PROFILE NAME]\extensions.cache

Thanks for the tip, Jody!

How to Make a Beep Sound in Linux and a Fun Program that Uses it

Sunday, August 12th, 2007

I came across my first Python script using Tkinter tonight while looking through old files. It creates a big screen where you can click anywhere on it and it makes your computer beep. Your Y position controls the frequency and your X position controls the duration.

Well, I wanted to give it a run for old time’s sake, but alas:
ImportError: No module named winsound (On Linux)

So I looked up the problem and decided to go with the beep package installed by running:
sudo apt-get install beep

Then I updated my script to run on both Windows and Linux. Enjoy*:

#!usr/bin/env/python

from Tkinter import *

try:
    import winsound
except ImportError:
    import os
    def playsound(frequency,duration):
        #apt-get install beep
        os.system('beep -f %s -l %s' % (frequency,duration))
else:
    def playsound(frequency,duration):
        winsound.Beep(frequency,duration)

root = Tk()
def callback(event):
    print "clicked at", event.x, event.y
    frequency=event.y * 6
    duration=event.x/2
    print "Freq= ", frequency, "HZ"
    print "duration=",duration, "ms"
    print ""
    if (frequency < 32000) and (frequency>40):
        playsound(frequency,duration)

frame = Frame(root, width=1000, height=800)
frame.bind("<Button-1>", callback)
frame.pack()
#message=Label(frame)
root.mainloop()

* Or annoy those near you …

How to Change the Screen Size in VMware Player

Friday, July 20th, 2007

This tortuous tutorial will walk you through the steps of changing the screen size (resolution) and improving the colors in your VMware player’s guest OS. The guest OS is assumed to be a Windows variant (e.g., Windows 2000, Windows XP, etc).

I start off by assuming you have installed the latest version of VMware Player and you have installed a windows based virtual machine that runs in the player. But you’re disappointed because you’re having an experience like mine:

When I go to display properties settings, I’m only allowed 16 colors and the screen area slider only offers 640 by 480 and 800 by 600. But when I change it to 800×600, and click ok, when I come back to the display settings, it has gone back to 640×480.

Well, the answer is simple enough. You need to install the VMware tools for the VMware Player.

Here’s how to do that:
Mr. Hutchinson provides a good overview of the process for Linux host OS. We just need to adapt it for a Windows host OS:

1. Download the latest “Archived Version” of VMware Workstation in “.tar.gz” format at http://www.vmware.com/download/ws/. You do not need to be registered nor have a VMware Workstation license key to download this version.

However VMware kept asking me to register and stuff. I found downloading this file directly was adequate instead:
http://download3.vmware.com/software/wkst/VMware-workstation-5.5.0-18463.tar.gz

Next locate and extract the windows.iso VMware Tools image from the tarball.

Next you’ll need to either write the iso to a CD or mount the iso since we want to get at the files on it.

This daemons program worked for me for mounting an ISO in windows, and conveniently the guest OS even detected the mounted iso. (Warning it seems kinda spyware-ish to me, but that was just my impression. Be careful to at least uncheck the optional toolbar program :-( )

Now, in your guest OS, run setup.exe from the mounted drive and install VMware tools.

For me, right after install, my display settings had a lot more color and resolution options and the settings stuck after I changed them.