Microsoft & .NETVisual BasicMicrosoft Cardfile import DLL

Microsoft Cardfile import DLL content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

What is cardfile?
If you ask this question, youe propably don’t need this dll. Anyway – the screenshot is showing Cardfile in action (with the contents of my CD-archive.)

CardFile.exe came with windows 3.1 and 3.11 (maybe before) but was not included with Windows 95 and later. That is a shame because I think lot’s of people was using this small, but inferior, piece of software.

What is the CardFile Import DLL?
I have written a small DLL (28 Kb) that will take care of importing the Cardfile binary format into something that can be understood by C++ and maybe other programming languages. I will not take any responsibility for the outcome of using this DLL. The Cardfile file format is not documented, and the only thing I know is that it works fine on my machine. I cannot guarantee that this will be the case on any system in the world.

The DLL only contains two functions:

ImportCardFile and FreeCardFilePtr.

These funtions are loaded dynamically. This approach makes using the functions a bit cumbersome, but on the other hand it means that the dll should also be usable to any programming language supporting dll function calls. You are however free to remove the header and implementation files from dll and link them statically to your own project, if you do not like DLLs.

The code snippet below is taken from the sample accompanying the cardfile dll.

BOOL CCrdFileDriverDoc::OnOpenDocument(LPCTSTR lpszPathName)


// It is not necessary to call the base clas implementation of OnOpenDocument()

// if (!CDocument::OnOpenDocument(lpszPathName))

// return FALSE;


LPCSTR lpszDllPath = “CardFile.dll”;




DWORD dwNumCards, dwResult;

LPCSTR lpszDivider = “========================================”;

CString strFormat;

// Load the carfile dll, and obtain a pointer to the import function

hInst = LoadLibrary(lpszDllPath);

if (!hInst)


AfxMessageBox(“Cannot load the cardfile DLL”);

return FALSE;


ImportCardFile = (IMPORTCARDFILE)GetProcAddress(hInst, “ImportCardFile”);

if (!ImportCardFile)


AfxMessageBox(“Cannot find the “ImportCardFile” process”);

return FALSE;


// Empty the string that will be shown in the edit control of the child window


// call the function that imports the cardfile. Each car will be loaded into a separate structure

dwResult = ImportCardFile(lpszPathName, &cfc, &dwNumCards);

// The cards was imported successfully

if (dwResult == CF_SUCCESS)


// For each of the cards create string and add it to the main string m_strText

// The main string will eventually be shown in the edit window

for (DWORD i=0 ; i < dwNumCards; i++) { strFormat.Format("%srn%srn%srn", lpszDivider, cfc[i].szHeading, cfc[i].szBodyText); m_strText += strFormat; } } else


// Error – show a message

switch (dwResult)



AfxMessageBox(“The file was to small.”);



AfxMessageBox(“This is not a valid cardfile database.”);



AfxMessageBox(“Cardfile import failed.”);


return FALSE;


// Load the process that will perform clean up of the imported cards

FreeCardFilePtr = (FREECARDFILEPTR)GetProcAddress(hInst, “FreeCardFilePtr”);

if (!FreeCardFilePtr)


AfxMessageBox(“Cannot find the “FreeCardFilePtr” process”);

return FALSE;


FreeCardFilePtr(&cfc, dwNumCards);


// Make sure that the contents of the string with the cardfiles are shown


return TRUE;


The Sample Program
I have provided a small sample program that will demonstrate how the dll is used, and what can be accomplished with it.
You can use the sample program to extract the information from your old Cardfile archives and copy and paste the information from cardfile into a database system of your choice.
If you decide to create a program using my code – CardFile98 maybe 😉 I would appreciate if you would mail a copy.

A sreenshot from the sample program is shown below

Download demo project – 37 KB

Date Posted: September 28, 1998

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories