////////////////////// sample1.cpp //////////////////////////// //parameters in the command line // //sample1.exe source.xls 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("xls2dbf_d.dll"); if (!h) retval = 200; else { f = (Converter)GetProcAddress(h, "XLStoDBF_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("nophones.xls"); params[n++]=strdup("c:\\tmp\\"); params[n++]=strdup("/ansi"); params[n++]=strdup("/overwrite=1"); h = LoadLibrary("xls2dbf_d.dll"); if (!h) retval = 200; else { f = (Converter)GetProcAddress(h, "XLStoDBF_Converter"); if (!f) retval = 300; else retval = f(NULL, n, params); } FreeLibrary(h); printf("ret = %d\n", retval); return retval; } // ////////////////////// sample2.cpp //////////////////////////// |