February 3, 2001

FileToBlob – Copy a file’s contents into a BLOB field

‘ Copy a file’s contents into a BLOB field.Sub FileToBlob(fld As ADODB.Field, filename As String, _ Optional ChunkSize As Long = 8192) Dim fnum As Integer, bytesLeft As Long, bytes As Long Dim tmp() As Byte ‘ Raise an error if the field doesn’t support GetChunk. If (fld.Attributes And adFldLong)

GetUSStates – Get the list of US States and their abbreviations

‘ return the list of US States and their abbreviations” returns a bi-dimensional array organized in this way’ res(n, 0) holds the state’s name’ res(n, 1) holds the state’s abbreviation’ the array is sorted on states’ names” Example: load the states’ names and abbreviations in a combobox’ Dim st() As

Create UDL files the easy way

The standard way to create a UDL file is to right-click in the directory where you want to create it and select the New-Microsoft Data Link menu command. Unfortunately, on many computers, this manual procedure won’t work, because the file type “Microsoft Data Link” does not appear on the”New” menu.

CloneFieldStructure – Create a new Recordset with same field structure

‘ Copy the field structure of a Recordset to a new Recordset.” The original code has been improved to account for Numeric and Decimal’ fields, that also require the setting of Precision and Numeric Scale ‘ properties.’ Thanks to Robert Gelb for this suggestion.Function CloneFieldStructure(rs As ADODB.Recordset) As ADODB.Recordset Dim

BlobToFile – Copy a BLOB field’s contents to a binary file

‘ Copy a BLOB field’s contents to a binary file.Sub BlobToFile(fld As ADODB.Field, filename As String, _ Optional ChunkSize As Long = 8192) Dim fnum As Integer, bytesLeft As Long, bytes As Long Dim tmp() As Byte ‘ Raise an error if the field doesn’t support GetChunk. If (fld.Attributes And

Accessing Class Members From the Static Member Function

When a class has Thread entry functions, it is usually declared as static member functions of the class as in the example below: Class A{private: int i,j,k;public: //Thread Entry function static DWORD WINAPI ThreadFunc(PVOID p); //other functions void SomeFunc();} The implementation of the function does not allow access to the

Access Class Members From a Thread Function

Suppose you have a thread function ThreadFunc in a class CMyClass and you want to access a member of that class. Here’s what to do: Declare the thread function as static DWORD WINAPI ThreadFunc(LPVOID pVoid) Define the thread function as DWORD WINAPI ThreadFunc(LPVOID pVoid) When you create the thread, pass

No more posts to show