BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) #endif { switch (dwReason) { case DLL_PROCESS_ATTACH: _Module.Init(ObjectMap, (HINSTANCE)hInstance, &LIBID_NCSECWLib); #if !defined(_WIN32_WCE) || !(_WIN32_WCE <= 211) DisableThreadLibraryCalls((HINSTANCE)hInstance); #endif //NCSecwInitInternal(); break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: // We do the iDWT detach in the main process shutdown. // If you add anything here, you may need to remove // the call to DisableThreadLibraryCalls() above. break; case DLL_PROCESS_DETACH: _Module.Term(); //For windows CE, must call NCSEcwShutdown from program before it is closes #if !defined(_WIN32_WCE) // if (pNCSEcwInfo) { // pNCSEcwInfo->bShutdown = TRUE; // NCSecwShutdownInternal(); // } #endif break; } return TRUE; }
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /* lpReserved */) { if (dwReason == DLL_PROCESS_ATTACH) { ::hInstance = hInstance; RegisterLineToolTip(); InitCommonControls(); RegisterCMHotKey( hInstance ); #ifdef _ACTIVEX CMRegisterControl( CM_VERSION ); _Module.Init(ObjectMap, hInstance); DisableThreadLibraryCalls(hInstance); #endif } else if (dwReason == DLL_PROCESS_DETACH) { UnregisterLineToolTip(); UnregisterCMHotKey( hInstance ); #ifdef _ACTIVEX _Module.Term(); CMUnregisterControl(); #endif } return 1; // ok }
BOOL APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { switch (dwReason) { case DLL_PROCESS_ATTACH: #if _MSC_VER <= 1200 _Module.Init(ObjectMap, hInstance); DisableThreadLibraryCalls(hInstance); #endif break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: #if _MSC_VER <= 1200 _Module.Term(); #endif break; } return TRUE; }
extern "C" int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, __in LPWSTR lpCmdLine, int /*nShowCmd*/) { lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT CoInitialize(0); _Module.Init( ObjectMap, hInstance, &LIBID_ATLLib ); ::InitCommonControls(); RECT rcPos = { CW_USEDEFAULT, 0, 0, 0 }; HMENU hMenu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MENU1)); HICON hIcon = LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON1)); CWMPHost frame; frame.GetWndClassInfo().m_wc.hIcon = hIcon; frame.Create(GetDesktopWindow(), rcPos, L"WMP Host Container", 0, 0, (UINT)hMenu); frame.ShowWindow(SW_SHOWNORMAL); MSG msg; while (GetMessage(&msg, 0, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } _Module.Term(); CoUninitialize(); return 0; }
BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) { TraceMsg( L"-->DllMain.\n"); if (dwReason == DLL_PROCESS_ATTACH) { TraceMsg( L" Reason: Attach.\n"); _Module.Init(ObjectMap, hInstance); DisableThreadLibraryCalls(hInstance); } else if (dwReason == DLL_PROCESS_DETACH) { TraceMsg( L" Reason: Detach.\n"); _Module.Term(); } TraceMsg( L"<--DllMain.\n"); return TRUE; }
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { lpReserved; #ifdef _MERGE_PROXYSTUB if (!PrxDllMain(hInstance, dwReason, lpReserved)) { return FALSE; } #endif if (dwReason == DLL_PROCESS_ATTACH) { #ifdef DEBUG_HEAPS // turn on leak detection on process exit _CrtSetDbgFlag( _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF ); #endif // DEBUG_HEAPS _Module.Init(ObjectMap, hInstance); DisableThreadLibraryCalls(hInstance); MSPLOGREGISTER(_T("sampleterm")); } else if (dwReason == DLL_PROCESS_DETACH) { MSPLOGDEREGISTER(); _Module.Term(); } return TRUE; // ok }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT HRESULT hRes = CoInitialize(NULL); _ASSERTE(SUCCEEDED(hRes)); _Module.Init(0, hInstance, &LIBID_ATLLib); CMainDlg mainDlg; g_pMainWin = &mainDlg; mainDlg.Create(NULL); mainDlg.ShowWindow(SW_SHOW); MSG msg; while (GetMessage(&msg, 0, 0, 0)) { if (!IsDialogMessage(mainDlg, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } _Module.Term(); CoUninitialize(); return msg.wParam; }
//------------------------------------------------------------------* BOOL CCSC_OnlineApp::InitInstance() { _Module.Init(ObjectMap, m_hInstance); ::InitTrace(m_hInstance,_T("SOFTWARE\\SOFTING\\4ControlV2\\"),_T("CSC_ONLINE")); return CWinApp::InitInstance(); }
// // for MFC initialization // extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { switch(dwReason) { case DLL_PROCESS_ATTACH: _hdllInstance = hInstance; if(!AfxInitExtensionModule(DesignCtrSampleDll, hInstance)) return 0; new CDynLinkLibrary(DesignCtrSampleDll); _Module.Init(ObjectMap, hInstance); // registerAppInfo(hInstance); DllRegisterServer(); break; case DLL_PROCESS_DETACH: AfxTermExtensionModule(DesignCtrSampleDll); _Module.Term(); break; } return 1; }
BOOL OPCEngine::initialize( IN enum serverTypeCOM type, IN REFCLSID clsid, IN UINT rgsResource, IN HINSTANCE hInst, IN DWORD coInit) // COM init mode { _TRACE(TL_INF, TG_ENG, (_T("initialize engine; clsid:%8.8X-%4.4X-%4.4X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X"), clsid.Data1, clsid.Data2, clsid.Data3, clsid.Data4[0], clsid.Data4[1], clsid.Data4[2], clsid.Data4[3], clsid.Data4[4], clsid.Data4[5], clsid.Data4[6], clsid.Data4[7])); HRESULT res; g_clsid = clsid; g_registerId = rgsResource; m_type = type; if (type != InProc) { if (SUCCEEDED(res = ::CoInitializeEx(NULL, coInit))) m_initialized = TRUE; else _ERROR(TG_ENG, OPCENGINE_ERR_COM,(_T("Can't initialize COM: coInit:0x%X [0x%X]"), coInit, res)); } _Module.Init(g_objectMap, hInst); ::CoFileTimeNow(&m_startTime); GenericPointer<GenericServer> pg = m_creator->createServer(TRUE); m_opcRoot->addBranch(pg); pg->setName(_T("PublicGroups")); _TRACE(TL_DEB, TG_ENG, (_T("< initialize 0x%X"), res)); return SUCCEEDED(res); }
int APIENTRY _tWinMain(_In_ HINSTANCE hCurInst, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { // TODO: ここにコードを挿入してください。 MSG msg; BOOL bRet; hInst = hCurInst; // グローバル変数にインスタンス処理を格納します。 //モジュールの初期化 _Module.Init(ObjectMap, hInst); if (!MyRegisterClass(hCurInst)) return FALSE; // アプリケーションの初期化を実行します: if (!InitInstance (hCurInst, nCmdShow)) { return FALSE; } // メイン メッセージ ループ: while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0){ if (bRet == -1){ break; }else{ TranslateMessage(&msg); DispatchMessage(&msg); } } return (int) msg.wParam; }
BOOL CTestProjectWizardApp::InitInstance() { #ifdef _MERGE_PROXYSTUB hProxyDll = m_hInstance; #endif _Module.Init(ObjectMap, m_hInstance, &LIBID_TESTPROJECTWIZARDLib); return CWinApp::InitInstance(); }
BOOL CMMGeoPunktDLKApp::InitInstance() { #ifdef _MERGE_PROXYSTUB hProxyDll = m_hInstance; #endif _Module.Init(ObjectMap, m_hInstance); return CWinApp::InitInstance(); }
///////////////////////////////////////////////////////////////////////////// //++ // // CFileShareSampleApp::InitInstance // // Description: // Initialize this instance of the application. // // Arguments: // None. // // Return Value: // Any return codes from CWinApp::InitInstance(). // //-- ///////////////////////////////////////////////////////////////////////////// BOOL CFileShareSampleApp::InitInstance( void ) { _Module.Init( ObjectMap, m_hInstance ); return CWinApp::InitInstance(); } //*** CFileShareSampleApp::InitInstance
BOOL CEdbsApp::InitInstance() { #ifdef _MERGE_PROXYSTUB hProxyDll = m_hInstance; #endif _Module.Init(ObjectMap, m_hInstance, &LIBID_TRiAS_EDBS); return CWinApp::InitInstance(); }
///////////////////////////////////////////////////////////////////////////// //++ // // CClipBookServerApp::InitInstance // // Description: // Initialize this instance of the application. // // Arguments: // None. // // Return Value: // Any return codes from CWinApp::InitInstance(). // //-- ///////////////////////////////////////////////////////////////////////////// BOOL CClipBookServerApp::InitInstance( void ) { _Module.Init( ObjectMap, m_hInstance ); return CWinApp::InitInstance(); } //*** CClipBookServerApp::InitInstance
/*! プレビューウインドウクラスを作成 @param[in] hInstance アプリのインスタンス @param[in] hParentWnd 親ウインドウのハンドル @return なし */ VOID PreviewInitialise( HINSTANCE hInstance, HWND hParentWnd ) { WNDCLASSEX wcex; GUID guid; HBITMAP hImg, hMsq; if( hInstance ) { ghInst = hInstance; _Module.Init( ObjectMap, hInstance, &guid ); // 専用のウインドウクラス作成 ZeroMemory( &wcex, sizeof(WNDCLASSEX) ); wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = PreviewWndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = NULL; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = NULL; wcex.lpszClassName = DOC_PREVIEW_CLASS; wcex.hIconSm = NULL; RegisterClassEx( &wcex ); ghPrevWnd = NULL; PreviewHeaderGet( ); CoInitialize( NULL ); giViewMode = 0; ghPrevwImgLst = ImageList_Create( 16, 16, ILC_COLOR24 | ILC_MASK, 1, 1 ); hImg = LoadBitmap( ghInst, MAKEINTRESOURCE( (IDBMP_PREVIEW_ALL) ) ); hMsq = LoadBitmap( ghInst, MAKEINTRESOURCE( (IDBMQ_PREVIEW_ALL) ) ); ImageList_Add( ghPrevwImgLst , hImg, hMsq ); // イメージリストにイメージを追加 DeleteBitmap( hImg ); DeleteBitmap( hMsq ); } else { // もし開けたままだったら綺麗に閉じないとメモリリーク if( ghPrevWnd ){ SendMessage( ghPrevWnd, WM_CLOSE, 0, 0 ); } CoUninitialize( ); FREE(gpcHtmlHdr); ImageList_Destroy( ghPrevwImgLst ); } return; }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { _Module.Init(ObjectMap, hInstance); RunApp(); _Module.Term(); return 0; }
// Winamp calls this with plugin populated after the above has been called int init() { static char c[512]; char filename[512]; HWND hWnd = NULL; g_hDllInstance = plugin.hDllInstance; g_hwndParent = plugin.hwndParent; _Module.Init(NULL, plugin.hDllInstance, &LIBID_ATLLib); // Handle Multiple Instances hSem = CreateSemaphore (NULL, 1, 1,szSemName); if (WaitForSingleObject (hSem, 0) == WAIT_TIMEOUT) { CloseHandle (hSem); return -1; } int version = WINAMP_VERSION_MAJOR( SendMessage( plugin.hwndParent,WM_WA_IPC,0,IPC_GETVERSION) ); // If the version is earlier than 5, we need to use a method of track play detection // that involves overriding the playlist editor's event handler. if ( version < 5 ) { hWnd = GetPEWindow(plugin.hwndParent); if ( hWnd != NULL ) { // Stores previous playlist wndproc and sets new one to WndProcPE SetWndSubClass( hWnd, WndProcPE, &lpWndProcOldPE ); } else PRINTF(DEBUG_ERROR, "Gen_AudioScrobbler::init", "Failed to find Winamp PE Window"); } // From version 5, Winamp supplies a better way to detect track plays that goes // through the main window's event handler. From 5.5 the old PE method does // not even work any longer. if ( version >= 5 && plugin.hwndParent != NULL ) { // Stores previous playlist wndproc and sets new one to WndProcParent SetWndSubClass( plugin.hwndParent, WndProcParent, &lpWndProcOldParent ); } GetModuleFileName(plugin.hDllInstance,filename,sizeof(filename)); // Launch config if we can't start scrobbling if(!theScrobbler.StartScrobbling(plugin.hDllInstance, plugin.hwndParent, NULL, filename)) config(); sprintf((plugin.description=c), "%s v%s", theScrobbler.GetAppName().c_str(), theScrobbler.GetVersionString().c_str()); return 0; }
int main(int argc, char* argv[]) { LPTSTR szInputFile = NULL; LPTSTR szOutputFile = NULL; LPTSTR szQueryString = NULL; LPTSTR szFormInput = NULL; LPTSTR szErrorLog = NULL; LPTSTR szContentType = NULL; LPTSTR szVerb = NULL; BOOL bNoLogo = FALSE; HINSTANCE hInstResource=LoadLocResDll(szClStencilUIDll,TRUE); _AtlBaseModule.AddResourceInstance(hInstResource); if (argc < 3) { CStringA str; Emit(str, IDS_INVALID_ARGS); PrintUsage(str); return 1; } CoInitialize(NULL); if (!GetParameters(argc, argv, &szInputFile, &szOutputFile, &szQueryString, &szFormInput, &szErrorLog, &szContentType, &szVerb, &bNoLogo)) { return 1; } CStringA strHeader; if (bNoLogo == FALSE) { Emit(strHeader, IDS_HEADER); printf((LPCSTR) strHeader); } _Module.Init(NULL, GetModuleHandle(NULL)); CSProcExtension extension; if (!extension.Initialize()) { CStringA str; Emit(str, IDS_INIT_FAILED); printf((LPCSTR) str); _Module.Term(); return 1; } if (!extension.DispatchStencilCall(szInputFile, szOutputFile, szQueryString, szErrorLog, szFormInput, szContentType, szVerb)) printf("%s\n", (LPCSTR) extension.m_strErr); extension.Uninitialize(); _Module.Term(); CoUninitialize(); return 0; }
BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) { if (dwReason == DLL_PROCESS_ATTACH) { _Module.Init(ObjectMap, (HINSTANCE)hInstance, &LIBID_SRENGLib); } else if (dwReason == DLL_PROCESS_DETACH) _Module.Term(); return TRUE; // ok }
BOOL CAddinApp::InitInstance() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Initialize COM stuff if (FAILED(_Module.Init(ObjectMap, AfxGetInstanceHandle(), &LIBID_AddinLib))) return FALSE; return TRUE; }
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID ) { if (dwReason == DLL_PROCESS_ATTACH) { _Module.Init(ObjectMap, hInstance, &LIBID_FDMUPLOADBTNFORIELib); DisableThreadLibraryCalls(hInstance); } else if (dwReason == DLL_PROCESS_DETACH) _Module.Term(); return TRUE; }
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) { if (dwReason == DLL_PROCESS_ATTACH) { _Module.Init(ObjectMap, hInstance, &LIBID_SIMREMOTELib); DisableThreadLibraryCalls(hInstance); } else if (dwReason == DLL_PROCESS_DETACH) _Module.Term(); return TRUE; // ok }
void Win32WebControl::lazyInit() { // reset the main windows style so that its drawing does not cover the webview sub window HWND hwnd = cocos2d::Director::getInstance()->getOpenGLView()->getWin32Window(); LONG style = GetWindowLong(hwnd, GWL_STYLE); SetWindowLong(hwnd, GWL_STYLE, style | WS_CLIPCHILDREN); HINSTANCE hInstance = GetModuleHandle(NULL); CoInitialize(NULL); s_module.Init(NULL, hInstance); AtlAxWinInit(); }
BOOL InitInstance(HINSTANCE hInstance) { _Module.Init(ObjectMap, hInstance); if (FAILED(::CoInitialize(NULL))) return FALSE; // 시스템 에러 다이알로그 박스를 보여주지 않음 SetErrorMode(SEM_FAILCRITICALERRORS); return TRUE; }
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { //当dll第一次被加载到exe的进程空间时 if (ul_reason_for_call==DLL_PROCESS_ATTACH) { //将映射关系保存 _Module.Init(objmap,(HINSTANCE)hModule); } return TRUE; }
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) { if (dwReason == DLL_PROCESS_ATTACH) { g_hinstDll=hInstance; _Module.Init(ObjectMap, hInstance, &LIBID_WKSHELLEXTLib); DisableThreadLibraryCalls(hInstance); } else if (dwReason == DLL_PROCESS_DETACH && !lDetached){ _Module.Term(); } return TRUE; // ok }
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) { if (dwReason == DLL_PROCESS_ATTACH) { _hdllInstance = hInstance; _Module.Init(ObjectMap, hInstance, &LIBID_AsdkETRANSMITNOTIFIERLib); DisableThreadLibraryCalls(hInstance); } else if (dwReason == DLL_PROCESS_DETACH) { _Module.Term(); } return TRUE; // ok }
// Launch the dialog when the application launchs extern "C" int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, int /*nShowCmd*/) { CoInitialize(NULL); _Module.Init(ObjectMap, hInstance, NULL); CMainDlg dlg; dlg.DoModal(); CoUninitialize(); return 0; }