//----------------------------------------------------------------------------- // AEffGUIEditor Implementation //----------------------------------------------------------------------------- AEffGUIEditor::AEffGUIEditor (void* pEffect) : AEffEditor ((AudioEffect*)pEffect) , inIdleStuff (false) { ((AudioEffect*)pEffect)->setEditor (this); systemWindow = 0; lLastTicks = getTicks (); #if WINDOWS OleInitialize (0); #endif #if MAC InitMachOLibrary (); #endif }
// 程序入口. int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); HRESULT hRes = OleInitialize(NULL); // this resolves ATL window thunking problem when Microsoft Layer // for Unicode (MSLU) is used. ::DefWindowProc(NULL, 0, 0, 0L); base::EnableTerminationOnHeapCorruption(); // 负责调用单件对象的析构函数. base::AtExitManager exit_manager; CommandLine::Init(0, NULL); FilePath res_dll; PathService::Get(base::DIR_EXE, &res_dll); res_dll = res_dll.Append(L"wanui_res.dll"); ui::ResourceBundle::InitSharedInstance(res_dll); MessageLoop main_message_loop(MessageLoop::TYPE_UI); view::desktop::DesktopViewDelegate view_delegate; // 只支持纯view配置. view::Widget::SetPureViews(true); view::desktop::DesktopWindowView::CreateDesktopWindow( view::desktop::DesktopWindowView::DESKTOP_DEFAULT); view::desktop::DesktopWindowView::desktop_window_view->CreateTestWindow( L"Sample Window 1", SK_ColorWHITE, gfx::Rect(500, 200, 400, 400), true); view::desktop::DesktopWindowView::desktop_window_view->CreateTestWindow( L"Sample Window 2", SK_ColorRED, gfx::Rect(600, 450, 450, 300), false); view::AcceleratorHandler accelerator_handler; MessageLoopForUI::current()->Run(&accelerator_handler); ui::ResourceBundle::CleanupSharedInstance(); OleUninitialize(); return 0; }
BOOL CXsvrApp::InitInstance() { OleInitialize(NULL); AfxEnableControlContainer(); InitializeCriticalSection(& g_cs); CFileFind fFind; CStdioFile file; char buf[MAX_PATH]; GetProgramDirectory(buf); CString fileName; fileName.Format("%s%s", buf, "sys.log"); if (! fFind.FindFile(fileName)) { // AfxMessageBox("File don't existed."); file.Open(fileName, CFile::modeCreate|CFile::modeWrite|CFile::shareDenyNone, NULL); } // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif CXsvrDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
void BoilerplateInit() { OleInitialize(0); // Common controls (manifest must be present) { // Include the v6 common controls in the manifest #pragma comment(lib,"comctl32.lib") #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(INITCOMMONCONTROLSEX); InitCtrls.dwICC = ICC_WIN95_CLASSES | ICC_STANDARD_CLASSES; BOOL res = InitCommonControlsEx(&InitCtrls); _ASSERT(res); } }
void Host::Initialize(int argc, const char** argv) { eventWindow = new EventWindow(); mainThreadId = GetCurrentThreadId(); OleInitialize(0); this->AddMessageHandler(&MainThreadJobsTickleHandler); #ifndef DEBUG // only create a debug console when not compiled in debug mode // otherwise, it should be autocreated if (this->DebugModeEnabled()) { RedirectIOToConsole(); } #endif }
///////////////////////////////////////////////////////////////////////////// // AppMainApp initialization BOOL AppMainApp::InitATL() { m_bATLInited = TRUE; HRESULT hRes = OleInitialize(NULL); /*#if _WIN32_WINNT >= 0x0400 HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED); #else HRESULT hRes = CoInitialize(NULL); #endif*/ if (FAILED(hRes)) { m_bATLInited = FALSE; return FALSE; } return TRUE; }
/** * @brief Initialize the Ecore_Win32 Drag and Drop module. * * @return 1 or greater on success, 0 on error. * * This function initialize the Drag and Drop module. It returns 0 on * failure, otherwise it returns the number of times it has already * been called. * * When the Drag and Drop module is not used anymore, call * ecore_win32_dnd_shutdown() to shut down the module. */ EAPI int ecore_win32_dnd_init() { if (_ecore_win32_dnd_init_count > 0) { _ecore_win32_dnd_init_count++; return _ecore_win32_dnd_init_count; } if (OleInitialize(NULL) != S_OK) return 0; _ecore_win32_dnd_init_count++; return _ecore_win32_dnd_init_count; }
int LoadSendRecvMessageModule(void) { if (LoadLibraryA("riched20.dll") == NULL) { if (IDYES != MessageBoxA(0, Translate ("Miranda could not load the built-in message module, riched20.dll is missing. If you are using Windows 95 or WINE please make sure you have riched20.dll installed. Press 'Yes' to continue loading Miranda."), Translate("Information"), MB_YESNO | MB_ICONINFORMATION)) return 1; return 0; } hDLL = LoadLibraryA("user32"); pSetLayeredWindowAttributes = (PSLWA) GetProcAddress(hDLL,"SetLayeredWindowAttributes"); InitGlobals(); RichUtil_Load(); OleInitialize(NULL); InitREOleCallback(); InitOptions(); hEventDbEventAdded = HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded); hEventDbSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged); hEventContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted); HookEvent(ME_SYSTEM_MODULESLOADED, SplitmsgModulesLoaded); HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged); HookEvent(ME_PROTO_CONTACTISTYPING, TypingMessage); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownSendRecv); CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand); #if defined(_UNICODE) CreateServiceFunction(MS_MSG_SENDMESSAGE "W", SendMessageCommand); #endif CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI); CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass); CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData); CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand); CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand); hHookWinEvt=CreateHookableEvent(ME_MSG_WINDOWEVENT); SkinAddNewSoundEx("RecvMsgActive", Translate("Messages"), Translate("Incoming (Focused Window)")); SkinAddNewSoundEx("RecvMsgInactive", Translate("Messages"), Translate("Incoming (Unfocused Window)")); SkinAddNewSoundEx("AlertMsg", Translate("Messages"), Translate("Incoming (New Session)")); SkinAddNewSoundEx("SendMsg", Translate("Messages"), Translate("Outgoing")); hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND); if (hCurHyperlinkHand == NULL) hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND)); hDragCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_DRAGCURSOR)); return 0; }
// routine to find what a shortcut is pointing at int get_target(char *target_fname, char *retPath) { HRESULT hres; IShellLink *shell_link; IPersistFile *persist_file; int result = 0; WCHAR wsz[MAX_PATH]; hres = OleInitialize(NULL); if (hres != S_FALSE && hres != S_OK) return (-1); // Get a pointer to the IShellLink interface hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (void **) &shell_link); if (!SUCCEEDED(hres)) { OleUninitialize(); return (-1); } // Get a pointer to the IPersistFile interface hres = shell_link->lpVtbl->QueryInterface(shell_link, &IID_IPersistFile, (void **) &persist_file); if (SUCCEEDED(hres)) { // Ensure that the string is Unicode MultiByteToWideChar(CP_ACP, 0, (LPCSTR) target_fname, -1, wsz, MAX_PATH); // Load the shortcut hres = persist_file->lpVtbl->Load(persist_file, wsz, STGM_READ); if (SUCCEEDED(hres)) { // read stuff from the link object and print it to the screen shell_link->lpVtbl->GetPath(shell_link, retPath, MAX_PATH, NULL, SLGP_RAWPATH); } else result = -1; // Release the pointer to the IPersistFile interface persist_file->lpVtbl->Release(persist_file); } OleUninitialize(); return(result); }
int CWinMain::WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR lpsCmdLine, int nCmdShow) { // WinMain function receives an argument of the program, which is assigned to a member variable m_hInst = hInst; m_hPrevInst = hPrevInst; m_lpsCmdLine = lpsCmdLine; m_nCmdShow = nCmdShow; OleInitialize(nullptr); if (!InitApp()) return FALSE; if (!InitInstance()) return FALSE; HACCEL hAccel = LoadAccelerators(hInst, _T("MYACCEL")); if (!hAccel) return FALSE; COption option; MSG msg; int bRet; while ((bRet = GetMessage(&msg, nullptr, 0, 0)) != 0) { if (bRet == -1) { break; } else if (!TranslateAccelerator(m_hWnd, hAccel, &msg)) { //if (option.GetHandle() || !PropSheet_IsDialogMessage(option.GetHandle(), &msg)) //{ TranslateMessage(&msg); DispatchMessage(&msg); //} //if (option.GetHandle() && PropSheet_GetCurrentPageHwnd(option.GetHandle()) == nullptr) //{ // Exits the property sheet // option.Close(); //} } } OleUninitialize(); return static_cast<int>(msg.wParam); }
BOOL WINAPI AtlAxWinInit(void) { WNDCLASSEXW wcex; #if _ATL_VER == _ATL_VER_80 #define ATL_NAME_SUFFIX '8','0',0 #elif _ATL_VER == _ATL_VER_90 #define ATL_NAME_SUFFIX '9','0',0 #elif _ATL_VER == _ATL_VER_100 #define ATL_NAME_SUFFIX '1','0','0',0 #elif _ATL_VER == _ATL_VER_110 #define ATL_NAME_SUFFIX '1','1','0',0 #else #error Unsupported version #endif const WCHAR AtlAxWinW[] = {'A','t','l','A','x','W','i','n',ATL_NAME_SUFFIX}; const WCHAR AtlAxWinLicW[] = {'A','t','l','A','x','W','i','n','L','i','c',ATL_NAME_SUFFIX}; FIXME("version %04x semi-stub\n", _ATL_VER); if ( FAILED( OleInitialize(NULL) ) ) return FALSE; wcex.cbSize = sizeof(wcex); wcex.style = CS_GLOBALCLASS | CS_DBLCLKS; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = GetModuleHandleW( NULL ); wcex.hIcon = NULL; wcex.hCursor = NULL; wcex.hbrBackground = NULL; wcex.lpszMenuName = NULL; wcex.hIconSm = 0; wcex.lpfnWndProc = AtlAxWin_wndproc; wcex.lpszClassName = AtlAxWinW; if ( !RegisterClassExW( &wcex ) ) return FALSE; wcex.lpszClassName = AtlAxWinLicW; if ( !RegisterClassExW( &wcex ) ) return FALSE; return TRUE; }
BOOL MYWINAPI DllMain(HANDLE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) #endif { switch(fdwReason) { /* ============================================================== */ case DLL_PROCESS_ATTACH: { /* * Here you would do any initialization that you want to do when * the DLL loads. The OS calls this every time another program * runs which uses this DLL. You should put some complementary * cleanup code in the DLL_PROCESS_DETACH case. */ /* Initialize the OLE interface */ if (OleInitialize(NULL)) return(0); break; } /* ============================================================== */ case DLL_THREAD_ATTACH: { /* We don't need to do any initialization for each thread of * the program which uses this DLL, so disable thread messages. */ DisableThreadLibraryCalls(hinstDLL); break; } /* case DLL_THREAD_DETACH: { break; } */ /* ============================================================== */ case DLL_PROCESS_DETACH: { OleUninitialize(); } } /* Success */ return(1); }
void Framework::InitializeNew() { ReleaseTraceCode(FRAMEWORK_INITIALIZE); Trace("Framework::Initialize\n"); OleInitialize(NULL); InitCommonControls(); // 1. menu builder MenuBuilderStorage = new MenuBuilderStorageImpl_Unlimited; // 2. plugin manager PluginManager = new PluginManagerImpl_Unlimited; // 3. hotspot enabler HotspotEnabler = new HotspotEnablerImpl_Registered; }
static void test_CoCreateInstance(void) { REFCLSID rclsid = &CLSID_MyComputer; IUnknown *pUnk = (IUnknown *)0xdeadbeef; HRESULT hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk); ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr); ok(pUnk == NULL, "CoCreateInstance should have changed the passed in pointer to NULL, instead of %p\n", pUnk); OleInitialize(NULL); hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk); ok_ole_success(hr, "CoCreateInstance"); IUnknown_Release(pUnk); OleUninitialize(); hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk); ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr); }
//------------------------------------------------------------------------------ // Method: ExtendBridge // // Description: Constructor. // // Return: // none // //------------------------------------------------------------------------------ ExtendBridge::ExtendBridge() { // initialize the OLE OleInitialize(NULL); pExtendDisp = NULL; extendPath = NULL; // // Standard libraries (libraries usually required by SEI models) // libraries.insert(StringPair(SEI_LIB, "SEI-2.lix")); libraries.insert(StringPair(BPR_LIB, "BPR.lix")); libraries.insert(StringPair(UTILITIES_LIB, "Utilities.lix")); libraries.insert(StringPair(DISCRETE_LIB, "Discrete Event.lix")); libraries.insert(StringPair(GENERIC_LIB, "Generic.lix")); libraries.insert(StringPair(PLOTTER_LIB, "Plotter.lix")); }
void __fastcall TOptionsForm::ToolButton1Click(TObject *Sender) { UnicodeString dir; if (!DirectoryExists(AcfParams.Save_Dir)) dir = ExtractFilePath(Application->ExeName); else dir = AcfParams.Save_Dir; _browseinfoA lpbi; LPMALLOC ppMalloc; char *buffer; PItemIDList ItemIDList; memset(&lpbi, 0 ,sizeof(_browseinfoA)); if ((SHGetMalloc(&ppMalloc) == S_OK) && (ppMalloc != NULL)) { buffer = (char *) ppMalloc->Alloc(1024); try { OleInitialize(NULL); lpbi.hwndOwner = Application->Handle; lpbi.pidlRoot = NULL; lpbi.pszDisplayName = buffer; lpbi.lpszTitle = "Выберите директорию для сохранения данных"; lpbi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI | BIF_EDITBOX; lpbi.lpfn = &BrowseCallbackProc; lpbi.lParam = (long) AcfParams.Save_Dir.t_str(); try { ItemIDList = SHBrowseForFolderA(&lpbi); } catch (...) { } if (ItemIDList != NULL) { SHGetPathFromIDListA(ItemIDList, buffer); ppMalloc->Free(ItemIDList); Label56->Caption = buffer; } } __finally { ppMalloc->Free(buffer); } }
//----------------------------------------------------------------------------- // Name: ModelessDialogThread // Object: allow to act like a dialog box in modeless mode // Parameters : // in : PVOID lParam : HINSTANCE hInstance : application instance // out : // return : //----------------------------------------------------------------------------- DWORD WINAPI CComShowMethodsAddress::ModelessDialogThread(PVOID lParam) { CComShowMethodsAddress* pComShowMethodsAddress=new CComShowMethodsAddress(); // force ole initialization for current thread OleInitialize(NULL); DialogBoxParam ((HINSTANCE)lParam,(LPCTSTR)IDD_DIALOG_SHOW_METHODS_ADDRESS,NULL,(DLGPROC)CComShowMethodsAddress::WndProc,(LPARAM)pComShowMethodsAddress); delete pComShowMethodsAddress->pTreeview; // uninitialize ole for current thread // OleUninitialize(); // too slow delete pComShowMethodsAddress; if (hSemaphoreOpenDialogs) ReleaseSemaphore(hSemaphoreOpenDialogs,1,NULL); // must be last instruction return 0; }
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE , LPTSTR lpstrCmdLine, int nCmdShow) { OleInitialize(NULL); ::DefWindowProc(NULL, 0, 0, 0L); AtlInitCommonControls(ICC_BAR_CLASSES); HRESULT hRes = _Module.Init(NULL, hInstance); ATLASSERT(SUCCEEDED(hRes)); int nRet = Run(lpstrCmdLine, nCmdShow); _Module.Term(); ::CoUninitialize(); return nRet; }
/* * Initialize Global IME. * "atom" must be return value of RegisterClass(Ex). */ void global_ime_init(ATOM atom, HWND hWnd) { IUnknown *pI; HRESULT hr; if (pIApp != NULL || pIMsg != NULL) return; OleInitialize(NULL); /* * Get interface IUnknown */ hr = CoCreateInstance(CLSID_CActiveIMM, NULL, CLSCTX_SERVER, IID_IUnknown, (void**)&pI); if (FAILED(hr) || !pI) return; /* * Get interface IActiveIMMApp */ hr = pI->QueryInterface(IID_IActiveIMMApp, (void**)&pIApp); if (FAILED(hr)) pIApp = NULL; /* * Get interface IActiveIMMMessagePumpOwner */ hr = pI->QueryInterface(IID_IActiveIMMMessagePumpOwner, (void**)&pIMsg); if (FAILED(hr)) pIMsg = NULL; if (pIApp != NULL) { pIApp->Activate(TRUE); pIApp->FilterClientWindows(&atom, 1); } if (pIMsg != NULL) pIMsg->Start(); pI->Release(); s_hWnd = hWnd; }
CDownloadTask::~CDownloadTask() { BOOL bCOM = SUCCEEDED( OleInitialize( NULL ) ); Transfers.m_pSection.Lock(); if ( Downloads.Check( m_pDownload ) ) m_pDownload->OnTaskComplete( this ); CEvent* pEvent = m_pEvent; Transfers.m_pSection.Unlock(); if ( pEvent ) pEvent->SetEvent(); delete m_pRequest; if ( bCOM ) OleUninitialize(); }
void TOLEInitializer::Allocate() { Release(); try { HRESULT r = OleInitialize(NULL); if(r != S_OK && r != S_FALSE) INITIATE_FAILURE; m_bAllocated = true; } catch(...) { Release(); throw 1; } }
static void test_DoDragDrop(void) { DWORD effect; HRESULT hr; HWND hwnd; hwnd = CreateWindowA("WineOleTestClass", "Test", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL); ok(IsWindow(hwnd), "failed to create window\n"); hr = OleInitialize(NULL); ok(hr == S_OK, "got 0x%08x\n", hr); hr = RegisterDragDrop(hwnd, &DropTarget); ok(hr == S_OK, "got 0x%08x\n", hr); /* incomplete arguments set */ hr = DoDragDrop(NULL, NULL, 0, NULL); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = DoDragDrop(NULL, &DropSource, 0, NULL); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = DoDragDrop(&DataObject, NULL, 0, NULL); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = DoDragDrop(NULL, NULL, 0, &effect); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = DoDragDrop(&DataObject, &DropSource, 0, NULL); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = DoDragDrop(NULL, &DropSource, 0, &effect); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = DoDragDrop(&DataObject, NULL, 0, &effect); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); OleUninitialize(); DestroyWindow(hwnd); }
BOOL CALLBACK DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { static bool isOleInitialized = false; switch (fdwReason) { case DLL_PROCESS_ATTACH: { isOleInitialized = OleInitialize(0) ? true : false; hmodAvcodec = LoadLibrary(L".\\plugins\\VideoSourcePlugin\\avcodec-57.dll"); hmodAvformat = LoadLibrary(L".\\plugins\\VideoSourcePlugin\\avformat-57.dll"); hmodMediaProcessSDK = LoadLibrary(L".\\plugins\\VideoSourcePlugin\\MediaProcessSDK.dll"); // main plugin dll hmodVspPlugin = LoadLibrary(L".\\plugins\\VideoSourcePlugin\\VideoSourcePluginFFmpeg.dll"); if (hmodVspPlugin != NULL) { InternalLoadPlugin = (LOADPLUGIN_PROC)GetProcAddress(hmodVspPlugin, "LoadPlugin"); InternalUnloadPlugin = (UNLOADPLUGIN_PROC)GetProcAddress(hmodVspPlugin, "UnloadPlugin"); InternalOnStartStream = (ONSTARTSTREAM_PROC)GetProcAddress(hmodVspPlugin, "OnStartStream"); InternalOnStopStream = (ONSTOPSTREAM_PROC)GetProcAddress(hmodVspPlugin, "OnStopStream"); InternalGetPluginName = (GETPLUGINNAME_PROC)GetProcAddress(hmodVspPlugin, "GetPluginName"); InternalGetPluginDescription = (GETPLUGINDESCRIPTION_PROC)GetProcAddress(hmodVspPlugin, "GetPluginDescription"); } break; } case DLL_PROCESS_DETACH: { if (isOleInitialized) { OleUninitialize(); } if (hmodVspPlugin) FreeLibrary(hmodVspPlugin); if (hmodMediaProcessSDK) FreeLibrary(hmodMediaProcessSDK); if (hmodAvformat) FreeLibrary(hmodAvformat); if (hmodAvcodec) FreeLibrary(hmodAvcodec); break; } } return TRUE; }
//============================================================================= // 函数名称: 注册DLL // 作者说明: mushuai // 修改时间: 2010-03-08 //============================================================================= int RegSvr(LPCTSTR pszDllName,BOOL install) { int iReturn=1; LPCSTR pszDllEntryPoint = install ? _szDllRegSvr : _szDllUnregSvr; ATLASSERT(pszDllName); // Initialize OLE. if (FAILED(OleInitialize(NULL))) { iReturn = FAIL_OLE; OleUninitialize(); return iReturn; } // SetErrorMode(SEM_FAILCRITICALERRORS); // Make sure LoadLib fails. // Load the library. CString dllName = GetShortPath(pszDllName); HINSTANCE hLib = LoadLibraryEx(dllName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (hLib < (HINSTANCE)HINSTANCE_ERROR) { iReturn = FAIL_LOAD; OleUninitialize(); return iReturn; } // Find the entry point. (FARPROC&)lpDllEntryPoint = GetProcAddress(hLib, pszDllEntryPoint); if (lpDllEntryPoint == NULL) { iReturn = FAIL_ENTRY; FreeLibrary(hLib); OleUninitialize(); return iReturn; } // Call the entry point. HRESULT hr = (*lpDllEntryPoint)(); if (FAILED(hr)) { iReturn = FAIL_REG; FreeLibrary(hLib); OleUninitialize(); return iReturn; } return iReturn; }
int WINAPI wWinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPWSTR cmdline, int cmdshow) { parameters_struct parameters; HRESULT hres; MSG msg; IShellFolder *folder; INITCOMMONCONTROLSEX init_info; memset(¶meters,0,sizeof(parameters)); explorer_hInstance = hinstance; parse_command_line(cmdline,¶meters); hres = OleInitialize(NULL); if(FAILED(hres)) { WINE_ERR("Could not initialize COM\n"); ExitProcess(EXIT_FAILURE); } if(parameters.root[0] && !PathIsDirectoryW(parameters.root)) if(ShellExecuteW(NULL,NULL,parameters.root,NULL,NULL,SW_SHOWDEFAULT) > (HINSTANCE)32) ExitProcess(EXIT_SUCCESS); init_info.dwSize = sizeof(INITCOMMONCONTROLSEX); init_info.dwICC = ICC_USEREX_CLASSES | ICC_BAR_CLASSES | ICC_COOL_CLASSES; if(!InitCommonControlsEx(&init_info)) { WINE_ERR("Could not initialize Comctl\n"); ExitProcess(EXIT_FAILURE); } register_explorer_window_class(); folder = get_starting_shell_folder(¶meters); make_explorer_window(folder); IShellFolder_Release(folder); while(GetMessageW( &msg, NULL, 0, 0 ) != 0) { TranslateMessage(&msg); DispatchMessageW(&msg); } return 0; }
GHOST_SystemWin32::GHOST_SystemWin32() : m_hasPerformanceCounter(false), m_freq(0), m_start(0) { m_displayManager = new GHOST_DisplayManagerWin32(); GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::GHOST_SystemWin32(): m_displayManager==0\n"); m_displayManager->initialize(); m_consoleStatus = 1; // Check if current keyboard layout uses AltGr and save keylayout ID for // specialized handling if keys like VK_OEM_*. I.e. french keylayout // generates VK_OEM_8 for their exclamation key (key left of right shift) this->handleKeyboardChange(); // Require COM for GHOST_DropTargetWin32 created in GHOST_WindowWin32. OleInitialize(0); #ifdef WITH_INPUT_NDOF m_ndofManager = new GHOST_NDOFManagerWin32(*this); #endif }
SubWindow2::SubWindow2(HWND hwnd,int x,int y) { HMODULE hModule = ::GetModuleHandle(0); applicationpath = (wchar_t*)malloc((MAX_PATH+1)*sizeof(wchar_t)); GetModuleFileName(NULL, applicationpath, MAX_PATH); (wcsrchr(applicationpath, '\\'))[1] = 0; int ww = 700,wh=500; OleInitialize(0); ltskinview= CreateLTFrameInstance(this,L"LTFrame",hwnd,WS_POPUP | WS_VISIBLE,x,y,ww,wh,0); SubWindowC =this; ltskinview->BindUserFunction("DragWindow",DragWindowFun2,0); //ltskinview->BindUserFunction("CloseWindow",CloseWindowFun,0); //ltskinview->BindUserFunction("MinWindow",MinWindowFun,0); SetWindowText(ltskinview->windowHandle(),L"LTFrame"); wstring path = wstring(applicationpath)+L"./template/SubWindow.html"; ltskinview->loadFile(path.c_str()); ltskinview->EnableDragFrameChangeSize(false); SetForegroundWindow(ltskinview->windowHandle()); //ltskinview->MessageLoop(); }
CAtmoLightFilter::~CAtmoLightFilter( ) { OleInitialize(NULL); log("destroying atmo filtern\n"); if(m_AtmoInitialized) { IAtmoRemoteControl *remoteControl = getAtmoRemoteControl(); if(remoteControl) { if( m_CurrentAtmoEffect != cemLivePicture) { remoteControl->setEffect( m_CurrentAtmoEffect, &m_CurrentAtmoEffect ); } else { IAtmoLiveViewControl *liveControl = getAtmoLiveViewControl(); if(liveControl) { liveControl->setLiveViewSource( lvsGDI ); liveControl->Release(); } } remoteControl->Release(); } if(m_pixel_buffer) SafeArrayDestroy( m_pixel_buffer ); if(m_bitmap_header) SafeArrayDestroy( m_bitmap_header ); } OleUninitialize(); log("atmo filter destroyed\n\n\n"); if(m_log_file) fclose( m_log_file ); free( m_pszAtmoWin ); free( m_pszLogFileName ); free( m_pszImageLogPath ); }
int LoadSendRecvMessageModule(void) { if (FIF == 0) { MessageBox(0, TranslateT("The image service plugin (advaimg.dll) is not properly installed.\n\nTabSRMM is disabled."), TranslateT("TabSRMM fatal error"), MB_OK | MB_ICONERROR); return 1; } INITCOMMONCONTROLSEX icex; icex.dwSize = sizeof(INITCOMMONCONTROLSEX); icex.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES | ICC_LISTVIEW_CLASSES; InitCommonControlsEx(&icex); Utils::loadSystemLibrary(L"\\riched20.dll"); OleInitialize(NULL); mREOLECallback = new REOLECallback; Win7Taskbar = new CTaskbarInteract; Win7Taskbar->updateMetrics(); ZeroMemory(&nen_options, sizeof(nen_options)); M.m_hMessageWindowList = WindowList_Create(); PluginConfig.hUserPrefsWindowList = WindowList_Create(); sendQueue = new SendQueue; Skin = new CSkin; sendLater = new CSendLater; InitOptions(); InitAPI(); PluginConfig.reloadSystemStartup(); ReloadTabConfig(); NEN_ReadOptions(&nen_options); db_set_b(0, TEMPLATES_MODULE, "setup", 2); LoadDefaultTemplates(); BuildCodePageList(); return 0; }
/************************************************************************* * SHBrowseForFolderW [SHELL32.@] * * NOTES * crashes when passed a null pointer */ LPITEMIDLIST WINAPI SHBrowseForFolderW (LPBROWSEINFOW lpbi) { browse_info info; DWORD r; HRESULT hr; #ifdef __REACTOS__ WORD wDlgId; #else const WCHAR * templateName; INITCOMMONCONTROLSEX icex; #endif info.hWnd = 0; info.pidlRet = NULL; info.lpBrowseInfo = lpbi; info.hwndTreeView = NULL; #ifndef __REACTOS__ icex.dwSize = sizeof( icex ); icex.dwICC = ICC_TREEVIEW_CLASSES; InitCommonControlsEx( &icex ); #endif hr = OleInitialize(NULL); if (lpbi->ulFlags & BIF_NEWDIALOGSTYLE) wDlgId = IDD_BROWSE_FOR_FOLDER_NEW; else wDlgId = IDD_BROWSE_FOR_FOLDER; r = DialogBoxParamW( shell32_hInstance, MAKEINTRESOURCEW(wDlgId), lpbi->hwndOwner, BrsFolderDlgProc, (LPARAM)&info ); if (SUCCEEDED(hr)) OleUninitialize(); if (!r) { ILFree(info.pidlRet); return NULL; } return info.pidlRet; }