MDB to XLS Converter DLL

There are two DLLs: MDB2XLS_D.DLL and MDB2XLS_D2007.DLL

The first DLL MDB2XLS_D.DLL supports MDB files only. It does not support Access 2007 format.
The second DLL MDB2XLS_D2007.DLL supports both MDB and ACCDB files, but it will work only if you have MS Office 2007 on your computer.

There are only two functions:

int
MDBtoXLS_Converter(HWND hwnd, int argc, char *argv[]);

It accepts three parameters.
The first "hwnd" must be NULL. It is not used.
The second "argc" must be equal to number of parameters.
The third "argv" contains parameters.

int
MDBtoXLS_ConverterStr(HWND hwnd, char *params);

It accepts two parameters.
The first "hwnd" must be NULL. It is not used.
The second "params" contains parameters which are delimited by #.

The functions return:
0 - success
1 - not recognized a source file
2 - not recognized a target folder or a target file
3 - cannot open source mdb file

Drive:\Path\FileName.mdb Source MDB file
Drive:\Path\Filename.xls Target XLS file
Drive:\Path\ Target XLS folder
/RECORDS=0 Do not export records of the table.
/OVERWRITE=1 Overwrite existing file. (default)
/OVERWRITE=0 Do not overwrite existing file. (Append to existing file).
/OVERWRITETABLE=1 Overwrite existing tables.
/OVERWRITETABLE=0 Do not overwrite existing tables.
/TYPE=ANY Convert to XLS format, Excel 95-2003
/TYPE=2007 Convert to XLSX format, Excel 2007 or later
/PASSWORD=value Password for source file.
/HEADER=1 Include field names in the output file
/HEADER=0 Do not include field names in the output file
/ONLYNEW=1 Include field names in the output file only for new sheets
/ONLYNEW=0 Include field names in the output file always according /HEADER=? option

////////////////////// sample1.cpp ////////////////////////////
//parameters in the command line
//
//sample1.exe source.mdb c:\target\ ...
//
#include <windows.h<
#include <stdio.h>

typedef int (APIENTRY *Converter)(HWND, UINT, CHAR**);

int main(int argc, char* argv[])
{
	int	retval;
	HMODULE	h;
	Converter f;

	h = LoadLibrary("mdb2xls_d.dll");
	if (!h) retval = 200;
	else
	{
	f = (Converter)GetProcAddress(h, "MDBtoXLS_Converter");
	if (!f) retval = 300;
	else	retval = f(NULL, argc, argv);
	}
	FreeLibrary(h);

	printf("ret = %d\n", retval);
	return retval;
}
//
////////////////////// sample1.cpp ////////////////////////////

 

////////////////////// sample2.cpp ////////////////////////////
//parameters in the source code
//
//sample2.exe
//

#include <windows.h>
#include <stdio.h>

typedef int (APIENTRY *Converter)(HWND, UINT, CHAR**);

int main(int argc, char* argv[])
{
	int	retval;
	HMODULE	h;
	Converter f;

	int	n=0;
	char	*params[10];

	params[n++]=strdup(__argv[0]);
	params[n++]=strdup("source.accdb");
	params[n++]=strdup("c:\\tmp\\");
	params[n++]=strdup("/type=2007");
	params[n++]=strdup("/overwrite=0");

	h = LoadLibrary("mdb2xls_d2007.dll");
	if (!h) retval = 200;
	else
	{
	f = (Converter)GetProcAddress(h, "MDBtoXLS_Converter");
	if (!f) retval = 300;
	else	retval = f(NULL, n, params);
	}
	FreeLibrary(h);

	printf("ret = %d\n", retval);
	return retval;
}
//
////////////////////// sample2.cpp ////////////////////////////