January 19, 2000

Retrieving Browseforfolder() Files

Question: I’m using a function named Browseforfolders() that uses the following code: Private Declare Function SHBrowseForFolder Lib “shell32.dll” _Alias “SHBrowseForFolderA” (lpBrowseInfo As BROWSEINFO) As Long and the declaration of this constant: Private Const BIF_RETURNONLYFSDIRS = &H1 What I would like to know is, if using this function, is it also

SQL Stored Procedures and VB

Question: How do I run a SQL stored procedure from within Visual Basic? Answer: The easiest way is to use the Execute method of either the Database object (DAO) or the Connection object (ADO). I believe that RDO also has an Execute method. All of these return recordsets with the

Recognizing variables

Question: I have two varibles, one containing the name of another varible, and one containing a string. How can can I set the varible that’s name is contained in the first varible to the value contained in the second? Answer: There’s not a built-in way to do this. You would

Converting a Hex String to Decimal

Question: I have a database of strings of hex numbers and I want to convert them to decimal. There doesn’t seem to be a function for it, but can you go the other way with the HEX function? e.g. “A” converts to 10.e.g. “AB” needs to convert to 171. Answer:

Transfering Records From One DB to Another

Question: I want to Transfer records from one Database table to other Database table but through VB. I can’t write a query such as I can for SQL Server: Insert into Try.ABCSelect * fromTry1.XYZ Is there any simple way, similar to the code above, to achieve this, apart from opening

Building SQL in Code

Question: I am building an SQL statement to Insert and Update records. If the user enters a double quote mark in the text box the SQL statement treats this as the end of the field and the SQL statement is then invalid. I have changed the SQL statement to use

Pointer to Structure

Question: I have a struct: struct mystruct{ DWORD dw_Id;}*pMystruct; In the following function I want to pass the address of ‘dw_Id’ which is a member of mystruct. How do I pass it? If I am passing as-foo(pMystruct->(&dw_Id))//compiler error Answer: You pass the address of a pMyStruct member like this: foo(

Use of void** in QueryInterface (COM)

Question: When using Queryinterface in COM, why is the interface pointer cast to void** andwhy is it passed as a pointer to a pointer (double indirection)? Answer: This is because the function that accepts the void** pointer changes its value. In general, when you call a function that changes the

Malloc and Free

Question: If I use malloc locally in a function do I have to use free as well? Won’t someother piece of the application eventually chew up the memory I mallocd, so it doesn’t matter what happens to it when I’m done with it inmy function? Answer: Your code must include

No more posts to show