这篇教程C++ GetWindowRect函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetWindowRect函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowRect函数的具体用法?C++ GetWindowRect怎么用?C++ GetWindowRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetWindowRect函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetWindowRectbool Graphics2D::toogleFullScreen(HWND hWnd){ HMENU hMenu = NULL; // A load of params for something directX-y D3DPRESENT_PARAMETERS presParams; RECT WindowRect; long WindowStyle; GetWindowRect(hWnd, &WindowRect); if(fullscreen) { // Set the fullscreen mode style, clear menu if attached SetWindowLong(hWnd, GWL_STYLE, WS_POPUP|WS_SYSMENU|WS_VISIBLE); if(hMenu == NULL) { hMenu = GetMenu(hWnd); SetMenu(hWnd, NULL); } // Set the Presentation Parameters, specifically presParams.Windowed = FALSE; presParams.BackBufferWidth = SCREEN_WIDTH; presParams.BackBufferHeight = SCREEN_HEIGHT; // Reset D3D device, any device dependent objects if(FAILED(m_d3dDevice->Reset(&presParams))) { // Couldn't do the change, set things back SetWindowLong(hWnd, GWL_STYLE, WindowStyle); if(hMenu != NULL) { SetMenu(hWnd, hMenu); hMenu = NULL; } // Set the window position SetWindowPos(hWnd, HWND_NOTOPMOST, WindowRect.left, WindowRect.top, (WindowRect.right - WindowRect.left), (WindowRect.bottom - WindowRect.top), SWP_SHOWWINDOW); return false; } fullscreen = false; } else { // Set the windowed mode style, reset menu if needed SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW); if(hMenu != NULL) { SetMenu(hWnd, hMenu); hMenu = NULL; } // Set the Presentation Parameters, specifically presParams.Windowed = TRUE; presParams.BackBufferWidth = SCREEN_WIDTH; presParams.BackBufferHeight = SCREEN_HEIGHT; // Reset D3D device if(FAILED(m_d3dDevice->Reset(&presParams))) return false; // Set the window position SetWindowPos(hWnd, HWND_NOTOPMOST, WindowRect.left, WindowRect.top, (WindowRect.right - WindowRect.left), (WindowRect.bottom - WindowRect.top), SWP_SHOWWINDOW); fullscreen = true; } return false;}
开发者ID:SBmore,项目名称:NSGame,代码行数:78,
示例2: OnFunction/*------------------------------------------------ "Function" is selected--------------------------------------------------*/void OnFunction(HWND hDlg, BOOL bInit){ RECT rc; int command = CBGetItemData(hDlg, IDC_MOUSEFUNC, CBGetCurSel(hDlg, IDC_MOUSEFUNC)); if(!bInit || command != m_prevcommand) SetDlgItemText(hDlg, IDC_MOUSEOPT, ""); m_prevcommand = command; if(command == IDC_OPENFILE || command == IDC_MOUSECOPY || command == IDC_MONOFF || command == IDC_COMMAND#if TC_ENABLE_VOLUME || command == IDC_VOLUD || command == IDC_VOLSET#endif ) { if(command == IDC_OPENFILE) SetDlgItemText(hDlg, IDC_LABMOUSEOPT, MyString(IDS_FILE, "File")); else if(command == IDC_MOUSECOPY) SetDlgItemText(hDlg, IDC_LABMOUSEOPT, MyString(IDS_FORMATCOPY, "FormatCopy")); else if(command == IDC_MONOFF) SetDlgItemText(hDlg, IDC_LABMOUSEOPT, MyString(IDS_MONOFFSEC, "MonOffSec")); else if(command == IDC_COMMAND) SetDlgItemText(hDlg, IDC_LABMOUSEOPT, MyString(IDS_NUMERO, "Numero"));#if TC_ENABLE_VOLUME else if(command == IDC_VOLSET) SetDlgItemText(hDlg, IDC_LABMOUSEOPT, MyString(IDS_VOLVAL, "Volume")); else if(command == IDC_VOLUD) SetDlgItemText(hDlg, IDC_LABMOUSEOPT, MyString(IDS_VOLDELTA, "Delta"));#endif ShowDlgItem(hDlg, IDC_LABMOUSEOPT, TRUE); GetWindowRect(GetDlgItem(hDlg, IDC_MOUSEOPT), &rc); if(command == IDC_OPENFILE || command == IDC_MOUSECOPY) SetWindowPos(GetDlgItem(hDlg, IDC_MOUSEOPT), NULL, 0, 0, m_widthOpt, rc.bottom - rc.top, SWP_NOZORDER|SWP_NOMOVE|SWP_SHOWWINDOW); else { SetWindowPos(GetDlgItem(hDlg, IDC_MOUSEOPT), NULL, 0, 0, (rc.bottom - rc.top)*2, rc.bottom - rc.top, SWP_NOZORDER|SWP_NOMOVE|SWP_SHOWWINDOW); } if(command == IDC_OPENFILE) ShowDlgItem(hDlg, IDC_MOUSEOPTSANSHO, TRUE); else ShowDlgItem(hDlg, IDC_MOUSEOPTSANSHO, FALSE); } else { ShowDlgItem(hDlg, IDC_LABMOUSEOPT, FALSE); ShowDlgItem(hDlg, IDC_MOUSEOPT, FALSE); ShowDlgItem(hDlg, IDC_MOUSEOPTSANSHO, FALSE); }}
开发者ID:k-takata,项目名称:TClockLight,代码行数:68,
示例3: dc// Works out an appropriate size and position of this windowvoid CColourPopup::SetWindowSize(){ CSize TextSize; // If we are showing a custom or default text area, get the font and text size. if (m_strCustomText.GetLength() || m_strDefaultText.GetLength()) { CClientDC dc(this); CFont* pOldFont = (CFont*) dc.SelectObject(&m_Font); // Get the size of the custom text (if there IS custom text) TextSize = CSize(0,0); if (m_strCustomText.GetLength()) TextSize = dc.GetTextExtent(m_strCustomText); // Get the size of the default text (if there IS default text) if (m_strDefaultText.GetLength()) { CSize DefaultSize = dc.GetTextExtent(m_strDefaultText); if (DefaultSize.cx > TextSize.cx) TextSize.cx = DefaultSize.cx; if (DefaultSize.cy > TextSize.cy) TextSize.cy = DefaultSize.cy; } dc.SelectObject(pOldFont); TextSize += CSize(2*m_nMargin,2*m_nMargin); // Add even more space to draw the horizontal line TextSize.cy += 2*m_nMargin + 2; } // Get the number of columns and rows //m_nNumColumns = (int) sqrt((double)m_nNumColours); // for a square window (yuk) m_nNumColumns = 8; m_nNumRows = m_nNumColours / m_nNumColumns; if (m_nNumColours % m_nNumColumns) m_nNumRows++; // Get the current window position, and set the new size CRect rect; GetWindowRect(rect); m_WindowRect.SetRect(rect.left, rect.top, rect.left + m_nNumColumns*m_nBoxSize + 2*m_nMargin, rect.top + m_nNumRows*m_nBoxSize + 2*m_nMargin); // if custom text, then expand window if necessary, and set text width as // window width if (m_strDefaultText.GetLength()) { if (TextSize.cx > m_WindowRect.Width()) m_WindowRect.right = m_WindowRect.left + TextSize.cx; TextSize.cx = m_WindowRect.Width()-2*m_nMargin; // Work out the text area m_DefaultTextRect.SetRect(m_nMargin, m_nMargin, m_nMargin+TextSize.cx, 2*m_nMargin+TextSize.cy); m_WindowRect.bottom += m_DefaultTextRect.Height() + 2*m_nMargin; } // if custom text, then expand window if necessary, and set text width as // window width if (m_strCustomText.GetLength()) { if (TextSize.cx > m_WindowRect.Width()) m_WindowRect.right = m_WindowRect.left + TextSize.cx; TextSize.cx = m_WindowRect.Width()-2*m_nMargin; // Work out the text area m_CustomTextRect.SetRect(m_nMargin, m_WindowRect.Height(), m_nMargin+TextSize.cx, m_WindowRect.Height()+m_nMargin+TextSize.cy); m_WindowRect.bottom += m_CustomTextRect.Height() + 2*m_nMargin; } // Need to check it'll fit on screen: Too far right? CSize ScreenSize(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN)); if (m_WindowRect.right > ScreenSize.cx) m_WindowRect.OffsetRect(-(m_WindowRect.right - ScreenSize.cx), 0); // Too far left? if (m_WindowRect.left < 0) m_WindowRect.OffsetRect( -m_WindowRect.left, 0); // Bottom falling out of screen? if (m_WindowRect.bottom > ScreenSize.cy) { CRect ParentRect; m_pParent->GetWindowRect(ParentRect); m_WindowRect.OffsetRect(0, -(ParentRect.Height() + m_WindowRect.Height())); } // Set the window size and position MoveWindow(m_WindowRect, TRUE);}
开发者ID:arefinsaaad,项目名称:kupl09,代码行数:94,
示例4: DlgProcLRESULT CALLBACK DlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: { RECT rectOwner, rectDlg, rectDiff; GetWindowRect(GetDesktopWindow(), &rectOwner); GetWindowRect(hwndDlg, &rectDlg); CopyRect(&rectDiff, &rectOwner); OffsetRect(&rectDlg, -rectDlg.left, -rectDlg.top); OffsetRect(&rectDiff, -rectDiff.left, -rectDiff.top); OffsetRect(&rectDiff, -rectDlg.right, -rectDlg.bottom); SetWindowPos(hwndDlg, HWND_TOP, rectOwner.left + (rectDiff.right / 2), rectOwner.top + (rectDiff.bottom / 2), 0, 0, SWP_NOSIZE); HWND hwndProg = GetDlgItem(hwndDlg, IDC_PROGRESS); DWORD dwStyle = GetWindowLong(hwndProg, GWL_STYLE); SetWindowLong(hwndProg, GWL_STYLE, dwStyle | PBS_MARQUEE); SendMessage(hwndProg, PBM_SETMARQUEE, TRUE, 70 /* = scroll speed */); HWND hwndOK = GetDlgItem(hwndDlg, IDC_OK); if (silentFlag) { RECT rectProg, rectOK; GetWindowRect(hwndProg, &rectProg); GetWindowRect(hwndOK, &rectOK); POINT posProg; posProg.x = rectProg.left; posProg.y = rectProg.top; ScreenToClient(hwndDlg, &posProg); MoveWindow(hwndProg, posProg.x, posProg.y, rectOK.right - rectProg.left, rectProg.bottom - rectProg.top, TRUE); ShowWindow(hwndOK, SW_HIDE); } else { EnableWindow(hwndOK, FALSE); } HWND hwndDetails = GetDlgItem(hwndDlg, IDC_DETAILS); ShowWindow(hwndDetails, SW_HIDE); LPTSTR dialogText = (LPTSTR)malloc(MAX_STRING_LENGTH * sizeof(TCHAR)); UINT titleID = (uninstallFlag ? IDS_UNINSTALL : IDS_INSTALL); LoadString(GetModuleHandle(NULL), titleID, dialogText, MAX_STRING_LENGTH); SetWindowText(hwndDlg, dialogText); LoadString(GetModuleHandle(NULL), IDS_CLOSE, dialogText, MAX_STRING_LENGTH); SetDlgItemText(hwndDlg, IDC_OK, dialogText); LoadString(GetModuleHandle(NULL), IDS_DETAILS, dialogText, MAX_STRING_LENGTH); SetDlgItemText(hwndDlg, IDC_DETAILS, dialogText); LPTSTR message = (LPTSTR)malloc((2 * MAX_STRING_LENGTH + 10) * sizeof(TCHAR)); UINT loadingID = (uninstallFlag ? IDS_LOADING_U : IDS_LOADING); LoadString(GetModuleHandle(NULL), loadingID, message, MAX_STRING_LENGTH); loadingID = (estTime) ? IDS_TIMESPEC : IDS_TIMEUNDEF; LoadString(GetModuleHandle(NULL), loadingID, dialogText, MAX_STRING_LENGTH); LPTSTR time = (LPTSTR)malloc(9 * sizeof(TCHAR)); _itot(estTime, time, 10); DWORD_PTR messageArguments[] = { (DWORD_PTR)time }; HLOCAL formattedString = NULL; DWORD formatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY; FormatMessage(formatFlags, dialogText, loadingID, 0, (LPTSTR)&formattedString, 0, (va_list*)messageArguments); free(time); _tcsncat(message, _T("/n"), 2 * MAX_STRING_LENGTH + 10); _tcsncat(message, formattedString, 2 * MAX_STRING_LENGTH + 10); SetDlgItemText(hwndDlg, IDC_MESSAGE, message); LocalFree(formattedString); free(dialogText); free(message); } SetTimer(hwndDlg, IDT_TIMER1, 500, (TIMERPROC)NULL); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: case IDCANCEL: if (hChildProc == 0) { EndDialog(hwndDlg, wParam); return TRUE; } break; case IDC_DETAILS: { LPTSTR errorMsg = _tcserror(exitCode); LPTSTR messsageFormat = (LPTSTR)malloc(MAX_STRING_LENGTH); LoadString(NULL, IDS_ERRORCODE, messsageFormat, MAX_STRING_LENGTH); HLOCAL messageString = NULL; DWORD_PTR messageArguments[] = { (DWORD_PTR)exitCode, (DWORD_PTR)errorMsg }; DWORD formatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY; FormatMessage(formatFlags, messsageFormat, IDS_ERRORCODE, 0, (LPTSTR)&messageString, 0, (va_list*)messageArguments);//.........这里部分代码省略.........
开发者ID:Shondoit,项目名称:loader,代码行数:101,
示例5: populate_insert_dlgint populate_insert_dlg(HWND hwnd,HWND hlistview,TABLE_WINDOW *win){ int i,count,widths[4]={0,0,0,0}; int row_sel; char *cols[]={"field","data","type","size"}; if(hlistview==0 || win==0) return FALSE; for(i=0;i<4;i++) widths[i]=lv_add_column(hlistview,cols[i],i); row_sel=ListView_GetSelectionMark(win->hlistview); count=lv_get_column_count(win->hlistview); for(i=0;i<count;i++){ int w; char str[80]={0}; lv_get_col_text(win->hlistview,i,str,sizeof(str)); lv_insert_data(hlistview,i,FIELD_POS,str); w=get_str_width(hlistview,str); if(w>widths[FIELD_POS]) widths[FIELD_POS]=w; if(row_sel>=0){ str[0]=0; ListView_GetItemText(win->hlistview,row_sel,i,str,sizeof(str)); lv_insert_data(hlistview,i,DATA_POS,str); w=get_str_width(hlistview,str); if(w>widths[DATA_POS]) widths[DATA_POS]=w; } if(win->col_attr!=0){ char *s=""; if(!find_sql_type_str(win->col_attr[i].type,&s)){ _snprintf(str,sizeof(str),"%i",win->col_attr[i].type); lv_insert_data(hlistview,i,TYPE_POS,str); } else lv_insert_data(hlistview,i,TYPE_POS,s); w=get_str_width(hlistview,s); if(w>widths[TYPE_POS]) widths[TYPE_POS]=w; _snprintf(str,sizeof(str),"%i",win->col_attr[i].length); lv_insert_data(hlistview,i,SIZE_POS,str); w=get_str_width(hlistview,str); if(w>widths[SIZE_POS]) widths[SIZE_POS]=w; } } { int total_width=0; for(i=0;i<4;i++){ widths[i]+=12; ListView_SetColumnWidth(hlistview,i,widths[i]); total_width+=widths[i]; } if(total_width>0){ int width,height; RECT rect={0},irect={0},nrect={0}; GetWindowRect(hwnd,&irect); get_nearest_monitor(irect.left,irect.top,total_width,100,&nrect); ListView_GetItemRect(hlistview,0,&rect,LVIR_BOUNDS); height=80+(count*(rect.bottom-rect.top+2)); if((irect.top+height)>nrect.bottom){ height=nrect.bottom-nrect.top-irect.top; if(height<320) height=320; } width=total_width+20; SetWindowPos(hwnd,NULL,0,0,width,height,SWP_NOMOVE|SWP_NOZORDER); } } return TRUE;}
开发者ID:pinchyCZN,项目名称:DB_UTIL,代码行数:76,
示例6: CC_BREAK_IFbool CCEGLView::Create(){ bool bRet = false; do { CC_BREAK_IF(m_hWnd); HINSTANCE hInstance = GetModuleHandle( NULL ); WNDCLASS wc; // Windows Class Structure // Redraw On Size, And Own DC For Window. wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = _WindowProc; // WndProc Handles Messages wc.cbClsExtra = 0; // No Extra Window Data wc.cbWndExtra = 0; // No Extra Window Data wc.hInstance = hInstance; // Set The Instance wc.hIcon = LoadIcon( NULL, IDI_WINLOGO ); // Load The Default Icon wc.hCursor = LoadCursor( NULL, IDC_ARROW ); // Load The Arrow Pointer wc.hbrBackground = NULL; // No Background Required For GL wc.lpszMenuName = m_menu; // wc.lpszClassName = kWindowClassName; // Set The Class Name CC_BREAK_IF(! RegisterClass(&wc) && 1410 != GetLastError()); // center window position RECT rcDesktop; GetWindowRect(GetDesktopWindow(), &rcDesktop); WCHAR wszBuf[50] = {0}; MultiByteToWideChar(CP_UTF8, 0, m_szViewName, -1, wszBuf, sizeof(wszBuf)); // create window m_hWnd = CreateWindowEx( WS_EX_APPWINDOW | WS_EX_WINDOWEDGE, // Extended Style For The Window kWindowClassName, // Class Name wszBuf, // Window Title WS_CAPTION | WS_POPUPWINDOW | WS_MINIMIZEBOX, // Defined Window Style 0, 0, // Window Position //TODO: Initializing width with a large value to avoid getting a wrong client area by 'GetClientRect' function. 1000, // Window Width 1000, // Window Height NULL, // No Parent Window NULL, // No Menu hInstance, // Instance NULL ); CC_BREAK_IF(! m_hWnd); bRet = initGL(); if(!bRet) destroyGL(); CC_BREAK_IF(!bRet); s_pMainWindow = this; bRet = true; } while (0);#if(_MSC_VER >= 1600) m_bSupportTouch = CheckTouchSupport(); if(m_bSupportTouch) { m_bSupportTouch = (s_pfRegisterTouchWindowFunction(m_hWnd, 0) != 0); }#endif /* #if(_MSC_VER >= 1600) */ return bRet;}
开发者ID:524777134,项目名称:cocos2d-x,代码行数:66,
示例7: SpltNs_WndProcLRESULT CALLBACK SpltNs_WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){static int oldy;static int x;static int line_width;static int min_top;static int max_bottom;POINT pt;HDC hdc;RECT rect;HWND hp = GetParent(hwnd); switch (message) { case WM_CREATE: return 0 ;case WM_LBUTTONDOWN: SetCapture(hwnd); ns_sizing = 1; line_width = win_width(hwnd); x = win_left(hwnd);;pt.x = (short)LOWORD(lParam); // horizontal position of cursor pt.y = (short)HIWORD(lParam);GetWindowRect(hp,&rect);min_top= win_top(hp)+ MIN_SPLT_SPACE;max_bottom = win_bottom(hp) - MIN_SPLT_SPACE;//GetClientRect(hwnd,&splt_rect);//SCreenToClient(rect);//GetWindowRect(hwnd_frame, &rect_frame_scr);//client_0_0.x = 0;//client_0_0.y=0;//ClientToScreen(hwnd_frame,&client_0_0);//client_0_0.y-= rect_frame_scr.top;//client_0_0.x-= rect_frame_scr.left;ClientToScreen(hwnd,&pt);//convert the mouse coordinates relative to the top-left of//the window//ScreenToClient(hwnd_frame,&pt);if(pt.y < min_top) pt.y = min_top;if(pt.y > max_bottom) { pt.y = max_bottom;}hdc = GetDC(NULL);DrawXorBar(hdc, x, pt.y-SPLT_WIDTH/2, line_width, SPLT_WIDTH);ReleaseDC(NULL, hdc);oldy = pt.y;break;case WM_LBUTTONUP: ReleaseCapture();pt.x = (short)LOWORD(lParam); // horizontal position of cursor pt.y = (short)HIWORD(lParam);GetClientRect(hp,&rect);//GetClientRect(hwnd,&splt_rect);//GetWindowRect(hwnd_frame, &rect_frame_scr);//client_0_0.x = 0;//client_0_0.y=0;//ClientToScreen(hwnd_frame,&client_0_0);//client_0_0.y-= rect_frame_scr.top;//client_0_0.x-= rect_frame_scr.left;hdc = GetDC(NULL);DrawXorBar(hdc, x, oldy-SPLT_WIDTH/2, line_width, SPLT_WIDTH);ReleaseDC(NULL, hdc);ns_sizing = 0;pt.y = oldy;ScreenToClient(hp,&pt);send_splitter_y(hp, pt.y);break;case WM_MOUSEMOVE:if(0==ns_sizing) break;pt.x = (short)LOWORD(lParam); // horizontal position of cursor pt.y = (short)HIWORD(lParam);//GetClientRect(hwnd_frame,&rect);//GetClientRect(hwnd,&splt_rect);//SCreenToClient(rect);ClientToScreen(hwnd,&pt);//.........这里部分代码省略.........
开发者ID:sunmingbao,项目名称:xb-ether-tester,代码行数:101,
示例8: WindowY int WindowY(HWND hWnd){ static RECT rc; GetWindowRect(hWnd, &rc); return (rc.top); }
开发者ID:csersoft,项目名称:hard86,代码行数:5,
示例9: WindowProcLRESULT CALLBACK WindowProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam){ GetWindowRect(hWnd, &Okno.win1rect); Okno.iPosX = Okno.win1rect.left; Okno.iPosY = Okno.win1rect.top; Okno.iWidth = Okno.win1rect.right - Okno.win1rect.left; Okno.iHeight = Okno.win1rect.bottom - Okno.win1rect.top; TCHAR tmp[200] = { 0 }; switch (uMessage){ case WM_KEYDOWN: switch (wParam) { case VK_LEFT: Okno.iPosX -= 10; MoveWindow(hWnd, Okno.iPosX, Okno.iPosY, Okno.iWidth, Okno.iHeight, 1); break; case VK_RIGHT: Okno.iPosX += 10; MoveWindow(hWnd, Okno.iPosX, Okno.iPosY, Okno.iWidth, Okno.iHeight, 1); break; case VK_UP: Okno.iPosY -= 10; MoveWindow(hWnd, Okno.iPosX, Okno.iPosY, Okno.iWidth, Okno.iHeight, 1); break; case VK_DOWN: Okno.iPosY += 10; MoveWindow(hWnd, Okno.iPosX, Okno.iPosY, Okno.iWidth, Okno.iHeight, 1); break; case VK_TAB: Okno.iPosX = 0; Okno.iPosY = 0; MoveWindow(hWnd, Okno.iPosX, Okno.iPosY, Okno.iWidth, Okno.iHeight, 1); break; case VK_ESCAPE: HWND hPanel = FindWindow(TEXT("Shell_TrayWnd"), NULL); if (hPanel){ SetWindowText(hWnd, TEXT("Дескриптор панели получен")); } else{ SetWindowText(hWnd, TEXT("Дескриптор панели НЕ получен")); } //HWND hWndStart = GetWindow(hPanel, GW_CHILD); //HWND hWndStart = FindWindowEx(hPanel, 0, TEXT("Button"), NULL); HWND hWndStart = FindWindow(TEXT("Button"), NULL); if (hWndStart){ SetWindowText(hWnd, TEXT("Дескриптор ПУСКА получен")); } else{ SetWindowText(hWnd, TEXT("Дескриптор ПУСКА НЕ получен")); } /*GetWindowRect(hWndStart, &Okno.win1rect); Okno.iPosX = 500; Okno.iPosY = 500; Okno.iWidth = Okno.win1rect.right - Okno.win1rect.left; Okno.iHeight = Okno.win1rect.bottom - Okno.win1rect.top;*/ MoveWindow(hWndStart, 0, 0, 1, 1, 0); break; } break; case WM_LBUTTONDOWN: lmb++; break; case WM_RBUTTONDOWN: rmb++; /*HWND hWndCalc; hWndCalc = FindWindow(TEXT("CalcFrame"), TEXT("Калькулятор")); if (hWndCalc){ SetWindowText(hWndCalc, TEXT("БУЛЬБУЛЯТОР")); } else{ MessageBox(hWnd, TEXT("Ошибка"), TEXT("Запустите калькулятор!"), MB_OK | MB_ICONINFORMATION); }*/ break; case WM_MBUTTONDOWN: cmb++; break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, uMessage, wParam, lParam); } wsprintf(tmp, TEXT("Клики: левой %i, средней %i, правой %i"), lmb, cmb, rmb); SetWindowText(hWnd, tmp); return 0;}
开发者ID:DNeveroff,项目名称:WIN-API-,代码行数:89,
示例10: WindowHeight int WindowHeight(HWND hWnd){ static RECT rc; GetWindowRect(hWnd, &rc); return RectHeight(rc); }
开发者ID:csersoft,项目名称:hard86,代码行数:5,
示例11: WindowX int WindowX(HWND hWnd){ static RECT rc; GetWindowRect(hWnd, &rc); return (rc.left); }
开发者ID:csersoft,项目名称:hard86,代码行数:5,
示例12: WindowWidth int WindowWidth(HWND hWnd){ static RECT rc; GetWindowRect(hWnd, &rc); return RectWidth(rc); }
开发者ID:csersoft,项目名称:hard86,代码行数:5,
示例13: updateSize void updateSize() { if(IsIconic(GetParent(windowHandle))) return; RECT parentSize = { 0 }; GetClientRect(GetParent(windowHandle), &parentSize); RECT windowSize = { 0 }; GetWindowRect(windowHandle, &windowSize); int originalWidth = windowSize.right - windowSize.left; int originalHeight = windowSize.bottom - windowSize.top; int width = originalWidth; int height = originalHeight; if((resizeType == Dialog::ATTACH_RIGHT) || (resizeType == Dialog::ATTACH_ALL)) width = -(xPosition - parentSize.right); if((resizeType == Dialog::ATTACH_BOTTOM) ||(resizeType == Dialog::ATTACH_ALL)) height = -(yPosition - parentSize.bottom); if((width != originalWidth) || (height != originalHeight)) setSize(width, height); // scroll back up ScrollWindow(windowHandle, 0, GetScrollPos(windowHandle, SB_VERT), NULL, NULL); SetScrollPos(windowHandle, SB_VERT, 0, FALSE); // calculate new scrolling range RECT childRect; childRect.bottom = -INT_MAX; childRect.top = INT_MAX; EnumChildWindows(windowHandle, getChildRectProc, (LPARAM) &childRect); if(childRect.bottom > childRect.top) { RECT windowRect; GetWindowRect(windowHandle, &windowRect); RECT parentRect; GetWindowRect(GetParent(windowHandle), &parentRect); int visible_bottom = windowRect.bottom; if(parentRect.bottom < visible_bottom) visible_bottom = parentRect.bottom; int range = childRect.bottom - visible_bottom; if(range < 0) range = 0; else range += 32; // need to scroll a little further for some unknown reason SetScrollRange(windowHandle, SB_VERT, 0, range, FALSE); } else { SetScrollRange(windowHandle, SB_VERT, 0, 0, FALSE); } SCROLLINFO si; si.cbSize = sizeof (si); si.fMask = SIF_ALL; GetScrollInfo(windowHandle, SB_VERT, &si); si.nPage = 16; SetScrollInfo(windowHandle, SB_VERT, &si, TRUE); }
开发者ID:DeejStar,项目名称:Jack-Claw,代码行数:63,
示例14: ParentWndProcstatic LRESULT CALLBACK ParentWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ if (uMsgCreate && message == uMsgCreate) { static HWND hwndPrevFocus; static BOOL fCancelDisabled; if (wParam) { childwnd = FindWindowEx((HWND) lParam, NULL, _T("#32770"), NULL); hwndL = GetDlgItem(childwnd, 1016); hwndB = GetDlgItem(childwnd, 1027); HWND hwndP = GetDlgItem(childwnd, 1004); HWND hwndS = GetDlgItem(childwnd, 1006); if (childwnd && hwndP && hwndS) { // Where to restore focus to before we disable the cancel button hwndPrevFocus = GetFocus(); if (!hwndPrevFocus) hwndPrevFocus = hwndP; if (IsWindowVisible(hwndL)) ShowWindow(hwndL, SW_HIDE); else hwndL = NULL; if (IsWindowVisible(hwndB)) ShowWindow(hwndB, SW_HIDE); else hwndB = NULL; RECT wndRect, ctlRect; GetClientRect(childwnd, &wndRect); GetWindowRect(hwndS, &ctlRect); HWND s = g_hwndStatic = CreateWindow( _T("STATIC"), _T(""), WS_CHILD | WS_CLIPSIBLINGS | SS_CENTER, 0, wndRect.bottom / 2 - (ctlRect.bottom - ctlRect.top) / 2, wndRect.right, ctlRect.bottom - ctlRect.top, childwnd, NULL, hModule, NULL ); DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS; dwStyle |= GetWindowLongPtr(hwndP, GWL_STYLE) & PBS_SMOOTH; GetWindowRect(hwndP, &ctlRect); HWND pb = g_hwndProgressBar = CreateWindow( _T("msctls_progress32"), _T(""), dwStyle, 0, wndRect.bottom / 2 + (ctlRect.bottom - ctlRect.top) / 2, wndRect.right, ctlRect.bottom - ctlRect.top, childwnd, NULL, hModule, NULL ); LRESULT c = SendMessage(hwndP, PBM_SETBARCOLOR, 0, 0); SendMessage(hwndP, PBM_SETBARCOLOR, 0, c); SendMessage(pb, PBM_SETBARCOLOR, 0, c); c = SendMessage(hwndP, PBM_SETBKCOLOR, 0, 0); SendMessage(hwndP, PBM_SETBKCOLOR, 0, c); SendMessage(pb, PBM_SETBKCOLOR, 0, c); // set font LRESULT hFont = SendMessage((HWND) lParam, WM_GETFONT, 0, 0); SendMessage(pb, WM_SETFONT, hFont, 0); SendMessage(s, WM_SETFONT, hFont, 0); ShowWindow(pb, SW_SHOWNA); ShowWindow(s, SW_SHOWNA); fCancelDisabled = EnableWindow(GetDlgItem(hwnd, IDCANCEL), TRUE); SendMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hwnd, IDCANCEL), TRUE); } else childwnd = NULL; } else if (childwnd) { if (hwndB) { ShowWindow(hwndB, SW_SHOWNA); hwndB = NULL; } if (hwndL) {//.........这里部分代码省略.........
开发者ID:abcsds,项目名称:pinguino-installers,代码行数:101,
示例15: SetIconBOOL CBookTicketsDlg::OnInitDialog(){ CDialogEx::OnInitDialog(); // 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动 // 执行此操作 SetIcon(m_hIcon, TRUE); // 设置大图标 SetIcon(m_hIcon, FALSE); // 设置小图标 // TODO: 在此添加额外的初始化代码 CRect tabRect; //标签控件客户区的位置和大小 m_tab.InsertItem(0, L"预售机票"); m_tab.InsertItem(1, L"个人信息"); if (info.user == 'e') m_tab.InsertItem(2, L"票务管理"); //m_tab.InsertItem(3, L"航班管理"); //m_tab.InsertItem(4, L"人员管理"); m_book.Create(IDD_BOOK, &m_tab); m_info.Create(IDD_INFO, &m_tab); if (info.user == 'e') m_manage.Create(IDD_MAN, &m_tab); //开始更改客户区大小 int cx, cy; cx = GetSystemMetrics(SM_CXSCREEN) * 4 / 5; cy = GetSystemMetrics(SM_CYSCREEN) * 4 / 5; //设置客户区大小并忽略hWmndInsertAfter,x,y ::SetWindowPos(this->m_hWnd, HWND_TOP, 0, 0, cx, cy, SWP_NOZORDER | SWP_NOMOVE); GetClientRect(&m_rect); //获得当前整个工作区大小 m_tab.MoveWindow(0, 0, cx, cy); //改变tab控件的大小 m_tab.GetClientRect(&tabRect); // 获取标签控件客户区Rect // 调整tabRect,使其覆盖范围适合放置标签页 tabRect.left += 1; tabRect.right -= 2; tabRect.top += 50; tabRect.bottom -= 1; m_book.SetWindowPos(NULL, tabRect.left, tabRect.top, tabRect.Width(), tabRect.Height(), SWP_SHOWWINDOW); m_info.SetWindowPos(NULL, tabRect.left, tabRect.top, tabRect.Width(), tabRect.Height(), SWP_HIDEWINDOW); if (info.user == 'e') m_manage.SetWindowPos(NULL, tabRect.left, tabRect.top, tabRect.Width(), tabRect.Height(), SWP_HIDEWINDOW); //设置m_book为默认选项卡 m_tab.SetCurSel(0); CRect rect; GetWindowRect(&rect); listRect.AddTail(rect); //对话框的区域 CWnd* pWnd = GetWindow(GW_CHILD); //获取子窗体 while (pWnd) { pWnd->GetWindowRect(rect); //子窗体的区域 listRect.AddTail(rect); //CList<CRect,CRect> m_listRect成员变量 pWnd = pWnd->GetNextWindow(); //取下一个子窗体 } return TRUE; // 除非将焦点设置到控件,否则返回 TRUE}
开发者ID:Alrash,项目名称:BookTickets,代码行数:68,
示例16: PaintWorkerstatic void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint){ if (hdcPaint) { HDC hdcMem; HBITMAP hbmMem; HBITMAP hbmOld = 0; RECT rcClient; HFONT hOldFont = 0; int xOffset = 0; GetClientRect(ctl->hwnd, &rcClient); hdcMem = CreateCompatibleDC(hdcPaint); hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top); hbmOld = SelectObject(hdcMem, hbmMem); hOldFont = SelectObject(hdcMem, ctl->hFont); // If its a push button, check to see if it should stay pressed if (ctl->pushBtn && ctl->pbState) ctl->stateId = PBS_PRESSED; // Draw the flat button if (ctl->flatBtn) { if (ctl->hThemeToolbar && ctl->bThemed) { RECT rc = rcClient; int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED; SkinDrawBg(ctl->hwnd, hdcMem); if (MyIsThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) { MyDrawThemeParentBackground(ctl->hwnd, hdcMem, &rc); } MyDrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rc, &rc); } else { HBRUSH hbr; RECT rc = rcClient; if(ctl->buttonItem) { RECT rcParent; POINT pt; HWND hwndParent = pcli->hwndContactList; ImageItem *imgItem = ctl->stateId == PBS_HOT ? ctl->buttonItem->imgHover : (ctl->stateId == PBS_PRESSED ? ctl->buttonItem->imgPressed : ctl->buttonItem->imgNormal); LONG *glyphMetrics = ctl->stateId == PBS_HOT ? ctl->buttonItem->hoverGlyphMetrics : (ctl->stateId == PBS_PRESSED ? ctl->buttonItem->pressedGlyphMetrics : ctl->buttonItem->normalGlyphMetrics); //if(ctl->stateId == PBS_HOT && glyphMetrics[2] <= 1 && glyphMetrics[3] <= 1) // glyphMetrics = ctl->lastGlyphMetrics; GetWindowRect(ctl->hwnd, &rcParent); pt.x = rcParent.left; pt.y = rcParent.top; ScreenToClient(pcli->hwndContactList, &pt); BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, g_CluiData.hdcBg, pt.x, pt.y, SRCCOPY); if(imgItem) DrawAlpha(hdcMem, &rc, 0, 0, 0, 0, 0, 0, 0, imgItem); if(g_glyphItem) { AlphaBlend(hdcMem, (rc.right - glyphMetrics[2]) / 2, (rc.bottom - glyphMetrics[3]) / 2, glyphMetrics[2], glyphMetrics[3], g_glyphItem->hdc, glyphMetrics[0], glyphMetrics[1], glyphMetrics[2], glyphMetrics[3], g_glyphItem->bf); //CopyMemory(ctl->lastGlyphMetrics, glyphMetrics, 4 * sizeof(LONG)); } } else if(ctl->bSkinned) { // skinned RECT rcParent; POINT pt; HWND hwndParent = pcli->hwndContactList; StatusItems_t *item; int item_id; GetWindowRect(ctl->hwnd, &rcParent); pt.x = rcParent.left; pt.y = rcParent.top; ScreenToClient(pcli->hwndContactList, &pt); if(HIWORD(ctl->bSkinned)) item_id = ctl->stateId == PBS_HOT ? ID_EXTBKTBBUTTONMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED); //GetItemByStatus(ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED), &item); else item_id = ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED); item = &StatusItems[item_id - ID_STATUS_OFFLINE]; //GetItemByStatus(ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED, &item); SetTextColor(hdcMem, item->TEXTCOLOR); if(item->IGNORED) { if(pt.y < 10 || g_CluiData.bWallpaperMode) //SkinDrawBg(ctl->hwnd, hdcMem); BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, g_CluiData.hdcBg, pt.x, pt.y, SRCCOPY); else FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE)); } else { if(pt.y < 10 || g_CluiData.bWallpaperMode) //SkinDrawBg(ctl->hwnd, hdcMem); BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, g_CluiData.hdcBg, pt.x, pt.y, SRCCOPY); else FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE)); rc.top += item->MARGIN_TOP; rc.bottom -= item->MARGIN_BOTTOM; rc.left += item->MARGIN_LEFT; rc.right -= item->MARGIN_RIGHT; DrawAlpha(hdcMem, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem); }//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:mimplugins-svn,代码行数:101,
示例17: BaseBar_WindowProc//.........这里部分代码省略......... lpmmi->ptMinTrackSize.y = 24; } } } return (FALSE); case WM_NCCREATE: { lpbi = Mem_Alloc(sizeof(BASEBARINFO)); if (lpbi == NULL) return (FALSE); SetProp(hwnd, (LPCTSTR)MAKEWORD(s_hBaseBarAtom, 0), lpbi); } return (TRUE); case WM_NCDESTROY: { RemoveProp(hwnd, (LPCTSTR)MAKEWORD(s_hBaseBarAtom, 0)); if (lpbi != NULL) { if (lpbi->pszTitle != NULL) Mem_Free(lpbi->pszTitle); Mem_Free(lpbi); } } return (TRUE); case WM_NCHITTEST: { POINT pt = {LOWORD(lParam), HIWORD(lParam)}; RECT re; GetWindowRect(hwnd, &re); if (!PtInRect(&re, pt)) return (HTNOWHERE); if (lpbi->dwAlign == CCS_LEFT) { re.left = re.right - 4; if (PtInRect(&re, pt)) return (HTRIGHT); } else if (lpbi->dwAlign == CCS_RIGHT) { re.right = re.left + 4; if (PtInRect(&re, pt)) return (HTLEFT); } else if (lpbi->dwAlign == CCS_BOTTOM) { re.bottom = re.top + 4; if (PtInRect(&re, pt)) return (HTTOP); } else if (lpbi->dwAlign == CCS_TOP) { re.top = re.bottom - 4; if (PtInRect(&re, pt)) return (HTBOTTOM); }
开发者ID:now,项目名称:slackedit,代码行数:67,
示例18: TSButtonWndProc//.........这里部分代码省略......... case WM_SETFOCUS: // set keybord focus and redraw bct->focus = 1; InvalidateRect(bct->hwnd, NULL, TRUE); break; case WM_KILLFOCUS: // kill focus and redraw bct->focus = 0; InvalidateRect(bct->hwnd, NULL, TRUE); break; case WM_WINDOWPOSCHANGED: InvalidateRect(bct->hwnd, NULL, TRUE); break; case WM_ENABLE: // windows tells us to enable/disable { bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED; InvalidateRect(bct->hwnd, NULL, TRUE); break; } case WM_MOUSELEAVE: // faked by the WM_TIMER { if (bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_NORMAL; InvalidateRect(bct->hwnd, NULL, TRUE); } break; } case WM_LBUTTONDOWN: { if (bct->stateId != PBS_DISABLED && bct->stateId != PBS_PRESSED) { bct->stateId = PBS_PRESSED; InvalidateRect(bct->hwnd, NULL, TRUE); if(bct->bSendOnDown) { SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); bct->stateId = PBS_NORMAL; InvalidateRect(bct->hwnd, NULL, TRUE); } } break; } case WM_LBUTTONUP: { if (bct->pushBtn) { if (bct->pbState) bct->pbState = 0; else bct->pbState = 1; } if (bct->stateId != PBS_DISABLED) { // don't change states if disabled if (msg == WM_LBUTTONUP) bct->stateId = PBS_HOT; else bct->stateId = PBS_NORMAL; InvalidateRect(bct->hwnd, NULL, TRUE); } if(!bct->bSendOnDown) SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); break; } case WM_MOUSEMOVE: if (bct->stateId == PBS_NORMAL) { bct->stateId = PBS_HOT; InvalidateRect(bct->hwnd, NULL, TRUE); } // Call timer, used to start cheesy TrackMouseEvent faker SetTimer(hwndDlg, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); break; case WM_NCHITTEST: { LRESULT lr = SendMessage(GetParent(hwndDlg), WM_NCHITTEST, wParam, lParam); if(lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) return HTTRANSPARENT; break; } case WM_TIMER: // use a timer to check if they have did a mouseout { if (wParam == BUTTON_POLLID) { RECT rc; POINT pt; GetWindowRect(hwndDlg, &rc); GetCursorPos(&pt); if (!PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L); KillTimer(hwndDlg, BUTTON_POLLID); } } break; } case WM_ERASEBKGND: return 1; } return DefWindowProc(hwndDlg, msg, wParam, lParam);}
开发者ID:BackupTheBerlios,项目名称:mimplugins-svn,代码行数:101,
示例19: WndProcLRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ PAERO_SUBCLASS_WND_DATA pWndData = (PAERO_SUBCLASS_WND_DATA)GetProp(hWnd, WINDOW_DATA_STRING); ASSERT(pWndData); ASSERT(pWndData->m_pDwmApiImpl); WNDPROC pOldProc = pWndData->m_oldWndProc; ASSERT(pOldProc); BOOL bCompositionEnabled = pWndData->m_pDwmApiImpl->IsDwmCompositionEnabled(); /// /// if aero glass is turned off and if we are not in destruction code, /// just call the original wnd proc we had prior to subclassing: /// if(WM_COMMAND!=uMsg && WM_DWMCOMPOSITIONCHANGED!=uMsg && WM_DESTROY!=uMsg && WM_NCDESTROY!=uMsg && !bCompositionEnabled) return CallWindowProc(pOldProc, hWnd, uMsg, wParam, lParam); if (uMsg == pWndData->m_uiRedrawMsg) { HWND hControl = (HWND)lParam; ASSERT(hControl); ASSERT(::IsWindow(hControl)); PAERO_SUBCLASS_WND_DATA pCtrlData = (PAERO_SUBCLASS_WND_DATA)GetProp(hControl, WINDOW_DATA_STRING); if(pCtrlData && pCtrlData->m_dwFlags & WD_IN_PAINT_CONTROL) { HDC hdc = GetDC(hControl); if(hdc) { RECT rc; VERIFY(GetWindowRect(hControl, &rc)); VERIFY(MapWindowPoints(NULL, hControl, (LPPOINT) &rc, 2)); PaintControl(hControl, hdc, &rc, (pCtrlData->m_dwFlags & WD_DRAW_BORDER)!=0); VERIFY(1==ReleaseDC(hControl, hdc)); } pCtrlData->m_dwFlags &= ~WD_IN_PAINT_CONTROL; return 0; } } switch(uMsg) { case WM_CTLCOLORSTATIC: { HWND hControl = (HWND)lParam; ASSERT(hControl); ASSERT(IsWindow(hControl)); PAERO_SUBCLASS_WND_DATA pCtrlData = (PAERO_SUBCLASS_WND_DATA)GetProp(hControl, WINDOW_DATA_STRING); if(pCtrlData) { if(pCtrlData->m_dwFlags&WD_RETURN_BLACK_BRUSH) return (LRESULT)GetStockObject(BLACK_BRUSH); else if(pCtrlData->m_dwFlags&WD_RETURN_WHITE_BRUSH) return (LRESULT)GetStockObject(WHITE_BRUSH); else { pCtrlData->m_dwFlags|=WD_IN_PAINT_CONTROL; PostMessage((HWND)lParam, pWndData->m_uiRedrawMsg, 0, NULL); } } } break; case WM_CTLCOLOREDIT: { PAERO_SUBCLASS_WND_DATA pCtrlData = (PAERO_SUBCLASS_WND_DATA)GetProp((HWND)lParam, WINDOW_DATA_STRING); if(pCtrlData) pCtrlData->m_dwFlags|=WD_IN_PAINT_CONTROL; PostMessage((HWND)lParam, pWndData->m_uiRedrawMsg, 0, NULL); } break; case WM_PAINT: { if(!IsIconic(hWnd) && !(pWndData->m_dwFlags&WD_NO_FRAME_EXTEND)) { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); /// /// we have to paint the *entire* client area in black, not only the /// paint area inside ps, because otherwise we get ugly areas of white /// if we partially move the window out of the desktop and back in again: /// /// MARGINS marGlassInset = {-1, -1, -1, -1}; // -1 means the whole window if(hdc && pWndData->m_pDwmApiImpl->IsDwmCompositionEnabled() && SUCCEEDED(pWndData->m_pDwmApiImpl->DwmExtendFrameIntoClientArea(hWnd, &marGlassInset))) { RECT rcClient; VERIFY(GetClientRect(hWnd, &rcClient)); VERIFY(PatBlt(hdc, 0, 0, RECTWIDTH(rcClient), RECTHEIGHT(rcClient), BLACKNESS)); } EndPaint(hWnd, &ps);//.........这里部分代码省略.........
开发者ID:runsisi,项目名称:Grub4Win,代码行数:101,
示例20: init_datasette_dialogstatic void init_datasette_dialog(HWND hwnd){ HWND snd_hwnd; int res_value; int res_value_loop; int active_value; int xpos_max; int group_max; RECT rect; /* translate all dialog items */ uilib_localize_dialog(hwnd, datasette_dialog); /* adjust the size of the elements in the datasette_sub_group */ uilib_adjust_group_width(hwnd, datasette_sub_group); /* adjust the size of the 'reset with cpu' element */ uilib_adjust_element_width(hwnd, IDC_DATASETTE_RESET_WITH_CPU); /* adjust the size of the motor group element */ uilib_adjust_element_width(hwnd, IDC_DATASETTE_MOTOR_GROUP); /* get the max x of the datasette_sub_group */ uilib_get_group_max_x(hwnd, datasette_sub_group, &xpos_max); /* get the max x of the motor group element */ uilib_get_element_max_x(hwnd, IDC_DATASETTE_MOTOR_GROUP, &group_max); /* calculate the max x of the motor group element and the datasette_sub_group elements */ if (group_max < xpos_max + 10) { group_max = xpos_max + 10; } /* set the width of the motor group element to 'surround' the datasette_sub_group elements */ uilib_set_element_width(hwnd, IDC_DATASETTE_MOTOR_GROUP, group_max); /* get the max x of the datasette_main_group elements */ uilib_get_group_max_x(hwnd, datasette_main_group, &xpos_max); /* set the width of the dialog to 'surround' all the elements */ GetWindowRect(hwnd, &rect); MoveWindow(hwnd, rect.left, rect.top, xpos_max + 10, rect.bottom - rect.top, TRUE); /* recenter the buttons in the newly resized dialog window */ uilib_center_buttons(hwnd, move_buttons_group, 0); resources_get_int("DatasetteResetWithCPU", &res_value); CheckDlgButton(hwnd, IDC_DATASETTE_RESET_WITH_CPU, res_value ? BST_CHECKED : BST_UNCHECKED); snd_hwnd = GetDlgItem(hwnd, IDC_DATASETTE_ZERO_GAP_DELAY); for (res_value_loop = 0; res_value_loop < 7; res_value_loop++) { TCHAR st[10]; _stprintf(st, TEXT("%d"), ui_datasette_zero_gap_delay[res_value_loop]); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } resources_get_int("DatasetteZeroGapDelay", &res_value); active_value = 4; /* default */ for (res_value_loop = 0; res_value_loop < 7; res_value_loop++) { if (ui_datasette_zero_gap_delay[res_value_loop] == res_value) { active_value = res_value_loop; } } SendMessage(snd_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0); snd_hwnd = GetDlgItem(hwnd, IDC_DATASETTE_SPEED_TUNING); for (res_value_loop = 0; res_value_loop < 8; res_value_loop++) { TCHAR st[10]; _stprintf(st, TEXT("%d"), res_value_loop); SendMessage(snd_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } resources_get_int("DatasetteSpeedTuning", &res_value); SendMessage(snd_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0);}
开发者ID:emanuel4you,项目名称:meta-emanuel,代码行数:76,
示例21: SpltWe_WndProcLRESULT CALLBACK SpltWe_WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ static int oldx; static int y; static int line_height; static int min_left; static int max_right; POINT pt; HDC hdc; RECT rect; HWND hp = GetParent(hwnd); switch (message) { case WM_CREATE: return 0 ; case WM_LBUTTONDOWN: SetCapture(hwnd); we_sizing = 1; line_height = win_height(hwnd); y = win_top(hwnd);; pt.x = (short)LOWORD(lParam); // horizontal position of cursor pt.y = (short)HIWORD(lParam); GetWindowRect(hp,&rect); min_left = rect.left + MIN_SPLT_SPACE; max_right = rect.right - MIN_SPLT_SPACE; //GetClientRect(hwnd,&splt_rect); //SCreenToClient(rect); //GetWindowRect(hwnd_frame, &rect_frame_scr); //client_0_0.x = 0; //client_0_0.y=0; //ClientToScreen(hwnd_frame,&client_0_0); //client_0_0.y-= rect_frame_scr.top; //client_0_0.x-= rect_frame_scr.left; ClientToScreen(hwnd,&pt); //convert the mouse coordinates relative to the top-left of //the window //ScreenToClient(hwnd_frame,&pt); if(pt.x < min_left) pt.x = min_left; if(pt.x > max_right) { pt.x = max_right; } hdc = GetDC(NULL); DrawXorBar(hdc, pt.x-SPLT_WIDTH/2, y, SPLT_WIDTH, line_height); ReleaseDC(NULL, hdc); oldx = pt.x; break; case WM_LBUTTONUP: ReleaseCapture(); pt.x = (short)LOWORD(lParam); // horizontal position of cursor pt.y = (short)HIWORD(lParam); GetClientRect(hp,&rect); //GetClientRect(hwnd,&splt_rect); //GetWindowRect(hwnd_frame, &rect_frame_scr); //client_0_0.x = 0; //client_0_0.y=0; //ClientToScreen(hwnd_frame,&client_0_0); //client_0_0.y-= rect_frame_scr.top; //client_0_0.x-= rect_frame_scr.left; hdc = GetDC(NULL); DrawXorBar(hdc, oldx-SPLT_WIDTH/2, y, SPLT_WIDTH, line_height); ReleaseDC(NULL, hdc); we_sizing = 0; pt.x = oldx; ScreenToClient(hp,&pt); send_splitter_x(hp, pt.x); break; case WM_MOUSEMOVE: if(0==we_sizing) break; pt.x = (short)LOWORD(lParam); // horizontal position of cursor pt.y = (short)HIWORD(lParam); //GetClientRect(hwnd_frame,&rect); //GetClientRect(hwnd,&splt_rect); //SCreenToClient(rect);//.........这里部分代码省略.........
开发者ID:sunmingbao,项目名称:xb-ether-tester,代码行数:101,
示例22: PinCtrlDlgProcINT_PTR CALLBACK PinCtrlDlgProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg) { case WM_CLOSE: { RECT rc; GetWindowRect(hWndDlg, &rc); axisx = rc.left; axisy = rc.top; hWndPinCtrl = NULL; EndDialog(hWndDlg, 0); return 0; } case WM_COMMAND: { switch(LOWORD(wParam)) { case IDC_PINCTRL_OK: if(HIWORD(wParam) != BN_CLICKED) return 0; if(msg.hComPort == INVALID_HANDLE_VALUE) { MessageBox(hWndDlg, "没有串口设备被打开!", COMMON_NAME, MB_ICONINFORMATION); return 0; } cconfig.dcb.fDtrControl = dtr[ComboBox_GetCurSel(hDtr)]; cconfig.dcb.fRtsControl = rts[ComboBox_GetCurSel(hRts)]; if(!SetCommConfig(msg.hComPort, &cconfig, sizeof(cconfig))) { utils.msgerr("设置DTR/RTS时错误!"); return 0; } EnableWindow(GetDlgItem(hWndDlg, IDC_PINCTRL_OK), FALSE); break; case IDC_CBO_PINCTRL_DTR: case IDC_CBO_PINCTRL_RTS: if(HIWORD(wParam) == CBN_SELENDOK) { EnableWindow(GetDlgItem(hWndDlg, IDC_PINCTRL_OK), TRUE); return 0; } break; } return 0; } case WM_INITDIALOG: { DWORD size = sizeof(cconfig); if(msg.hComPort == INVALID_HANDLE_VALUE) { utils.msgbox(MB_ICONEXCLAMATION, COMMON_NAME, "请先打开一个串口设备!"); EndDialog(hWndDlg, 0); return 0; } if(!GetCommConfig(msg.hComPort, &cconfig, &size)) { utils.msgerr("获取串口配置时错误"); EndDialog(hWndDlg, 0); return 0; } hDtr = GetDlgItem(hWndDlg, IDC_CBO_PINCTRL_DTR); hRts = GetDlgItem(hWndDlg, IDC_CBO_PINCTRL_RTS); for(;;) { int i; for(i = 0; i < 3; i++) { ComboBox_AddString(hDtr, sdtr[i]); ComboBox_AddString(hRts, srts[i]); } ComboBox_SetCurSel(hDtr, cconfig.dcb.fDtrControl); ComboBox_SetCurSel(hRts, cconfig.dcb.fRtsControl); break; } //... hWndPinCtrl = hWndDlg; SetWindowPos(hWndDlg, 0, axisx, axisy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); return 0; } } UNREFERENCED_PARAMETER(lParam); return 0;}
开发者ID:lizhoujian,项目名称:myComm,代码行数:84,
示例23: CC_BREAK_IFbool CCEGLView::Create(LPCTSTR pTitle, int w, int h){ bool bRet = false; do { CC_BREAK_IF(m_hWnd); HINSTANCE hInstance = GetModuleHandle( NULL ); WNDCLASS wc; // Windows Class Structure // Redraw On Size, And Own DC For Window. wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = _WindowProc; // WndProc Handles Messages wc.cbClsExtra = 0; // No Extra Window Data wc.cbWndExtra = 0; // No Extra Window Data wc.hInstance = hInstance; // Set The Instance wc.hIcon = LoadIcon( NULL, IDI_WINLOGO ); // Load The Default Icon wc.hCursor = LoadCursor( NULL, IDC_ARROW ); // Load The Arrow Pointer wc.hbrBackground = NULL; // No Background Required For GL wc.lpszMenuName = NULL; // We Don't Want A Menu wc.lpszClassName = kWindowClassName; // Set The Class Name CC_BREAK_IF(! RegisterClass(&wc) && 1410 != GetLastError()); // center window position RECT rcDesktop; GetWindowRect(GetDesktopWindow(), &rcDesktop); // create window m_hWnd = CreateWindowEx( WS_EX_APPWINDOW | WS_EX_WINDOWEDGE, // Extended Style For The Window kWindowClassName, // Class Name pTitle, // Window Title WS_CAPTION | WS_POPUPWINDOW | WS_MINIMIZEBOX, // Defined Window Style 0, 0, // Window Position 0, // Window Width 0, // Window Height NULL, // No Parent Window NULL, // No Menu hInstance, // Instance NULL ); CC_BREAK_IF(! m_hWnd); m_eInitOrientation = CCDirector::sharedDirector()->getDeviceOrientation(); m_bOrientationInitVertical = (CCDeviceOrientationPortrait == m_eInitOrientation || kCCDeviceOrientationPortraitUpsideDown == m_eInitOrientation) ? true : false; m_tSizeInPoints.cx = w; m_tSizeInPoints.cy = h; resize(w, h); // init egl m_pEGL = CCEGL::create(this); if (! m_pEGL) { DestroyWindow(m_hWnd); m_hWnd = NULL; break; } s_pMainWindow = this; bRet = true; } while (0); return bRet;}
开发者ID:qvbige240,项目名称:cocos2d-1.0.1-x-0.13.0-beta,代码行数:67,
示例24: AboutFuncstatic inline INT_PTR CALLBACK AboutFunc(HWND a_hDlg, UINT a_message, WPARAM a_wParam, LPARAM a_lParam){ switch (a_message) { case WM_INITDIALOG: SendMessage( a_hDlg , WM_SETICON , TRUE , (LPARAM)g_hIcon ); SendMessage( a_hDlg , WM_SETICON , FALSE , (LPARAM)g_hIcon ); SetWindowText( a_hDlg , g_pTitle ); SendMessage( GetDlgItem( a_hDlg , s_ids.m_nIcon ) , STM_SETICON, (WPARAM)g_hIcon , 0L); SetDlgItemText( a_hDlg , s_ids.m_nAppName , g_pAppName ); SetDlgItemText( a_hDlg , s_ids.m_nLink , g_pUrl ); SetDlgItemText( a_hDlg , s_ids.m_nEdit , g_pProgrammed ); { RECT rcTmp = {}; GetWindowRect( a_hDlg , &rcTmp ); RECT rcMain1 = rcTmp; GetClientRect( a_hDlg , &rcTmp ); SIZE szClientSize = { rcTmp.right , rcTmp.bottom }; const SIZE szMainB = { (rcMain1.right - rcMain1.left) - rcTmp.right, (rcMain1.bottom - rcMain1.top) - rcTmp.bottom }; //----------------------------------------- CWndSize wIcon( GetDlgItem( a_hDlg , s_ids.m_nIcon ) ); CWndSize wAppName( GetDlgItem( a_hDlg , s_ids.m_nAppName ) ); CWndSize wLink( GetDlgItem( a_hDlg , s_ids.m_nLink ) ); CWndSize wP2( GetDlgItem( a_hDlg , s_ids.m_nText0 ) ); CWndSize wProgrammed( GetDlgItem( a_hDlg , s_ids.m_nEdit ) ); //-------------------------------------------------- int nMaxHeight_Link = 0; int nMaxWidth_Link = 0; if( wLink.GetHWND() ) { nMaxHeight_Link = (int)::SendMessage( wLink.GetHWND() , LM_GETIDEALHEIGHT , 0 , 0 ); nMaxWidth_Link = 0; int nHeight1; int nHeight2; SIZE size = {}; do { nMaxWidth_Link++; nHeight1 = (int)::SendMessage( wLink.GetHWND() , LM_GETIDEALSIZE , (WPARAM)nMaxWidth_Link , (LPARAM)&size ); nHeight2 = (int)::SendMessage( wLink.GetHWND() , LM_GETIDEALSIZE , (WPARAM)nMaxWidth_Link + 2 , (LPARAM)&size ); } while ( nMaxHeight_Link != nHeight1 || nMaxHeight_Link != nHeight2 ); } if( nMaxWidth_Link < (szClientSize.cx - 8*2) ) { //nMaxWidth_Link = (szClientSize.cx - 8*2); } else szClientSize.cx = nMaxWidth_Link + 8*2; szClientSize.cy = 8 + wIcon.GetSize().cy + 2 + wAppName.GetSize().cy + 16 + nMaxHeight_Link + 16 + wP2.GetSize().cy + 2 + wProgrammed.GetSize().cy + 8; MoveWindow( a_hDlg , rcMain1.left , rcMain1.top , szClientSize.cx + szMainB.cx , szClientSize.cy + szMainB.cy , TRUE ); // int posY = 8; wIcon.SetC_X( szClientSize.cx , posY , wIcon.GetSize().cx , wIcon.GetSize().cy ); posY += (2 + wIcon.GetSize().cy); //SetWindowLong( wAppName.GetHWND() , GWL_STYLE , GetWindowLong( wAppName.GetHWND() , GWL_STYLE ) | SS_CENTER ); wAppName.SetC_X( szClientSize.cx , posY , szClientSize.cx , wAppName.GetSize().cy ); posY += (16 + wAppName.GetSize().cy); wLink.SetC_X( szClientSize.cx , posY , nMaxWidth_Link , nMaxHeight_Link ); posY += (16 + wLink.GetSize().cy); //SetWindowLong( wP2.GetHWND() , GWL_STYLE , GetWindowLong( wP2.GetHWND() , GWL_STYLE ) | SS_CENTER ); wP2.SetC_X( szClientSize.cx , posY , szClientSize.cx , wP2.GetSize().cy ); posY += (2 + wP2.GetSize().cy); wProgrammed.SetC_X( szClientSize.cx , posY , szClientSize.cx , wProgrammed.GetSize().cy ); posY += (2 + wProgrammed.GetSize().cy); } return (INT_PTR)TRUE; case WM_NOTIFY: { const LPNMHDR pNMHdr = (LPNMHDR)a_lParam;//.........这里部分代码省略.........
开发者ID:DragonNeos,项目名称:wqsglib,代码行数:101,
示例25: OnInit/*------------------------------------------------ initialize--------------------------------------------------*/void OnInit(HWND hDlg){ PMOUSESTRUCT pitem; RECT rc; BOOL b; m_bInit = FALSE; if(GetMyRegLong(m_section, "ver031031", 0) == 0) { SetMyRegLong(m_section, "ver031031", 1); ImportOldMouseFunc(); // common/mousestruct.c } // common/mousestruct.c m_pMouseCommand = LoadMouseFunc(); // common/tclang.c SetDialogLanguage(hDlg, "Mouse", g_hfontDialog); GetWindowRect(GetDlgItem(hDlg, IDC_MOUSEOPT), &rc); m_widthOpt = rc.right - rc.left; CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_LEFTBUTTON, "LButton")); CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_RIGHTBUTTONM, "RButton")); CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_MIDDLEBUTTONM, "MButton")); CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_XBUTTON1, "XButton1")); CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_XBUTTON2, "XButton2"));#if TC_ENABLE_WHEEL CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_WHEELUP, "WheelUp")); CBAddString(hDlg, IDC_MOUSEBUTTON, (LPARAM)MyString(IDS_WHEELDOWN, "WheelDown"));#endif InitFunction(hDlg, IDC_MOUSEFUNC); pitem = m_pMouseCommand; while(pitem) { CBAddString(hDlg, IDC_NAMECLICK, (LPARAM)pitem->name); pitem = pitem->next; } m_nCurrent = -1; CBSetCurSel(hDlg, IDC_NAMECLICK, 0); OnName(hDlg); CheckDlgButton(hDlg, IDC_LMOUSEPASSTHRU, GetMyRegLong(m_section, "LeftMousePassThrough", (g_winver&WIN10RS1) != 0)); b = GetMyRegLong(NULL, "RightClickMenu", TRUE); b = GetMyRegLong(m_section, "RightClickMenu", b); CheckDlgButton(hDlg, IDC_RCLICKMENU, b); m_bInit = TRUE;}
开发者ID:k-takata,项目名称:TClockLight,代码行数:66,
示例26: pointvoid CBacnetVariable::OnNMClickListVariable(NMHDR *pNMHDR, LRESULT *pResult){ LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR); // TODO: Add your control notification handler code here long lRow,lCol; m_variable_list.Set_Edit(true); DWORD dwPos=GetMessagePos();//Get which line is click by user.Set the check box, when user enter Insert it will jump to program dialog CPoint point( LOWORD(dwPos), HIWORD(dwPos)); m_variable_list.ScreenToClient(&point); LVHITTESTINFO lvinfo; lvinfo.pt=point; lvinfo.flags=LVHT_ABOVE; int nItem=m_variable_list.SubItemHitTest(&lvinfo); lRow = lvinfo.iItem; lCol = lvinfo.iSubItem; if(lRow>m_variable_list.GetItemCount()) //如果点击区超过最大行号,则点击是无效的 return; if(lRow<0) return; CString temp1; m_row = lRow; m_col = lCol; memcpy_s(&m_temp_variable_data[lRow],sizeof(Str_variable_point),&m_Variable_data.at(lRow),sizeof(Str_variable_point)); CString New_CString; CString temp_task_info; if((lCol == VARIABLE_VALUE) &&(m_Variable_data.at(lRow).digital_analog == BAC_UNITS_DIGITAL ) && (m_Variable_data.at(lRow).auto_manual != BAC_AUTO)) { CString temp1; CStringArray temparray; if((m_Variable_data.at(lRow).range < 23) &&(m_Variable_data.at(lRow).range !=0)) temp1 = Digital_Units_Array[m_Variable_data.at(lRow).range]; else if((m_Variable_data.at(lRow).range >=23) && (m_Variable_data.at(lRow).range <= 30)) { if(receive_customer_unit) temp1 = temp_unit_no_index[m_Variable_data.at(lRow).range - 23]; else { m_variable_list.Set_Edit(false); return; } } else return; SplitCStringA(temparray,temp1,_T("/")); if(m_Variable_data.at(lRow).control == 0) { m_Variable_data.at(lRow).control = 1; m_variable_list.SetItemText(lRow,VARIABLE_VALUE,temparray.GetAt(1)); New_CString = temparray.GetAt(1); } else { m_Variable_data.at(lRow).control = 0; m_variable_list.SetItemText(lRow,VARIABLE_VALUE,temparray.GetAt(0)); New_CString = temparray.GetAt(0); } m_variable_list.Set_Edit(false); temp_task_info.Format(_T("Write Variable List Item%d .Changed to /"%s/" "),lRow + 1,New_CString); } else if((lCol == VARIABLE_VALUE) &&(m_Variable_data.at(lRow).digital_analog == BAC_UNITS_ANALOG ) && (m_Variable_data.at(lRow).auto_manual == BAC_MANUAL) && (m_Variable_data.at(lRow).range == 20)) { m_variable_list.Set_Edit(false); m_variable_time_picker.ShowWindow(SW_SHOW); CRect list_rect,win_rect; m_variable_list.GetWindowRect(list_rect); GetWindowRect(win_rect); CRect myrect; m_variable_list.GetSubItemRect(lRow,lCol,LVIR_BOUNDS,myrect); myrect.left = myrect.left + list_rect.left - win_rect.left +2 ; myrect.right = myrect.right + list_rect.left - win_rect.left + 2; //myrect.top = myrect.top + 11; //myrect.bottom = myrect.bottom + 13; myrect.top = myrect.top + 24; myrect.bottom = myrect.bottom + 26; m_variable_time_picker.BringWindowToTop(); m_variable_time_picker.MoveWindow(myrect); CString Temp_CString = m_variable_list.GetItemText(lRow,lCol); CStringArray TEMPCS; int temp_hour,temp_minute; SplitCStringA(TEMPCS, Temp_CString, _T(":")); if((int)TEMPCS.GetSize() <2)//.........这里部分代码省略.........
开发者ID:ALEXLCC,项目名称:T3000_Building_Automation_System,代码行数:101,
示例27: startup_dlgprocstatic INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){ static HBITMAP hbmp = NULL; HDC hdc; switch (uMsg) { case WM_INITDIALOG: { HWND hwnd; RECT r, rdlg, chrome, rtab, rcancel, rstart; int xoffset = 0, yoffset = 0; // Fetch the positions (in screen coordinates) of all the windows we need to tweak ZeroMemory(&chrome, sizeof(chrome)); AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE); GetWindowRect(hwndDlg, &rdlg); GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab); GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel); GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart); // Knock off the non-client area of the main dialogue to give just the client area rdlg.left -= chrome.left; rdlg.top -= chrome.top; rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom; // Translate them to client-relative coordinates wrt the main dialogue window rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1; rtab.left -= rdlg.left; rtab.top -= rdlg.top; rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1; rcancel.left -= rdlg.left; rcancel.top -= rdlg.top; rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1; rstart.left -= rdlg.left; rstart.top -= rdlg.top; // And then convert the main dialogue coordinates to just width/length rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1; rdlg.left = 0; rdlg.top = 0; // Load the bitmap into the bitmap control and fetch its dimensions hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP)); hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP); SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp); GetClientRect(hwnd, &r); xoffset = r.right; yoffset = r.bottom - rdlg.bottom; // Shift and resize the controls that require it rtab.left += xoffset; rtab.bottom += yoffset; rcancel.left += xoffset; rcancel.top += yoffset; rstart.left += xoffset; rstart.top += yoffset; rdlg.right += xoffset; rdlg.bottom += yoffset; // Move the controls to their new positions MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE); MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE); MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE); // Move the main dialogue to the centre of the screen hdc = GetDC(NULL); rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2; rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2; ReleaseDC(NULL, hdc); MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left, rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE); // Add tabs to the tab control { TCITEM tab; hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL); ZeroMemory(&tab, sizeof(tab)); tab.mask = TCIF_TEXT; tab.pszText = TEXT("Configuration"); SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab); tab.mask = TCIF_TEXT; tab.pszText = TEXT("Game"); SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_GAME, (LPARAM)&tab); tab.mask = TCIF_TEXT; tab.pszText = TEXT("Messages"); SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab); // Work out the position and size of the area inside the tab control for the pages ZeroMemory(&r, sizeof(r)); GetClientRect(hwnd, &r); SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r); r.right -= r.left-1; r.bottom -= r.top-1; r.top += rtab.top; r.left += rtab.left; // Create the pages and position them in the tab control, but hide them pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc); pages[TAB_GAME] = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWINPAGE_GAME), hwndDlg, GamePageProc); pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES); SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); SetWindowPos(pages[TAB_GAME], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);//.........这里部分代码省略.........
开发者ID:Plagman,项目名称:jfduke3d,代码行数:101,
示例28: DialogCDisasm::CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu) : Dialog((LPCSTR)IDD_DISASM, _hInstance, _hParent){ cpu = _cpu; lastTicks = CoreTiming::GetTicks(); keepStatusBarText = false; SetWindowText(m_hDlg, ConvertUTF8ToWString(_cpu->GetName()).c_str());#ifdef THEMES //if (WTL::CTheme::IsThemingSupported()) //EnableThemeDialogTexture(m_hDlg ,ETDT_ENABLETAB);#endif int x = g_Config.iDisasmWindowX == -1 ? 500 : g_Config.iDisasmWindowX; int y = g_Config.iDisasmWindowY == -1 ? 200 : g_Config.iDisasmWindowY; int w = g_Config.iDisasmWindowW; int h = g_Config.iDisasmWindowH; // Start with the initial size so we have the right minimum size from the rc. SetWindowPos(m_hDlg, 0, x, y, 0, 0, SWP_NOSIZE); CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->setDebugger(cpu); ptr->gotoAddr(0x00000000); CtrlRegisterList *rl = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST)); rl->setCPU(cpu); GetWindowRect(m_hDlg, &defaultRect); //symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); symbolMap.FillSymbolComboBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); GetWindowRect(GetDlgItem(m_hDlg, IDC_REGLIST), ®Rect); GetWindowRect(GetDlgItem(m_hDlg, IDC_DISASMVIEW), &disRect); GetWindowRect(GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST), &breakpointRect); GetWindowRect(GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST), &defaultBreakpointRect); HWND tabs = GetDlgItem(m_hDlg, IDC_LEFTTABS); TCITEM tcItem; ZeroMemory (&tcItem,sizeof (tcItem)); tcItem.mask = TCIF_TEXT; tcItem.dwState = 0; tcItem.pszText = L"Regs"; tcItem.cchTextMax = (int)wcslen(tcItem.pszText)+1; tcItem.iImage = 0; int result1 = TabCtrl_InsertItem(tabs, TabCtrl_GetItemCount(tabs),&tcItem); tcItem.pszText = L"Funcs"; tcItem.cchTextMax = (int)wcslen(tcItem.pszText)+1; int result2 = TabCtrl_InsertItem(tabs, TabCtrl_GetItemCount(tabs),&tcItem); ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST), SW_NORMAL); ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), SW_HIDE); SetTimer(m_hDlg,1,1000,0); // subclass the goto edit box HWND editWnd = GetDlgItem(m_hDlg,IDC_ADDRESS); DefGotoEditProc = (WNDPROC)GetWindowLongPtr(editWnd,GWLP_WNDPROC); SetWindowLongPtr(editWnd,GWLP_WNDPROC,(LONG_PTR)GotoEditProc); // init memory viewer CtrlMemView *mem = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); mem->setDebugger(_cpu); breakpointList = new CtrlBreakpointList(GetDlgItem(m_hDlg,IDC_BREAKPOINTLIST)); breakpointList->setCpu(cpu); breakpointList->setDisasm(ptr); breakpointList->reloadBreakpoints(); threadList = new CtrlThreadList(GetDlgItem(m_hDlg,IDC_THREADLIST)); threadList->reloadThreads(); stackTraceView = new CtrlStackTraceView(GetDlgItem(m_hDlg,IDC_STACKFRAMES)); stackTraceView->setCpu(cpu); stackTraceView->setDisasm(ptr); stackTraceView->loadStackTrace(); // init bottom "tab" changeSubWindow(SUBWIN_FIRST); // init status bar statusBarWnd = CreateStatusWindow(WS_CHILD | WS_VISIBLE, L"", m_hDlg, IDC_DISASMSTATUSBAR); if (g_Config.bDisplayStatusBar == false) { ShowWindow(statusBarWnd,SW_HIDE); } // Actually resize the window to the proper size (after the above setup.) if (w != -1 && h != -1) { // this will also call UpdateSize SetWindowPos(m_hDlg, 0, x, y, w, h, 0); } SetDebugMode(true, true);}
开发者ID:Gary1234567,项目名称:ppsspp,代码行数:93,
示例29: DialogProcstatic BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){ static HICON hIcon; TCHAR tmpbuf[MAX_PATH]; if (uMsg == WM_DESTROY && hIcon) { DeleteObject(hIcon); hIcon=0; } if (uMsg == WM_INITDIALOG || uMsg == WM_USER+1) { int backenabled=0,iscp=1,islp=1, x; struct { LPTSTR id; WNDPROC proc; LPTSTR s; } windows[4]= { {MAKEINTRESOURCE(IDD_LICENSE),LicenseProc,""}, {MAKEINTRESOURCE(IDD_SELCOM),LicenseProc,""}, {MAKEINTRESOURCE(IDD_DIR),DirProc,""}, {MAKEINTRESOURCE(IDD_INSTFILES),InstProc,""}, }; int messages[4] = { JAVAWS_MESSAGE_LICENSE, JAVAWS_MESSAGE_INSTOPT, JAVAWS_MESSAGE_INSTDIR, JAVAWS_MESSAGE_INSTFILES }; for( x=0; x<4; x++) { GETRESOURCE(tmpbuf, messages[x]); windows[x].s = (LPTSTR)malloc((_tcslen(tmpbuf) + 1) * sizeof(TCHAR)); _tcscpy(windows[x].s, tmpbuf); } if (uMsg == WM_INITDIALOG) { g_hwnd=hwndDlg; hIcon=LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON2)); SetClassLong(hwndDlg,GCL_HICON,(long)hIcon); } if (m_curwnd) DestroyWindow(m_curwnd); if (!m_header->licensetext[0] || m_header->licensedata_offset==-1) islp=0; if (m_page==0 && !islp) m_page++; if (m_page==1 && autoinstall == 2) { /* skip the rest of the dialog because it's an autoinstall */ g_hwnd = NULL; EndDialog(hwndDlg,3); } if (m_header->num_sections < 2) iscp=0; { int id=LOWORD(wParam); if (uMsg==(WM_USER+1) && id==IDC_BACK) { if (m_page==1 && !iscp) m_page--; } else { if (m_page==1 && !iscp) m_page++; } } if (m_page==1&&islp) backenabled=1; if (m_page==2&&(islp||iscp)) backenabled=1; if (m_page < 0 || m_page > 3) { EndDialog(hwndDlg,0); } else { HWND hwnd; GETRESOURCE(tmpbuf,JAVAWS_BACK); SetDlgItemText(hwndDlg,IDC_BACK,tmpbuf); if (m_page==0) { GETRESOURCE(tmpbuf,JAVAWS_DECLINE); SetDlgItemText(hwndDlg,IDCANCEL,tmpbuf); GETRESOURCE(tmpbuf,JAVAWS_ACCEPT); SetDlgItemText(hwndDlg,IDOK,tmpbuf); hwnd=GetDlgItem(hwndDlg, IDC_BACK); ShowWindow(hwnd,SW_HIDE); } else { GETRESOURCE(tmpbuf,JAVAWS_CANCEL); SetDlgItemText(hwndDlg,IDCANCEL,tmpbuf); GETRESOURCE(tmpbuf,JAVAWS_NEXT); SetDlgItemText(hwndDlg,IDOK,tmpbuf); hwnd=GetDlgItem(hwndDlg, IDC_BACK); ShowWindow(hwnd,SW_SHOWNA); } { INT32 args[] = { (INT32)m_header->name, (INT32)windows[m_page].s }; m_curwnd=CreateDialog(g_hInstance,windows[m_page].id,hwndDlg,windows[m_page].proc); GETRESOURCE2(tmpbuf, JAVAWS_MESSAGE_SETUP2, args); SetWindowText(hwndDlg,tmpbuf); } } if (m_curwnd) { RECT r; GetWindowRect(GetDlgItem(hwndDlg,IDC_CHILDRECT),&r); ScreenToClient(hwndDlg,(LPPOINT)&r); SetWindowPos(m_curwnd,0,r.left,r.top,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER); ShowWindow(m_curwnd,SW_SHOWNA); EnableWindow(GetDlgItem(hwndDlg,IDC_BACK),backenabled); } } if (uMsg == WM_COMMAND) { int id=LOWORD(wParam);//.........这里部分代码省略.........
开发者ID:FredChap,项目名称:myforthprocessor,代码行数:101,
示例30: createWindowHWND createWindow(HINSTANCE instance){ WNDCLASSEX wndClass; ZeroMemory(&wndClass,sizeof(WNDCLASSEX)); wndClass.cbSize = sizeof(WNDCLASSEX); wndClass.style = 0; wndClass.lpfnWndProc = windowProc; wndClass.hInstance = instance; wndClass.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(100)); wndClass.hCursor = LoadCursor(0,IDC_ARROW); wndClass.lpszClassName = "DBWRender"; if (RegisterClassEx(&wndClass) == 0) fatal("Could not create window class"); wnd = CreateWindowEx(WS_EX_CLIENTEDGE,"DBWRender","DBW Render Display", WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,0,0,width,height, 0,0,instance,0); if (wnd == 0) fatal("Could not create window"); NONCLIENTMETRICS ncm; ZeroMemory(&ncm,sizeof ncm); ncm.cbSize = sizeof ncm; SystemParametersInfo(SPI_GETNONCLIENTMETRICS,ncm.cbSize,&ncm,0); HFONT font = CreateFont(ncm.lfMessageFont.lfHeight,0,0,0,FW_NORMAL,0,0,0, ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH,ncm.lfMessageFont.lfFaceName); if (font == 0) fatal("Could not create font"); HDC dc = GetWindowDC(wnd); SIZE size; GetTextExtentPoint32(dc," Save ",8,&size); buttonWidth = size.cx; buttonHeight = (int)(1.25*size.cy); ReleaseDC(wnd,dc); createButton(instance,font,"&Save",IDC_SAVE,0); createButton(instance,font,"E&xit",IDC_QUIT,1); ACCEL accelt[2] = { { FALT,'s',IDC_SAVE }, { FALT,'x',IDC_QUIT }}; accel = CreateAcceleratorTable(accelt,2); if (accel == 0) fatal("Could not create accelerator table"); RECT wr, cr; GetWindowRect(wnd,&wr); GetClientRect(wnd,&cr); int w = width+(wr.right-wr.left)-(cr.right-cr.left); int h = height+buttonHeight+(wr.bottom-wr.top)-(cr.bottom-cr.top); int mw = GetSystemMetrics(SM_CXFULLSCREEN); int mh = GetSystemMetrics(SM_CYFULLSCREEN); int x = w < mw ? (mw-w)/2 : 0; int y = h < mh ? (mh-h)/2 : 0; MoveWindow(wnd,x,y,w,h,0); ShowWindow(wnd,SW_SHOW); return wnd;}
开发者ID:DavidKinder,项目名称:DBWRender,代码行数:63,
注:本文中的GetWindowRect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetWindowStyle函数代码示例 C++ GetWindowPort函数代码示例 |