September 17, 1998

Create a Globally Unique Identifier (GUID)

I use this routine in almost every application I develop. It’s handy whether you need a key for a collection or whether you use it in a database: Option ExplicitPrivate Declare Function CoCreateGuid Lib _ “OLE32.DLL” (pGuid As GUID) As LongPrivate Declare Function StringFromGUID2 Lib _ “OLE32.DLL” (pGuid As GUID,

Suspend Code While Waiting for Shelled Process

This “wait” routine suspends your code and waits for the shelled process to finish. It comes in handy when you need to run another scriptatch file during your process. Use this calling syntax: Private sub cmdPrint_Click() WaitForProcessToEnd “C:PLOTTER.BAT” ‘Let the user know when the process is finished. MsgBox “The process

Fill a List Box with the Values from a Database Table

Use this code to fill a list box with the values from a database table. The first field in the query provides the ItemData for the list: Call FillList(dbase, “select personno, ” & _ “personname from tblperson order by ” & _ “personname;”, lstperson)Sub FillList(thedb As Database, thesql As _

Use UNC Names to Refer to Network Drives

If you write programs that access information on a network server, you never want to hard-code drive letters. Not all software vendors take advantage of the Uniform Naming Convention (UNC) (for example, \SERVERVOLUME ) technology. Use these API declarations: Public Declare Function GetVolumeInformation _ Lib “kernel32” Alias “GetVolumeInformationA” ( _

More Tips for “Creating a Better Mouse Trap”

I would like to add a few things to the “Building a Better Mouse Trap” tip [VBPJ November 1996, page 56]. This approach also works for any message, including button-up and button-down messages. Windows 95 calls the appropriate function and passes the mouse coordinates and other information in lParam and

Send Messages to WinPopUp from Your Application

If you have an application that must run “unattended” and you want it to alert you if something goes wrong, your application can send you a message through WinPopUp. WinPopUp uses a mail slot to communicate with other computers in the network. Choose a mail slot name, such as \computernamemailslotmessngr,

PB6 interface to VB5

Question: How can I use VB5 components from within PB6? Can VB5 deliver a DLL that we can communicate with, or are there better methods? Answer: The best method of communicating between the two products is through the use of COM. You can create an OCX or an OLE Automation

Rich text set default font

Question: How do I control the font size in a rich text edit? I am pulling text from a variable and applying it to a rich text edit by: rte_1.SelectTextAll()rte_1.ReplaceText (ls_text) Under PB 5.0 one font is used, and under PB 6.5 another font is used. Can I control the

Passing arguments to an Exe

Question: I have an .exe of PB app “sales.” While I type c:sales.exe, I will also pass a parameter such as c:sales.exe auto. Now I want to access this parameter in my appobject, and so I have to write code in the app object. How do I refer to the