BOOL OnInitDialogAuthentication(HWND hDlg, PWLAN_CFG_PROPS psProp) { SHINITDLGINFO shidi = {0,}; SHMENUBARINFO mbi = {0,}; // Adding Scroll Bar support shidi.dwMask = SHIDIM_FLAGS; shidi.hDlg = hDlg; shidi.dwFlags = SHIDIF_WANTSCROLLBAR | SHIDIF_SIZEDLG; SHInitDialog(&shidi); //Menubar mbi.cbSize = sizeof( SHMENUBARINFO ); mbi.hwndParent = hDlg; mbi.dwFlags = SHCMBF_HMENU; mbi.nToolBarId = IDM_WIZARD_MID; mbi.hInstRes = HINST_RESDLL; SHCreateMenuBar( &mbi ); SHDoneButton(hDlg, SHDB_HIDE); InitWepKIndexControl(hDlg, psProp); EnableControlsAuthentication(hDlg, psProp); UpdateDataAuthentication(hDlg, &psProp->wzcnet, TRUE); return FALSE; }
BOOL OnDialogInit(HWND hDlg) { g_hDlg = hDlg; PostMessage(hDlg, WM_DIALOGCREATED, 0, 0); SetWindowText(hDlg, Strings.GetString(StrID_UninstallCaption)); SHINITDLGINFO shidi; shidi.dwMask = SHIDIM_FLAGS; shidi.dwFlags = SHIDIF_SIPDOWN | SHIDIF_EMPTYMENU; shidi.hDlg = hDlg; SHInitDialog(&shidi); // Hide the Done button SHDoneButton(hDlg, SHDB_HIDE); // Init controls WCHAR sMsg[c_nTempBufSize]; _snwprintf(sMsg, c_nTempBufSize, L"%s %s", Strings.GetString(StrID_FilesWillBeRemoved), g_sInstallPath); SetWindowText(GetDlgItem(hDlg, IDC_STATIC_TEXT), sMsg); SetWindowText(GetDlgItem(hDlg, IDC_QUESTION_TEXT), Strings.GetString(StrID_AreYouSure)); SetWindowText(GetDlgItem(hDlg, IDC_BTN_UNINSTALL), L"OK"); // TODO: Use localized text "Uninstall" SetWindowText(GetDlgItem(hDlg, IDCANCEL), Strings.GetString(StrID_Cancel)); ShowWindow(GetDlgItem(hDlg, IDC_PROGRESS), SW_HIDE); ShowWindow(GetDlgItem(hDlg, IDOK), SW_HIDE); return TRUE; }
BOOL OnInitDialogGeneral(HWND hDlg, PWLAN_CFG_PROPS psProp) { SHINITDLGINFO shidi = {0,}; SHMENUBARINFO mbi = {0,}; // Adding Scroll Bar support shidi.dwMask = SHIDIM_FLAGS; shidi.hDlg = hDlg; shidi.dwFlags = SHIDIF_WANTSCROLLBAR | SHIDIF_SIZEDLG; SHInitDialog(&shidi); //Menubar mbi.cbSize = sizeof( SHMENUBARINFO ); mbi.hwndParent = hDlg; mbi.dwFlags = SHCMBF_HMENU; mbi.nToolBarId = IDM_WIZARD_FIRST; mbi.hInstRes = HINST_RESDLL; SHCreateMenuBar( &mbi ); SHDoneButton(hDlg, SHDB_HIDE); EnableGeneralControls(hDlg, psProp); SendDlgItemMessage(hDlg, IDC_WZC_EDIT_SSID, EM_LIMITTEXT, MAX_SSID_LEN, 0); InitMetaNetworkCombo(GetDlgItem(hDlg, IDC_WZC_COMBO_CONNECT_TO), 0); UpdateDataGeneral(hDlg, &psProp->wzcnet, (INT*)&psProp->uMeta, TRUE); // check to see if this is a new network with the keydata bit set. we want to activate the keytouched bit so // the ui will process and check for the netkey when the "next" sk is pressed on the security page. if((psProp->wzcnet.szName[0] == TEXT('\0')) && (psProp->wzcnet.dwFlags & SHWZCF_NET_KEYDATA)) { // this will force a password check in case the user doesn't input anything psProp->dwFlags |= WZCDLG_PROPS_KEYTOUCHED; } return TRUE; }
pxError pxWindow::init(int left, int top, int width, int height) { HINSTANCE hInstance = ::GetModuleHandle(NULL); TCHAR* className = _T("pxWindow"); WNDCLASS wc; if (!::GetClassInfo(hInstance, className, &wc)) { wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)windowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = NULL; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = 0; wc.lpszClassName = className; RegisterClass(&wc); } #ifndef MOBILE mWindow = ::CreateWindow(className, _T(""), WS_OVERLAPPEDWINDOW, left, top, width, height, NULL, NULL, hInstance, (pxWindowNative*)this); #else mWindow = CreateWindow(className, L"Hi", WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, (pxWindowNative*)this); if (mWindow) { SHDoneButton (mWindow, SHDB_SHOW); SHFullScreen(mWindow, SHFS_HIDESIPBUTTON); } #endif return mWindow?PX_OK:PX_FAIL; }
static void InitDialog(HWND hDlg) { WCHAR filename[MAX_PATH]; if (!GetStringsFile(filename)) return; StringTable uiStrings; if (ReadStrings(filename, &uiStrings) != OK) return; WCHAR szwTitle[MAX_TEXT_LEN]; WCHAR szwInfo[MAX_TEXT_LEN]; MultiByteToWideChar(CP_UTF8, 0, uiStrings.title, strlen(uiStrings.title) + 1, szwTitle, sizeof(szwTitle)/sizeof(szwTitle[0])); MultiByteToWideChar(CP_UTF8, 0, uiStrings.info, strlen(uiStrings.info) + 1, szwInfo, sizeof(szwInfo)/sizeof(szwInfo[0])); SetWindowTextW(hDlg, szwTitle); SetWindowTextW(GetDlgItem(hDlg, IDC_INFO), szwInfo); // Set dialog icon HICON hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_DIALOG)); if (hIcon) SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon); HWND hWndPro = GetDlgItem(hDlg, IDC_PROGRESS); SendMessage(hWndPro, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); // Resize the dialog to fit all of the text if necessary. RECT infoSize, textSize; HWND hWndInfo = GetDlgItem(hDlg, IDC_INFO); // Get the control's font for calculating the new size for the control HDC hDCInfo = GetDC(hWndInfo); HFONT hInfoFont, hOldFont; hInfoFont = (HFONT)SendMessage(hWndInfo, WM_GETFONT, 0, 0); if (hInfoFont) hOldFont = (HFONT)SelectObject(hDCInfo, hInfoFont); // There are three scenarios that need to be handled differently // 1. Windows Mobile where dialog should be full screen. // 2. Windows CE where the dialog might wrap. // 3. Windows where the dialog should never wrap. The Windows CE and Windows // scenarios could be combined but then we would have to calculate the // extra border space added by the Aero theme which just adds complexity. #ifdef WINCE #ifdef WINCE_WINDOWS_MOBILE RECT rcDlgInner1, rcDlgInner2, rcInfoOuter1, rcInfoOuter2; // The dialog's client rectangle and the window rectangle for the text before // making the dialog full screen are needed to calculate the change in border // sizes. GetClientRect(hDlg, &rcDlgInner1); GetWindowRect(hWndInfo, &rcInfoOuter1); // Make the dialog fullscreen SHINITDLGINFO shidi; shidi.dwMask = SHIDIM_FLAGS; shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN; shidi.hDlg = hDlg; SHInitDialog(&shidi); if (!SHInitDialog(&shidi)) return; // Hide the OK button SHDoneButton(hDlg, SHDB_HIDE); GetClientRect(hDlg, &rcDlgInner2); GetWindowRect(hWndInfo, &rcInfoOuter2); textSize.left = 0; // Calculate the maximum possible width for the text by adding to the // existing text rectangle's window width the change in the dialog rectangle's // client width and the change in the text rectangle's window left position // after the dialog has been made full screen. textSize.right = (rcInfoOuter2.right - rcInfoOuter2.left) + \ (rcDlgInner2.right - rcDlgInner1.right) + \ (rcInfoOuter1.left - rcInfoOuter2.left); #else RECT rcWorkArea, rcInfoOuter1; GetWindowRect(hWndInfo, &rcInfoOuter1); SystemParametersInfo(SPI_GETWORKAREA, NULL, &rcWorkArea, NULL); textSize.left = 0; // Calculate the maximum possible width for the text by subtracting from the // existing working area's width the text rectangle's margin. textSize.right = (rcWorkArea.right - rcWorkArea.left) - \ (rcInfoOuter1.left + rcInfoOuter1.right); #endif // Measure the space needed for the text allowing multiple lines if necessary. // DT_CALCRECT means nothing is drawn. if (DrawText(hDCInfo, szwInfo, -1, &textSize, DT_CALCRECT | DT_NOCLIP | DT_WORDBREAK)) { GetClientRect(hWndInfo, &infoSize); SIZE extra; // Calculate the additional space needed for the text by subtracting from // the rectangle returned by DrawText the existing client rectangle's width // and height. extra.cx = (textSize.right - textSize.left) - \ (infoSize.right - infoSize.left); extra.cy = (textSize.bottom - textSize.top) - \ (infoSize.bottom - infoSize.top); // XXX rstrong - add 2 pixels to the width to prevent the text from wrapping // due to Windows CE and Windows Mobile adding an extra pixel to the // beginning and the end of the text. Though I have found no good reason for // this it has been consistent with multiple font sizes. extra.cx += 2; RESIZE_WINDOW(hWndInfo, extra.cx, extra.cy); RESIZE_WINDOW(hWndPro, extra.cx, 0); #ifdef WINCE_WINDOWS_MOBILE // Move the controls 1 pixel to the left on Windows Mobile to compensate for // the 2 extra pixels added to the controls above. This isn't needed on // Windows CE for reasons of the unknown variety. MOVE_WINDOW(hWndInfo, -1, 0); MOVE_WINDOW(hWndPro, -1, extra.cy); #else RESIZE_WINDOW(hDlg, extra.cx, extra.cy); MOVE_WINDOW(hWndPro, 0, extra.cy); #endif } #else // Measure the space needed for the text on a single line. DT_CALCRECT means // nothing is drawn. if (DrawText(hDCInfo, szwInfo, -1, &textSize, DT_CALCRECT | DT_NOCLIP | DT_SINGLELINE)) { GetClientRect(hWndInfo, &infoSize); SIZE extra; // Calculate the additional space needed for the text by subtracting from // the rectangle returned by DrawText the existing client rectangle's width // and height. extra.cx = (textSize.right - textSize.left) - \ (infoSize.right - infoSize.left); extra.cy = (textSize.bottom - textSize.top) - \ (infoSize.bottom - infoSize.top); if (extra.cx < 0) extra.cx = 0; if (extra.cy < 0) extra.cy = 0; if ((extra.cx > 0) || (extra.cy > 0)) { RESIZE_WINDOW(hDlg, extra.cx, extra.cy); RESIZE_WINDOW(hWndInfo, extra.cx, extra.cy); RESIZE_WINDOW(hWndPro, extra.cx, 0); MOVE_WINDOW(hWndPro, 0, extra.cy); } } #endif if (hOldFont) SelectObject(hDCInfo, hOldFont); ReleaseDC(hWndInfo, hDCInfo); // On Windows Mobile the dialog is full screen so don't center it. #ifndef WINCE_WINDOWS_MOBILE CenterDialog(hDlg); // make dialog appear in the center of the screen #endif SetTimer(hDlg, TIMER_ID, TIMER_INTERVAL, NULL); }
int GAPI_ShowTaskBar() { if(!bShowTaskBar) { int topBorder, bottomBorder; RECT rc; //Take screen shot CreateBitMap(); //Need close the GAPI to give key control back to the system CloseGAPI(); //ShowWindow(SDL_Window, SW_HIDE); SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON); bShowTaskBar = 1; GetTopBottomBorder(&topBorder, &bottomBorder); SDL_WM_SetCaption(GetGameTitle(), NULL); SHDoneButton(SDL_Window, SHDB_HIDE); { //http://forum.soft32.com/pda/SHCreateMenuBar-resource-file-ftopict47431.html SHMENUBARINFO cbi; memset(&cbi, 0, sizeof(SHMENUBARINFO)); menuBar = NULL; cbi.cbSize = sizeof(SHMENUBARINFO); cbi.hwndParent = SDL_Window; cbi.hInstRes = SDL_Instance; cbi.nToolBarId = IDR_MENUBAR; //cbi.dwFlags = /*SHCMBF_EMPTYBAR |*/ SHCMBF_HIDESIPBUTTON | SHCMBF_HMENU; //Don't use this with the Smartphone menu if(SHCreateMenuBar(&cbi)) { menuBar = (HMENU)cbi.hwndMB; } } //http://msdn.microsoft.com/en-us/library/aa453694.aspx SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, FALSE); MoveWindow(SDL_Window, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE); //Show the game menu, but not the incoming call menu SetWindowPos(GetForegroundWindow(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE); //Show incoming call window SetWindowPos(SDL_Window, HWND_NOTOPMOST, /*0, 0, 1, 1*/sdlWindowSize.left, sdlWindowSize.top + topBorder, sdlWindowSize.right, sdlWindowSize.bottom - (topBorder + bottomBorder), SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_SHOWWINDOW); //Allow to show the incomming call window if(menuBar) writeDebugInfo("GAPI_ShowTaskBar Menu Ok"); else { char buf[64]; sprintf(buf, "GAPI_ShowTaskBar No Menu, Error: %ld", GetLastError()); writeDebugInfo(buf); } return 1; } return 0; }