////////////////////// 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("mdb2dbf_d.dll");
if (!h) retval = 200;
else
{
f = (Converter)GetProcAddress(h, "MDBtoDBF_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.mdb");
params[n++]=strdup("c:\\tmp\\");
params[n++]=strdup("/ansi");
params[n++]=strdup("/overwrite=0");
h = LoadLibrary("mdb2dbf_d.dll");
if (!h) retval = 200;
else
{
f = (Converter)GetProcAddress(h, "MDBtoDBF_Converter");
if (!f) retval = 300;
else retval = f(NULL, n, params);
}
FreeLibrary(h);
printf("ret = %d\n", retval);
return retval;
}
//
////////////////////// sample2.cpp ////////////////////////////
|