|
#include <comdef.h>
typedef void (__stdcall *LPFUNC)
(
HWND hwnd,
HINSTANCE hinst,
LPWSTR lpszCmdLine,
int nCmdShow
);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
HINSTANCE lib;
// *******************************************
// DLL ロード
// *******************************************
lib = LoadLibrary( "printui.dll" );
if ( lib == NULL ) {
MessageBox( NULL, "printui.dll のロードに失敗しました", "", MB_OK );
return 0;
}
// *******************************************
// 関数アドレスのロード
// *******************************************
LPFUNC PrintUIEntry;
PrintUIEntry = (LPFUNC)GetProcAddress( lib, "PrintUIEntryW" );
if ( PrintUIEntry == NULL ) {
FreeLibrary( lib );
MessageBox(
NULL,
"PrintUIEntry のアドレスの取得に失敗しました",
"",
MB_OK );
return 0;
}
// *******************************************
// 実行
// *******************************************
_bstr_t bstrParam;
bstrParam = " /y /n \"";
bstrParam += lpCmdLine;
bstrParam += "\"";
PrintUIEntry(
GetDesktopWindow(),
lib,
(wchar_t *)bstrParam,
nCmdShow
);
// *******************************************
// DLL 解放
// *******************************************
FreeLibrary( lib );
return 0;
}
| |