BOOL CTestApp::InitInstance() { // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControls()。否则,将无法创建窗口。 InitCommonControls(); CWinApp::InitInstance(); AfxEnableControlContainer(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("应用程序向导生成的本地应用程序")); CoInitialize(NULL); CTestDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: 在此放置处理何时用“确定”来关闭 //对话框的代码 } else if (nResponse == IDCANCEL) { // TODO: 在此放置处理何时用“取消”来关闭 //对话框的代码 } // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序, // 而不是启动应用程序的消息泵。 return FALSE; }
BOOL APIENTRY DllMain( HINSTANCE instance, DWORD reason, void* /*reserved*/ ) { s_classDescMySceneExport.instance = instance; if ( !s_controlsInit ) { s_controlsInit = true; InitCustomControls( instance ); InitCommonControls(); } switch ( reason ) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }
void StatusBar::init(HINSTANCE hInst, HWND hPere) { Window::init(hInst, hPere); InitCommonControls(); _hSelf = ::CreateWindowEx( 0, STATUSCLASSNAME, "", WS_CHILD /*| SBARS_SIZEGRIP*/, 0, 0, 0, 0, _hParent, NULL, _hInst, 0); if (!_hSelf) { systemMessage("System Err"); throw int(9); } }
BOOL CRCTest2App::InitInstance() { // InitCommonControls() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. InitCommonControls(); CWinApp::InitInstance(); AfxEnableControlContainer(); // 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 // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); CRCTest2Dlg dlg; m_pMainWnd = &dlg; INT_PTR 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; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int ret; WSADATA wsaData; /* Starting Winsock -- for name resolution. */ WSAStartup(MAKEWORD(2, 0), &wsaData); /* Initializing config */ init_config(); /* Initializing controls */ InitCommonControls(); /* Creating main dialogbox */ DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN), NULL, DlgProc); /* Check if service is running and try to start it */ if((strcmp(config_inst.key, FL_NOKEY) != 0)&& (strcmp(config_inst.server, FL_NOSERVER) != 0) && !CheckServiceRunning() && (config_inst.admin_access != 0)) { ret = MessageBox(NULL, "OSSEC Agent not running. " "Do you wish to start it?", "Wish to start the agent?", MB_OKCANCEL); if(ret == IDOK) { /* Starting the service */ os_start_service(); } } return(0); }
VOID WINAPI InitPGPDurationControl (VOID) { WNDCLASS wc; InitCommonControls (); // register new window class wc.style = CS_DBLCLKS | CS_GLOBALCLASS | CS_PARENTDC; // Class style(s). wc.lpfnWndProc = (WNDPROC) sDurationMsgProc; wc.cbClsExtra = 0; // No per-class extra data. wc.cbWndExtra = sizeof (DCWndData*); // pointer to extra data // structure wc.hInstance = 0; wc.hIcon = NULL; wc.hCursor = LoadCursor (NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH) (COLOR_WINDOW+1); // Background color wc.lpszMenuName = NULL; // No menu wc.lpszClassName = WC_PGPDURATION; // Name used in CreateWindow RegisterClass (&wc); }
BOOL InitApp(void) { WNDCLASS wc; wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hinst; wc.hIcon = NULL; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = TEXT("Scratch"); if (!RegisterClass(&wc)) return FALSE; InitCommonControls(); /* In case we use a common control */ return TRUE; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { CAErrno caErr; int nProcExit = CA_PROC_EXIT_OK; g_hInstance = hInstance; InitCommonControls(); caErr = CAS_PStartup(__argc, __argv, &g_ocawProc); if (CA_ERR_SUCCESS != caErr) { CAS_Panic(CA_SRC_MARK, CA_PROC_EXIT_INIT_FAILED, TEXT("Startup failed. Can't load run time library or config." "Last Error code (%u). "), caErr); return CA_PROC_EXIT_INIT_FAILED; } nProcExit = CAS_PRun(&g_ocawProc); CAS_PCleanup(&g_ocawProc); return nProcExit; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { InitCommonControls(); HWND hwnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MAINDIALOG), NULL, dlgproc); if (!hwnd) return -1; g_hwnd = hwnd; SetClassLong(g_hwnd, GCL_HICON, (LONG)LoadIcon(hInstance, MAKEINTRESOURCE(IDI_NETUPVIM))); MSG msg; ShowWindow(hwnd, SW_SHOW); int res = MessageBox(hwnd, "Vimのネットワークアップデートを開始しますか?\r\n" "\r\n" "アップデートには数分かそれ以上かかる場合も\r\n" "あります。もしも現在Vimを使用している場合、\r\n" "アップデートを始める前にVimを終了してください。" , "Vimアップデートの確認", MB_YESNO | MB_ICONQUESTION); if (res == IDNO) DestroyWindow(hwnd); else _beginthread(do_update, 0, 0); while (GetMessage(&msg, NULL, 0, 0)) { if (IsDialogMessage(hwnd, &msg)) continue; TranslateMessage(&msg); DispatchMessage(&msg); } return 0; }
void StatusBar::init(HINSTANCE hInst, HWND hParent, int nbParts) { Window::init(hInst, hParent); InitCommonControls(); _hSelf = //CreateStatusWindow(WS_CHILD | WS_CLIPSIBLINGS, NULL, _hParent, IDC_STATUSBAR); ::CreateWindowEx( 0, STATUSCLASSNAME, TEXT(""), WS_CHILD | SBARS_SIZEGRIP , 0, 0, 0, 0, _hParent, NULL, _hInst, 0); if (!_hSelf) { systemMessage(TEXT("System Err")); throw int(9); } _nbParts = nbParts; _partWidthArray = new int[_nbParts]; // Set the default width for (int i = 0 ; i < _nbParts ; i++) _partWidthArray[i] = defaultPartWidth; // Allocate an array for holding the right edge coordinates. _hloc = ::LocalAlloc(LHND, sizeof(int) * _nbParts); _lpParts = (LPINT)::LocalLock(_hloc); RECT rc; ::GetClientRect(_hParent, &rc); adjustParts(rc.right); }
BOOL CCapVideoApp::InitInstance(){ InitCommonControls(); CWinApp::InitInstance(); SetRegistryKey(_T("6BEE NETWORKS PTE LTD")); CWinThread::InitInstance(); CCapVideoDlg dlg;//main thread start dialog frame if(!InitCapture()){ return FALSE; } dlg.m_caprawvideo = m_caprawvideo; if (m_caprawvideo){//derive a thread to capture video m_caprawvideo->PostThreadMessage(WM_STARTPREVIEW,(WPARAM)&(dlg.m_cappreview),(LPARAM)0); } INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDCANCEL && strlen(m_caprawvideo->getavfilename())!=0){ /// @todo temp comment out this - can use a function in 6beecommond.dll to replace it. ///////////////////////////// start to upload ///////////////////////////////// /* USES_CONVERSION; CString videopath; videopath.Format(_T("%s%s"),_6beed_util::Get6BEEPath(_6bees_const::kVideoDir,true),A2CW(m_caprawvideo->getavfilename())); HWND hwndTo = ::FindWindow(0,_6bees_const::kUploader_WndTitle); if(!hwndTo){ CString UploaderCmd = _6beed_util::Get6BEEPath(_6bees_const::kUploaderName); UploaderCmd += _T(" -m upload -f \"") + videopath + _T("\""); STARTUPINFO si = {sizeof(si)}; PROCESS_INFORMATION pi; if (!CreateProcessW(NULL,const_cast<LPWSTR>(UploaderCmd.GetString()),NULL,NULL,false,0,NULL,NULL,&si,&pi)){ ::AfxMessageBox(_T("ERROR: Cannot Start 6BeeUpLoader!")); } }else{ _6beed_util::SendMsgToUploader(hwndTo,W2CA(videopath),CPYDATA_UPLOAD_2_UPLOAD_DIRECT); } */ ///////////////////////////////////////////////////////////////////////////// } return FALSE; }
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { VIRTUALDATA *pvd; HANDLE hSem; hSem = CreateSemaphore (NULL, 0, 1, APPNAME); if ((hSem != NULL) && (GetLastError() == ERROR_ALREADY_EXISTS)) { HWND hWndExisting; CloseHandle(hSem); hWndExisting = FindWindow (NULL, APPNAME); if (hWndExisting) SetForegroundWindow ((HWND)(((ULONG)hWndExisting) | 0x01)); return TRUE; } g_hinst=hInstance; InitCommonControls(); pvd=(VIRTUALDATA *)malloc(sizeof(VIRTUALDATA)); if(pvd!=NULL) { memset(pvd,0x00,sizeof(VIRTUALDATA)); GetVirtualMemoryStatus(pvd); GetProcessNames(pvd); DialogBoxParam (g_hinst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc, (LPARAM)pvd); free(pvd); } return 0; }
BOOL CPuzzleGameApp::InitInstance() { // InitCommonControls() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. InitCommonControls(); CWinApp::InitInstance(); AfxEnableControlContainer(); globalData.SetDPIAware (); CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManager2007)); GdiplusStartupInput gdiplusStartupInput; GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL); CPuzzleGameDlg dlg; m_pMainWnd = &dlg; INT_PTR 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 } BCGCBProCleanUp (); // 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 CAddress::Create(HWND hParent, long ID, HINSTANCE hInst) { InitCommonControls(); m_hInst = hInst; m_hParent = hParent; m_hAddress = CreateWindow(TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_LIST, 0, 100, 100, 200, m_hParent, (HMENU) ID, m_hInst, NULL); m_nID = ID; SetButtonImages(); AddNonButtonControl(_T("STATIC"), _T("Address"), WS_CHILD | WS_VISIBLE, IDC_ADDRESS_STATIC, 50, 50, 0, IDC_ADDRESS_STATIC, 3); HFONT hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT); SendMessage(GetDlgItem(m_hAddress, IDC_ADDRESS_STATIC), WM_SETFONT, (WPARAM) hFont, TRUE); RECT main; GetWindowRect(m_hParent, &main); AddNonButtonControl(_T("EDIT"), NULL, WS_CHILD | WS_VISIBLE, IDC_ADDRESS_EDIT, 900, 20, 1, IDC_ADDRESS_EDIT, 1); SendMessage(GetDlgItem(m_hAddress, IDC_ADDRESS_EDIT), WM_SETFONT, (WPARAM) hFont, TRUE); AddButton(TBSTATE_ENABLED, BTNS_BUTTON, 0 , IDC_ADDRESS_GO, _T("Go"), 0); }
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG msg ; InitCommonControls(); InitProgram (hInstance); init_combo_list(); init_info(); edit_info_append (">>Ready.\n"); if (auto_con) on_button_connect_clicked(); while(GetMessage(&msg, NULL, 0, 0)) { if(IsDialogMessage(hwndDlg, &msg)) continue; TranslateMessage(&msg); DispatchMessage(&msg); } return (int) msg.wParam; }
void win_open_config(void) { if (config_wnd) return; set_dpi_auto_scaling(true); static bool initialised = false; if (!initialised) { InitCommonControls(); RegisterClass(&(WNDCLASS){ .style = CS_DBLCLKS, .lpfnWndProc = DefDlgProc, .cbClsExtra = 0, .cbWndExtra = DLGWINDOWEXTRA + 2 * sizeof (LONG_PTR), .hInstance = inst, .hIcon = null, .hCursor = LoadCursor(null, IDC_ARROW), .hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1), .lpszMenuName = null, .lpszClassName = "ConfigBox" });
int addtooltip(control c, const char *tp) { TOOLINFO ti; char *cc = (char*) &ti; int i, lim = sizeof (ti); for (i = 0; i++ < lim; *cc++ = 0); if (hwndToolTip == 0) { InitCommonControls(); hwndToolTip = CreateWindowEx( 0,TOOLTIPS_CLASS,NULL,WS_POPUP|TTS_ALWAYSTIP, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT, hwndFrame,NULL,this_instance,NULL); if(!hwndToolTip) return 0; } ti.cbSize = sizeof(ti); ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; ti.hwnd = (HWND) c->parent->handle; ti.uId = (UINT_PTR) c->handle; ti.lpszText = (LPSTR) tp; return (SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti)==TRUE)? 1:0; }
void InitializeExportDialogs( const CHAR* strTitle, HWND hParentWindow, HINSTANCE hInst ) { g_strTitle = strTitle; g_hInstance = hInst; g_hParentWindow = hParentWindow; // Pull in common and rich edit controls INITCOMMONCONTROLSEX ICEX; ICEX.dwSize = sizeof( INITCOMMONCONTROLSEX ); ICEX.dwICC = ICC_WIN95_CLASSES | ICC_COOL_CLASSES | ICC_USEREX_CLASSES; InitCommonControlsEx( &ICEX ); InitCommonControls(); g_hRichEdit = LoadLibrary( TEXT( "Riched32.dll" ) ); assert( g_hRichEdit != nullptr ); ExportLog::AddListener( &g_ConsoleDlg ); g_pProgress = &g_ConsoleDlg; const DWORD dwStackSize = 8192; _beginthreadex( nullptr, dwStackSize, ExportConsoleDialog::ThreadEntry, &g_ConsoleDlg, 0, nullptr ); _beginthreadex( nullptr, dwStackSize, ExportSettingsDialog::ThreadEntry, &g_SettingsDlg, 0, nullptr ); }
void InitializeLibrary() { try { // _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG); // _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG); // int iFlags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // iFlags |= _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF; // _CrtSetDbgFlag(iFlags); // _CrtSetAllocHook(AllocHook); // for the tab control in customization dialog InitCommonControls(); g_pGlobals = new Globals; assert(g_pGlobals); InitHeap(); } catch (...) { } }
LRESULT CALLBACK WndProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam) // 윈도우 프로시져 { switch(iMessage) { case WM_CREATE: InitCommonControls(); hToolBar=CreateToolbarEx(hWnd, WS_CHILD | WS_VISIBLE, 103, 4, g_hInst,IDB_BITMAP1, ToolBtn, 5, 16,16,16,16,sizeof(TBBUTTON)); // 툴바를 생성한다. return 0; case WM_COMMAND: switch(LOWORD(wParam)) { case 10: // 제일 왼쪽 툴버튼의 핸들. case IDR_LOAD: // or FILE->LOAD가 눌러졌을때 memset(&OFN,0,sizeof(OPENFILENAME)); OFN.lStructSize=sizeof(OPENFILENAME); OFN.hwndOwner=hWnd; OFN.lpstrFile=lpstrFile; OFN.nMaxFile=256; OFN.lpstrInitialDir="c:\\"; if (GetOpenFileName(&OFN)!=0) { window_main.set_child_window(OFN); // OFN을 갖는 childWindow인스턴스 생성 } break; } return 0; case WM_DESTROY: PostQuitMessage(0); return 0; case WM_SIZE: SendMessage(hToolBar,TB_AUTOSIZE,0,0); // 툴바 사이즈 조절 return 0; } return (DefWindowProc(hWnd,iMessage,wParam,lParam)); }
int runDialog(HINSTANCE hInst, int cmdShow, int dialogId, int iconId, int accelTableId, DLGPROC dialogProc, LPARAM lp) { HWND hDlg = NULL; HACCEL hAccel = NULL; MSG msg = { 0 }; BOOL ret = FALSE; HICON hIcon16 = NULL, hIcon32 = NULL; InitCommonControls(); g_hSysFont = Font_cloneFromSystem(); // retrieve global system font hDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(dialogId), 0, dialogProc, lp); if(iconId) { // put icon on dialog system menu, if any (probably yes) hIcon16 = (HICON)LoadImage(hInst, MAKEINTRESOURCE(iconId), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); hIcon32 = (HICON)LoadImage(hInst, MAKEINTRESOURCE(iconId), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon16); SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon32); } ShowWindow(hDlg, cmdShow); if(accelTableId) // load accelerators table, if any hAccel = LoadAccelerators(hInst, MAKEINTRESOURCE(accelTableId)); while((ret = GetMessage(&msg, 0, 0, 0)) != 0) { if(ret == -1) return -1; // failure if(!(hAccel && TranslateAccelerator(hDlg, hAccel, &msg)) && !IsDialogMessage(hDlg, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } if(hIcon16) DestroyIcon(hIcon16); // release the dialog icons if(hIcon32) DestroyIcon(hIcon32); Font_free(g_hSysFont); // release global system font return (int)msg.wParam; // this can be the return value of the program }
BOOL COverlappedCallbackApp::InitInstance() { // 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을 // 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControls()가 필요합니다. // InitCommonControls()를 사용하지 않으면 창을 만들 수 없습니다. InitCommonControls(); CWinApp::InitInstance(); AfxEnableControlContainer(); // 표준 초기화 // 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면 // 아래에서 필요 없는 특정 초기화 루틴을 제거해야 합니다. // 해당 설정이 저장된 레지스트리 키를 변경하십시오. // TODO: 이 문자열을 회사 또는 조직의 이름과 같은 // 적절한 내용으로 수정해야 합니다. SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성한 응용 프로그램")); COverlappedCallbackDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: 여기에 대화 상자가 확인을 눌러 없어지는 경우 처리할 // 코드를 배치합니다. } else if (nResponse == IDCANCEL) { // TODO: 여기에 대화 상자가 취소를 눌러 없어지는 경우 처리할 // 코드를 배치합니다. } // 대화 상자가 닫혔으므로 응용 프로그램의 메시지 펌프를 시작하지 않고 // 응용 프로그램을 끝낼 수 있도록 FALSE를 반환합니다. return FALSE; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { wnd = new Window(); // init our window object wnd2 = new Window(); // idem cfgwnd = new Window(); // idem cfg = new CConfig(); // init our config object InitCommonControls(); MSG msg; wnd->ghInstance = hInstance; // init the window instance wnd2->ghInstance = hInstance; // idem cfgwnd->ghInstance = hInstance; // idem wnd->CmdShow = nCmdShow; wnd2->CmdShow = nCmdShow; cfgwnd->CmdShow = nCmdShow; wnd->hWindow = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, MainDlg); // create our main dialog if(!wnd->hWindow) // if hwindow == NULL { char buf[100]; sprintf_s(buf, "Error 0x%x", GetLastError()); // copy the last error into the buffer MessageBox (0, buf, "CreateDialog", MB_ICONEXCLAMATION | MB_OK); // display it in a message box //LOG(buf); return -1; // stop the application } ShowWindow(wnd->hWindow, wnd->CmdShow); // show the dialog UpdateWindow(wnd->hWindow); // update the window int status; while ((status = GetMessage(&msg,NULL,0,0)) !=0) // message loop { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { InitCommonControls(ICC_WIN95_CLASSES); [!if WINX_VIEWTYPE_RICHEDIT] InitRichEditControl(); [!endif] [!if WINX_USE_LOOKNFEEL] WINX_APP_LOOKNFEEL(hInstance, IDR_MAINFRAME); [!endif] [!if WINX_VIEWTYPE_GENERIC || WINX_VIEWTYPE_SCROLL] [!output WINX_VIEW_CLASS]::RegisterClass(); [!endif] [!if WINX_USE_GDIPLUS] GdiplusAppInit gdiplus; [!endif] CComModuleInit module; [!if WINX_APPTYPE_DLG] CMainDlg dlg; dlg.Create(NULL); dlg.ShowWindow(SW_SHOW); return RunMsgLoop(); [!endif] [!if WINX_APPTYPE_DLG_MODAL] CMainDlg dlg; return dlg.DoModal(); [!endif] }
LRESULT CCPApplet::OnRun(CWnd* pParentWnd) { LRESULT lResult = 1; CWnd * pWnd; InitCommonControls(); pWnd = (CWnd*) m_uiClass->CreateObject(); if ( pWnd ) { lResult = ERROR_SUCCESS; if ( pWnd->IsKindOf( RUNTIME_CLASS( CPropertySheet ) ) ) { CPropertySheet * pSheet = (CPropertySheet*) pWnd; pSheet->Construct(m_name, pParentWnd, m_pageNumber); pSheet->DoModal(); } else { check( pWnd->IsKindOf( RUNTIME_CLASS( CDialog ) ) ); CDialog * pDialog = (CDialog*) pWnd; pDialog->DoModal(); } delete pWnd; } return lResult; }
int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev_instance, LPTSTR cmd_line, int window_show) { HpcMenuInterface::Instance(); // Menu System HpcBootApp *app = 0; // Application body. int ret = 0; InitCommonControls(); app = new HpcBootApp(instance); app->_cons = Console::Instance(); app->_root = new RootWindow(*app); if (!app->registerClass(reinterpret_cast <WNDPROC>(Window::_wnd_proc))) goto failed; if (!app->_root->create(0)) goto failed; Boot::Instance(); // Boot loader ret = app->run(); // Main loop. // NOTREACHED failed: Boot::Destroy(); if (app->_root) delete app->_root; delete app; Console::Destroy(); HpcMenuInterface::Destroy(); return ret; }
BOOL Taiga::InitInstance() { // Check another instance if (CheckInstance(L"Taiga-33d5a63c-de90-432f-9a8b-f6f733dab258", L"TaigaMainW")) return FALSE; g_hInstance = GetInstanceHandle(); // Initialize InitCommonControls(ICC_STANDARD_CLASSES); OleInitialize(NULL); // Initialize logger #ifdef _DEBUG Logger.SetOutputPath(AddTrailingSlash(GetCurrentDirectory()) + L"Taiga_debug.log"); Logger.SetSeverityLevel(LevelDebug); #else Logger.SetOutputPath(AddTrailingSlash(GetPathOnly(GetModulePath())) + L"Taiga.log"); Logger.SetSeverityLevel(LevelWarning); #endif // Load data LoadData(); // Create API windows Skype.Create(); TaigaApi.Create(); if (Settings.Program.StartUp.check_new_version) { // Create update dialog ExecuteAction(L"CheckUpdates"); } else { // Create main dialog ExecuteAction(L"MainDialog"); } return TRUE; }
VOID CDialog::LVM_AllocateColumns (int id, int value) { #if defined(__OS2__) HWND hwndContainer; CNRINFO cnrInfo; hwndContainer = WinWindowFromID (m_hWnd, id); memset (&cnrInfo, 0, sizeof (CNRINFO)); cnrInfo.cb = sizeof (CNRINFO); cnrInfo.flWindowAttr = CV_DETAIL|CA_DETAILSVIEWTITLES; WinSendMsg (hwndContainer, CM_SETCNRINFO, MPFROMP (&cnrInfo), MPFROMLONG (CMA_FLWINDOWATTR)); nFields = value; pFieldInfo = (PFIELDINFO)WinSendMsg (hwndContainer, CM_ALLOCDETAILFIELDINFO, (MPARAM)nFields, (MPARAM)0); pTopField = pFieldInfo; subItem = 0L; pRecord = NULL; #elif defined(__NT__) id = id; value = value; InitCommonControls (); lvC.mask = LVCF_FMT|LVCF_TEXT|LVCF_SUBITEM|LVCF_WIDTH; lvC.iSubItem = 0; lvC.pszText = ""; lvC.cx = 50; lvC.fmt = LVCFMT_LEFT; lvI.mask = 0; lvI.iItem = -1; lvI.iSubItem = 0; #endif }
/** * Initializes the material editor tool. */ void MaterialEditorInit( void ) { InitPropTree( win32.hInstance ); com_editors = EDITOR_MATERIAL; Sys_GrabMouseCursor( false ); InitAfx(); InitCommonControls(); // Initialize OLE libraries if( !AfxOleInit() ) { return; } AfxEnableControlContainer(); NONCLIENTMETRICS info; info.cbSize = sizeof( info ); ::SystemParametersInfo( SPI_GETNONCLIENTMETRICS, sizeof( info ), &info, 0 ); LOGFONT lf; memset( &lf, 0, sizeof( LOGFONT ) ); CWindowDC dc( NULL ); lf.lfCharSet = ( BYTE )GetTextCharsetInfo( dc.GetSafeHdc(), NULL, 0 ); lf.lfHeight = info.lfMenuFont.lfHeight; lf.lfWeight = info.lfMenuFont.lfWeight; lf.lfItalic = info.lfMenuFont.lfItalic; // check if we should use system font _tcscpy( lf.lfFaceName, info.lfMenuFont.lfFaceName ); materialEditorFont = new CFont; materialEditorFont->CreateFontIndirect( &lf ); // To create the main window, this code creates a new frame window // object and then sets it as the application's main window object meMainFrame = new MEMainFrame; // create and load the frame with its resources meMainFrame->LoadFrame( IDR_ME_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL ); // hide the doom window by default ::ShowWindow( win32.hWnd, SW_HIDE ); // The one and only window has been initialized, so show and update it meMainFrame->ShowWindow( SW_SHOW ); meMainFrame->UpdateWindow(); }
INT_PTR CALLBACK ListDlgPRoc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HWND hList = NULL; static LVCOLUMN lvCol{ 0 }; static LVITEM lvItem{ 0 }; static CSettings* settings{ 0 }; switch (message) { case WM_INITDIALOG: InitCommonControls(); settings = reinterpret_cast<CSettings*>(lParam); EnumWindows(EnumWindowsProc, NULL); hList = CreateListView(hWnd); InitListView(hList); break; case WM_NOTIFY: return ListViewNotify(settings->spotify, hWnd, lParam, settings->program); case WM_SIZE: ResizeListView(hList, hWnd); break; case WM_COMMAND: if (LOWORD(wParam) == IDOK) { saveSelection(settings->spotify, hList, settings->program); EndDialog(hWnd, 0); } break; case WM_CLOSE: case WM_DESTROY: EndDialog(hWnd, 0); break; default: break; } return 0; }