这篇教程C++ GetClientRect函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetClientRect函数的典型用法代码示例。如果您正苦于以下问题:C++ GetClientRect函数的具体用法?C++ GetClientRect怎么用?C++ GetClientRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetClientRect函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetClientRect//发牌处理bool CGameClientView::SendCard(){ //动画判断 if (m_SendCardItemArray.GetCount()==0) return false; //获取位置 CRect rcClient; GetClientRect(&rcClient); //变量定义 int nXExcursion[GAME_PLAYER]={-1,1,-1,-1,-1}; int nYExcursion[GAME_PLAYER]={0,1,1,1,1}; //设置位置 tagSendCardItem * pSendCardItem=&m_SendCardItemArray[0]; WORD bID=pSendCardItem->wChairID; BYTE bTimes; if(bID==0)bTimes=4; else if(bID==1)bTimes=3; else if(bID==2)bTimes=2; else if(bID>=3)bTimes=2; m_SendCardPos.x+=nXExcursion[bID]*(abs(m_ptUserCard[bID].x-m_KeepPos.x)/SPEED*bTimes); m_SendCardPos.y+=nYExcursion[bID]*(abs(m_ptUserCard[bID].y-m_KeepPos.y)/SPEED*bTimes); //更新界面 UpdateGameView(&rcClient); //停止判断 int bTempX=0,bTempY=0; bTempX=m_ptUserCard[bID].x; bTempY=m_ptUserCard[bID].y; if((pSendCardItem->wChairID==0 && m_SendCardPos.x<=bTempX)||(pSendCardItem->wChairID>=1 && m_SendCardPos.y>=bTempY)) { //获取扑克 BYTE cbCardData[MAX_COUNT]; WORD wChairID=pSendCardItem->wChairID; BYTE cbCardCount=(BYTE)m_CardControl[wChairID].GetCardData(cbCardData,CountArray(cbCardData)); //设置扑克&& pSendCardItem->cbCardData!=0 if (cbCardCount<=MAX_COUNT) { cbCardData[cbCardCount++]=pSendCardItem->cbCardData; m_CardControl[wChairID].SetCardData(cbCardData,cbCardCount); } //删除动画 m_SendCardItemArray.RemoveAt(0); //继续动画 if (m_SendCardItemArray.GetCount()>0) { //设置位置 /2 GetClientRect(&rcClient); m_SendCardPos.x=rcClient.Width()/2+200; m_SendCardPos.y=rcClient.Height()/2-308; //播放声音 CGameClientDlg * pGameClientDlg=CONTAINING_RECORD(this,CGameClientDlg,m_GameClientView); pGameClientDlg->PlayGameSound(AfxGetInstanceHandle(),TEXT("SEND_CARD")); return true; } else { //完成处理 AfxGetMainWnd()->PostMessage(IDM_SEND_CARD_FINISH,0,0); return false; } } return true;}
开发者ID:lonyzone,项目名称:oathx-ogrex-editor,代码行数:75,
示例2: GetClientRectunsigned track_bar_impl::calculate_thumb_size() const{ RECT rc_client; GetClientRect(get_wnd(), &rc_client); return MulDiv(get_orientation() ? rc_client.right : rc_client.bottom,9,20);}
开发者ID:wyrover,项目名称:ui_helpers,代码行数:6,
示例3: switch//.........这里部分代码省略......... case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: case WM_XBUTTONDOWN: { if (get_enabled() && get_auto_focus() && GetFocus() != wnd) SetFocus(wnd); if (m_dragging) { destroy_tooltip(); if (GetCapture() == wnd) ReleaseCapture(); message_hook_manager::deregister_hook(message_hook_manager::type_keyboard, this); m_hook_registered=false; //SetFocus(IsWindow(m_wnd_prev) ? m_wnd_prev : uFindParentPopup(wnd)); m_dragging = false; set_position_internal(m_position); } } break; case WM_LBUTTONDOWN: { if (get_enabled()) { if (get_auto_focus() && GetFocus() != wnd) SetFocus(wnd); POINT pt; pt.x = GET_X_LPARAM(lp); pt.y = GET_Y_LPARAM(lp); RECT rc_client; GetClientRect(wnd, &rc_client); if (PtInRect(&rc_client, pt)) { m_dragging = true; SetCapture(wnd); //SetFocus(wnd); message_hook_manager::register_hook(message_hook_manager::type_keyboard, this); m_hook_registered=true; unsigned pos = calculate_position_from_point(pt); set_position_internal(pos); POINT pts = pt; ClientToScreen(wnd, &pts); if (m_show_tooltips && m_host) { track_bar_string temp; m_host->get_tooltip_text(pos, temp); create_tooltip(temp.data(), pts); } } m_last_mousemove.m_valid = false; } } return 0; case WM_LBUTTONUP: { if (m_dragging) { destroy_tooltip(); if (GetCapture() == wnd) ReleaseCapture();
开发者ID:wyrover,项目名称:ui_helpers,代码行数:67,
示例4: WinProcLRESULT CALLBACK WinProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam){ LONG lRet = 0; PAINTSTRUCT ps; switch (uMsg) { case WM_SIZE: // If the window is resized if(!g_bFullScreen) // Do this only if we are NOT in full screen { SizeOpenGLScreen(LOWORD(lParam),HIWORD(lParam));// LoWord=Width, HiWord=Height GetClientRect(hWnd, &g_rRect); // Get the window rectangle } break; case WM_PAINT: // If we need to repaint the scene BeginPaint(hWnd, &ps); // Init the paint struct EndPaint(hWnd, &ps); // EndPaint, Clean up break;/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // Below we check what the user types in. If they use the arrow keys // then we want to move the triangle around (LEFT RIGHT UP and DOWN keys) case WM_KEYDOWN: switch(wParam) { case VK_ESCAPE: // Check if we hit the ESCAPE key. PostQuitMessage(0); // Tell windows we want to quit break; case VK_UP: // Check if we hit the UP ARROW key. vTriangle[0].x += 0.01f; // Move the left point of the triangle to the left vTriangle[1].x += 0.01f; // Move the right point of the triangle to the left vTriangle[2].x += 0.01f; // Move the top point of the triangle to the left break; case VK_DOWN: // Check if we hit the DOWN ARROW key. vTriangle[0].x -= 0.01f; // Move the left point of the triangle to the left vTriangle[1].x -= 0.01f; // Move the right point of the triangle to the left vTriangle[2].x -= 0.01f; // Move the top point of the triangle to the left break; case VK_LEFT: // Check if we hit the LEFT ARROW key. vTriangle[0].z -= 0.01f; // Move the left point of the triangle back vTriangle[1].z -= 0.01f; // Move the right point of the triangle back vTriangle[2].z -= 0.01f; // Move the top point of the triangle back break; case VK_RIGHT: // Check if we hit the RIGHT ARROW key. vTriangle[0].z += 0.01f; // Move the left point of the triangle forward vTriangle[1].z += 0.01f; // Move the right point of the triangle forward vTriangle[2].z += 0.01f; // Move the top point of the triangle forward break; } break;/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * case WM_CLOSE: // If the window is closed PostQuitMessage(0); // Tell windows we want to quit break; default: // Return by default lRet = DefWindowProc (hWnd, uMsg, wParam, lParam); break; } return lRet; // Return by default}
开发者ID:Allenjonesing,项目名称:tutorials,代码行数:73,
示例5: GetClientRectvoid CDisAsmWnd::RefreshLayout(){ RECT rc = GetClientRect(); m_disAsm->SetSize(rc.right, rc.bottom);}
开发者ID:cmexp,项目名称:Play-,代码行数:5,
示例6: UpdateInsetsstatic RECT * UpdateInsets(JNIEnv *env, HWND hwnd, jobject window){ // being naughty here static RECT m_insets = { 0, 0, 0, 0 }; RECT outside; RECT inside; if (IsIconic(hwnd)) { m_insets.left = m_insets.top = m_insets.right = m_insets.bottom = -1; return FALSE; } m_insets.left = m_insets.top = m_insets.right = m_insets.bottom = 0; GetClientRect(hwnd, &inside); GetWindowRect(hwnd, &outside); if (outside.right - outside.left > 0 && outside.bottom - outside.top > 0) { MapWindowPoints(hwnd, 0, (LPPOINT)&inside, 2); m_insets.top = inside.top - outside.top; m_insets.bottom = outside.bottom - inside.bottom; m_insets.left = inside.left - outside.left; m_insets.right = outside.right - inside.right; } else { m_insets.top = -1; } if (m_insets.left < 0 || m_insets.top < 0 || m_insets.right < 0 || m_insets.bottom < 0) { LONG style = GetWindowLong(hwnd, GWL_STYLE); // TODO: TDV: better undecorated checking needed BOOL bIsUndecorated = (style & (WS_CHILD|WS_POPUP|WS_SYSMENU)) != 0; if (!bIsUndecorated) { /* Get outer frame sizes. */ if (style & WS_THICKFRAME) { m_insets.left = m_insets.right = GetSystemMetrics(SM_CXSIZEFRAME); m_insets.top = m_insets.bottom = GetSystemMetrics(SM_CYSIZEFRAME); } else { m_insets.left = m_insets.right = GetSystemMetrics(SM_CXDLGFRAME); m_insets.top = m_insets.bottom = GetSystemMetrics(SM_CYDLGFRAME); } /* Add in title. */ m_insets.top += GetSystemMetrics(SM_CYCAPTION); } else { /* undo the -1 set above */ m_insets.left = m_insets.top = m_insets.right = m_insets.bottom = 0; } } DBG_PRINT("*** WindowsWindow: UpdateInsets window %p, %d/%d %dx%d/n", (void*)hwnd, (int)m_insets.left, (int)m_insets.top, (int)(m_insets.right-m_insets.left), (int)(m_insets.top-m_insets.bottom)); (*env)->CallVoidMethod(env, window, insetsChangedID, m_insets.left, m_insets.top, m_insets.right, m_insets.bottom); return &m_insets;}
开发者ID:Dahie,项目名称:jogl,代码行数:63,
示例7: switchLRESULT VLCControlsWnd::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg){ case WM_CREATE:{ const int ControlsHeight = 21+3; const int ButtonsWidth = ControlsHeight; int HorizontalOffset = xControlsSpace; int ControlWidth = ButtonsWidth; hPlayPauseButton = CreateWindow(TEXT("BUTTON"), TEXT("Play/Pause"), WS_CHILD|WS_VISIBLE|BS_BITMAP|BS_FLAT, HorizontalOffset, xControlsSpace, ControlWidth, ControlsHeight, hWnd(), (HMENU)ID_FS_PLAY_PAUSE, 0, 0); SendMessage(hPlayPauseButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)RC().hPauseBitmap); HorizontalOffset+=ControlWidth+xControlsSpace; ControlWidth = 200; int VideoPosControlHeight = 10; hVideoPosScroll = CreateWindow(PROGRESS_CLASS, TEXT("Video Position"), WS_CHILD|WS_DISABLED|WS_VISIBLE|SBS_HORZ|SBS_TOPALIGN|PBS_SMOOTH, HorizontalOffset, xControlsSpace+(ControlsHeight-VideoPosControlHeight)/2, ControlWidth, VideoPosControlHeight, hWnd(), (HMENU)ID_FS_VIDEO_POS_SCROLL, 0, 0); HMODULE hThModule = LoadLibrary(TEXT("UxTheme.dll")); if(hThModule){ FARPROC proc = GetProcAddress(hThModule, "SetWindowTheme"); typedef HRESULT (WINAPI* SetWindowThemeProc)(HWND, LPCWSTR, LPCWSTR); if(proc){ ((SetWindowThemeProc)proc)(hVideoPosScroll, L"", L""); } FreeLibrary(hThModule); } HorizontalOffset+=ControlWidth+xControlsSpace; ControlWidth = ButtonsWidth; hMuteButton = CreateWindow(TEXT("BUTTON"), TEXT("Mute"), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX|BS_PUSHLIKE|BS_BITMAP, //BS_FLAT HorizontalOffset, xControlsSpace, ControlWidth, ControlsHeight, hWnd(), (HMENU)ID_FS_MUTE, 0, 0); SendMessage(hMuteButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)RC().hVolumeBitmap); HorizontalOffset+=ControlWidth+xControlsSpace; ControlWidth = 100; hVolumeSlider = CreateWindow(TRACKBAR_CLASS, TEXT("Volume"), WS_CHILD|WS_VISIBLE|TBS_HORZ|TBS_BOTTOM|TBS_AUTOTICKS, HorizontalOffset, xControlsSpace, ControlWidth, ControlsHeight - 4, hWnd(), (HMENU)ID_FS_VOLUME, 0, 0); HorizontalOffset+=ControlWidth+xControlsSpace; SendMessage(hVolumeSlider, TBM_SETRANGE, FALSE, (LPARAM) MAKELONG (0, 100)); SendMessage(hVolumeSlider, TBM_SETTICFREQ, (WPARAM) 10, 0); ControlWidth = ButtonsWidth; DWORD dwFSBtnStyle = WS_CHILD|BS_BITMAP|BS_FLAT; if( !PO() || PO()->get_enable_fs() ){ dwFSBtnStyle |= WS_VISIBLE; } hFSButton = CreateWindow(TEXT("BUTTON"), TEXT("Toggle fullscreen"), dwFSBtnStyle, HorizontalOffset, xControlsSpace, ControlWidth, ControlsHeight, hWnd(), (HMENU)ID_FS_SWITCH_FS, 0, 0); SendMessage(hFSButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)RC().hDeFullscreenBitmap); HorizontalOffset+=ControlWidth+xControlsSpace; RECT rect; GetClientRect(GetParent(hWnd()), &rect); int ControlWndWidth = HorizontalOffset; int ControlWndHeight = xControlsSpace+ControlsHeight+xControlsSpace; SetWindowPos(hWnd(), 0, 0, (rect.bottom - rect.top) - ControlWndWidth, rect.right-rect.left, ControlWndHeight, SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_NOACTIVATE); //new message blinking timer SetTimer(hWnd(), 2, 500, NULL); CreateToolTip(); break; } case WM_SHOWWINDOW:{ if(FALSE!=wParam){ //showing UpdateButtons(); } break; } case WM_LBUTTONUP:{ POINT BtnUpPoint = {LOWORD(lParam), HIWORD(lParam)};//.........这里部分代码省略.........
开发者ID:FranEstSol,项目名称:vc-axnp-vlc,代码行数:101,
示例8: CB_Paintstatic void CB_Paint( HWND hwnd, HDC hDC, UINT action ){ RECT rbox, rtext, client; HBRUSH hBrush; int delta; UINT dtFlags; HFONT hFont; LONG state = get_button_state( hwnd ); LONG style = GetWindowLongW( hwnd, GWL_STYLE ); HWND parent; if (style & BS_PUSHLIKE) { PB_Paint( hwnd, hDC, action ); return; } GetClientRect(hwnd, &client); rbox = rtext = client; if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont ); parent = GetParent(hwnd); if (!parent) parent = hwnd; hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)hwnd); if (!hBrush) /* did the app forget to call defwindowproc ? */ hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)hwnd ); setup_clipping( hwnd, hDC ); if (style & BS_LEFTTEXT) { /* magic +4 is what CTL3D expects */ rtext.right -= checkBoxWidth + 4; rbox.left = rbox.right - checkBoxWidth; } else { rtext.left += checkBoxWidth + 4; rbox.right = checkBoxWidth; } /* Since WM_ERASEBKGND does nothing, first prepare background */ if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush ); if (action == ODA_DRAWENTIRE) FillRect( hDC, &client, hBrush ); /* Draw label */ client = rtext; dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &rtext); /* Only adjust rbox when rtext is valid */ if (dtFlags != (UINT)-1L) { rbox.top = rtext.top; rbox.bottom = rtext.bottom; } /* Draw the check-box bitmap */ if (action == ODA_DRAWENTIRE || action == ODA_SELECT) { UINT flags; if ((get_button_type(style) == BS_RADIOBUTTON) || (get_button_type(style) == BS_AUTORADIOBUTTON)) flags = DFCS_BUTTONRADIO; else if (state & BUTTON_3STATE) flags = DFCS_BUTTON3STATE; else flags = DFCS_BUTTONCHECK; if (state & (BUTTON_CHECKED | BUTTON_3STATE)) flags |= DFCS_CHECKED; if (state & BUTTON_HIGHLIGHTED) flags |= DFCS_PUSHED; if (style & WS_DISABLED) flags |= DFCS_INACTIVE; /* rbox must have the correct height */ delta = rbox.bottom - rbox.top - checkBoxHeight; if (style & BS_TOP) { if (delta > 0) { rbox.bottom = rbox.top + checkBoxHeight; } else { rbox.top -= -delta/2 + 1; rbox.bottom = rbox.top + checkBoxHeight; } } else if (style & BS_BOTTOM) { if (delta > 0) { rbox.top = rbox.bottom - checkBoxHeight; } else { rbox.bottom += -delta/2 + 1; rbox.top = rbox.bottom - checkBoxHeight; } } else { /* Default */ if (delta > 0) { int ofs = (delta / 2); rbox.bottom -= ofs + 1; rbox.top = rbox.bottom - checkBoxHeight; } else if (delta < 0) { int ofs = (-delta / 2); rbox.top -= ofs + 1; rbox.bottom = rbox.top + checkBoxHeight;//.........这里部分代码省略.........
开发者ID:bilboed,项目名称:wine,代码行数:101,
示例9: GetClientRectHRESULT BaseApp::createDeviceResources(HWND hWnd){ HRESULT hr = S_OK; RECT rc; GetClientRect(hWnd, &rc); D2D1_SIZE_U size = D2D1::SizeU( rc.right - rc.left, rc.bottom - rc.top ); hr = d2dFactory->CreateHwndRenderTarget( D2D1::RenderTargetProperties(), D2D1::HwndRenderTargetProperties(hWnd, size), &renderingTarget ); size_t index{ 0 }; // Brushes for (auto color : brushColor) { solidBrushes.push_back(NULL); hr = renderingTarget->CreateSolidColorBrush( color, &solidBrushes.at(index)); ++index; } // Text formats // Pasing in Font, font-size index = 0; for (auto font : fonts) { for (auto fontSize : fontSizes) { textFormats.push_back(NULL); hr = d2dDWriteFactory->CreateTextFormat( TUtils::toWSString(font).c_str(), NULL, DWRITE_FONT_WEIGHT_REGULAR, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, fontSize, L"en-us", &textFormats.at(index) ); // Center align (horizontally) the text. if (SUCCEEDED(hr)) { hr = textFormats.at(index)->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING); hr = textFormats.at(index)->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR); } ++index; } } //// Bitmaps IWICBitmapDecoder* wicBitmapDecoder = NULL; IWICFormatConverter* wicFormatConverter = NULL; IWICBitmapFrameDecode* wicBitmapFrameDecode = NULL; index = 0; for (auto spriteSheetFile : spriteSheetFiles) { hr = wicImaingFactory->CreateDecoderFromFilename( TUtils::toWSString(spriteSheetFile).c_str(), NULL, GENERIC_READ, WICDecodeMetadataCacheOnLoad, &wicBitmapDecoder); hr = wicImaingFactory->CreateFormatConverter(&wicFormatConverter); hr = wicBitmapDecoder->GetFrame(0, &wicBitmapFrameDecode); hr = wicFormatConverter->Initialize( wicBitmapFrameDecode, GUID_WICPixelFormat32bppPBGRA, WICBitmapDitherTypeNone, NULL, 0.f, WICBitmapPaletteTypeMedianCut ); spriteSheets.push_back(NULL); hr = renderingTarget->CreateBitmapFromWicBitmap( wicFormatConverter, NULL, &spriteSheets.at(index) ); ++index; } return hr;}
开发者ID:tomnoiprasit,项目名称:GameProject1,代码行数:99,
示例10: PB_Paint/********************************************************************** * Push Button Functions */static void PB_Paint( HWND hwnd, HDC hDC, UINT action ){ RECT rc, focus_rect, r; UINT dtFlags, uState; HPEN hOldPen; HBRUSH hOldBrush; INT oldBkMode; COLORREF oldTxtColor; HFONT hFont; LONG state = get_button_state( hwnd ); LONG style = GetWindowLongW( hwnd, GWL_STYLE ); BOOL pushedState = (state & BUTTON_HIGHLIGHTED); HWND parent; GetClientRect( hwnd, &rc ); /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */ if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont ); parent = GetParent(hwnd); if (!parent) parent = hwnd; SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd ); setup_clipping( hwnd, hDC ); hOldPen = SelectObject(hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME)); hOldBrush = SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE)); oldBkMode = SetBkMode(hDC, TRANSPARENT); if (get_button_type(style) == BS_DEFPUSHBUTTON) { if (action != ODA_FOCUS) Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); InflateRect( &rc, -1, -1 ); } focus_rect = rc; /* completely skip the drawing if only focus has changed */ if (action == ODA_FOCUS) goto draw_focus; uState = DFCS_BUTTONPUSH | DFCS_ADJUSTRECT; if (style & BS_FLAT) uState |= DFCS_MONO; else if (pushedState) { if (get_button_type(style) == BS_DEFPUSHBUTTON ) uState |= DFCS_FLAT; else uState |= DFCS_PUSHED; } if (state & (BUTTON_CHECKED | BUTTON_3STATE)) uState |= DFCS_CHECKED; DrawFrameControl( hDC, &rc, DFC_BUTTON, uState ); /* draw button label */ r = rc; dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &r); if (dtFlags == (UINT)-1L) goto cleanup; if (pushedState) OffsetRect(&r, 1, 1); IntersectClipRect(hDC, rc.left, rc.top, rc.right, rc.bottom); oldTxtColor = SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) ); BUTTON_DrawLabel(hwnd, hDC, dtFlags, &r); SetTextColor( hDC, oldTxtColor );draw_focus: if ((action == ODA_FOCUS) || ((action == ODA_DRAWENTIRE) && (state & BUTTON_HASFOCUS))) { InflateRect( &focus_rect, -1, -1 ); IntersectRect(&focus_rect, &focus_rect, &rc); DrawFocusRect( hDC, &focus_rect ); } cleanup: SelectObject( hDC, hOldPen ); SelectObject( hDC, hOldBrush ); SetBkMode(hDC, oldBkMode);}
开发者ID:bilboed,项目名称:wine,代码行数:92,
示例11: ButtonWndProc_common/*********************************************************************** * ButtonWndProc_common */LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode ){ RECT rect; POINT pt; LONG style = GetWindowLongW( hWnd, GWL_STYLE ); UINT btn_type = get_button_type( style ); LONG state; HANDLE oldHbitmap; if (!IsWindow( hWnd )) return 0; pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam); switch (uMsg) { case WM_GETDLGCODE: switch(btn_type) { case BS_USERBUTTON: case BS_PUSHBUTTON: return DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON; case BS_DEFPUSHBUTTON: return DLGC_BUTTON | DLGC_DEFPUSHBUTTON; case BS_RADIOBUTTON: case BS_AUTORADIOBUTTON: return DLGC_BUTTON | DLGC_RADIOBUTTON; case BS_GROUPBOX: return DLGC_STATIC; default: return DLGC_BUTTON; } case WM_ENABLE: paint_button( hWnd, btn_type, ODA_DRAWENTIRE ); break; case WM_CREATE: if (!hbitmapCheckBoxes) { BITMAP bmp; hbitmapCheckBoxes = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_CHECKBOXES)); GetObjectW( hbitmapCheckBoxes, sizeof(bmp), &bmp ); checkBoxWidth = bmp.bmWidth / 4; checkBoxHeight = bmp.bmHeight / 3; } if (btn_type >= MAX_BTN_TYPE) return -1; /* abort */ /* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */ if (btn_type == BS_USERBUTTON ) { style = (style & ~0x0f) | BS_PUSHBUTTON; WIN_SetStyle( hWnd, style, 0x0f & ~style ); } set_button_state( hWnd, BUTTON_UNCHECKED ); return 0; case WM_ERASEBKGND: if (btn_type == BS_OWNERDRAW) { HDC hdc = (HDC)wParam; RECT rc; HBRUSH hBrush; HWND parent = GetParent(hWnd); if (!parent) parent = hWnd; hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hdc, (LPARAM)hWnd); if (!hBrush) /* did the app forget to call defwindowproc ? */ hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN, (WPARAM)hdc, (LPARAM)hWnd); GetClientRect(hWnd, &rc); FillRect(hdc, &rc, hBrush); } return 1; case WM_PRINTCLIENT: case WM_PAINT: if (btnPaintFunc[btn_type]) { PAINTSTRUCT ps; HDC hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps ); int nOldMode = SetBkMode( hdc, OPAQUE ); (btnPaintFunc[btn_type])( hWnd, hdc, ODA_DRAWENTIRE ); SetBkMode(hdc, nOldMode); /* reset painting mode */ if( !wParam ) EndPaint( hWnd, &ps ); } break; case WM_KEYDOWN: if (wParam == VK_SPACE) { SendMessageW( hWnd, BM_SETSTATE, TRUE, 0 ); set_button_state( hWnd, get_button_state( hWnd ) | BUTTON_BTNPRESSED ); SetCapture( hWnd ); } break; case WM_LBUTTONDBLCLK: if(style & BS_NOTIFY || btn_type == BS_RADIOBUTTON || btn_type == BS_USERBUTTON || btn_type == BS_OWNERDRAW)//.........这里部分代码省略.........
开发者ID:bilboed,项目名称:wine,代码行数:101,
示例12: GetClientRect//Yeah this truly turned into a mess with the latest additions.. but it sure looks nice ;)void CtrlRegisterList::onPaint(WPARAM wParam, LPARAM lParam){ if (!cpu) return; GetClientRect(wnd, &rect); PAINTSTRUCT ps; HDC hdc; hdc = BeginPaint(wnd, &ps); // TODO: Add any drawing code here... int width = rect.right; //numRows=(numRows&(~1)) + 1; SetBkMode(hdc, TRANSPARENT); DWORD bgColor = 0xffffff; HPEN nullPen=CreatePen(0,0,bgColor); HPEN currentPen=CreatePen(0,0,0); HPEN selPen=CreatePen(0,0,0x808080); LOGBRUSH lbr; lbr.lbHatch=0; lbr.lbStyle=0; lbr.lbColor=bgColor; HBRUSH nullBrush=CreateBrushIndirect(&lbr); lbr.lbColor=0xFFEfE8; HBRUSH currentBrush=CreateBrushIndirect(&lbr); lbr.lbColor=0x70FF70; HBRUSH pcBrush=CreateBrushIndirect(&lbr); HPEN oldPen=(HPEN)SelectObject(hdc,nullPen); HBRUSH oldBrush=(HBRUSH)SelectObject(hdc,nullBrush); HFONT oldFont = (HFONT)SelectObject(hdc,(HGDIOBJ)font);// HICON breakPoint = (HICON)LoadIcon(GetModuleHandle(0),(LPCSTR)IDI_STOP);// HICON breakPointDisable = (HICON)LoadIcon(GetModuleHandle(0),(LPCSTR)IDI_STOPDISABLE); int nc = cpu->GetNumCategories(); for (int i=0; i<nc; i++) { SelectObject(hdc,i==category?currentPen:nullPen); SelectObject(hdc,i==category?pcBrush:nullBrush); Rectangle(hdc,width*i/nc,0,width*(i+1)/nc,rowHeight); const TCHAR *name = cpu->GetCategoryName(i); TextOut(hdc,width*i/nc,1,name,(int)strlen(name)); } int numRows=rect.bottom/rowHeight; for (int i=0; i<numRows; i++) { int rowY1 = rowHeight*(i+1); int rowY2 = rowHeight*(i+2); lbr.lbColor = i==selection?0xffeee0:0xffffff; SelectObject(hdc,currentBrush); SelectObject(hdc,nullPen); Rectangle(hdc,0,rowY1,16,rowY2); if (selecting && i == selection) SelectObject(hdc,selPen); else SelectObject(hdc,nullPen); HBRUSH mojsBrush=CreateBrushIndirect(&lbr); SelectObject(hdc,mojsBrush); //else // SelectObject(hdc,i==0 ? currentBrush : nullBrush); Rectangle(hdc,16,rowY1,width,rowY2); // Check for any changes in the registers. if (lastPC != cpu->GetPC()) { for (int j = 0, n = cpu->GetNumRegsInCategory(0); j < n; ++j) { u32 v = cpu->GetRegValue(0, j); changedCat0Regs[j] = v != lastCat0Values[j]; lastCat0Values[j] = v; } changedCat0Regs[REGISTER_PC] = cpu->GetPC() != lastCat0Values[REGISTER_PC]; lastCat0Values[REGISTER_PC] = cpu->GetPC(); changedCat0Regs[REGISTER_HI] = cpu->GetHi() != lastCat0Values[REGISTER_HI]; lastCat0Values[REGISTER_HI] = cpu->GetHi(); changedCat0Regs[REGISTER_LO] = cpu->GetLo() != lastCat0Values[REGISTER_LO]; lastCat0Values[REGISTER_LO] = cpu->GetLo(); lastPC = cpu->GetPC(); } SelectObject(hdc,currentBrush); DeleteObject(mojsBrush); if (i<cpu->GetNumRegsInCategory(category)) { char temp[256]; int temp_len = sprintf(temp,"%s",cpu->GetRegName(category,i));//.........这里部分代码省略.........
开发者ID:DonelBueno,项目名称:ppsspp,代码行数:101,
示例13: GetClientRectvoid OpenGLDisplayDevice::do_reposition_window(int xpos, int ypos) { RECT rcClient, rcWindow; GetClientRect(glwsrv.hWnd, &rcClient); GetWindowRect(glwsrv.hWnd, &rcWindow); MoveWindow(glwsrv.hWnd, xpos, ypos, rcWindow.right-rcWindow.left, rcWindow.bottom-rcWindow.top, TRUE);}
开发者ID:tmd-gpat,项目名称:MOLding,代码行数:6,
示例14: winDialogBaseProc//.........这里部分代码省略......... IupHide(ih); /* IUP default processing */ } *result = 0; return 1; } case WM_SETCURSOR: { if (ih->handle == (HWND)wp && LOWORD(lp)==HTCLIENT) { HCURSOR hCur = (HCURSOR)iupAttribGet(ih, "_IUPWIN_HCURSOR"); if (hCur) { SetCursor(hCur); *result = 1; return 1; } else if (iupAttribGet(ih, "CURSOR")) { SetCursor(NULL); *result = 1; return 1; } } break; } case WM_ERASEBKGND: { HBITMAP hBitmap = (HBITMAP)iupAttribGet(ih, "_IUPWIN_BACKGROUND_BITMAP"); if (hBitmap) { RECT rect; HDC hdc = (HDC)wp; HBRUSH hBrush = CreatePatternBrush(hBitmap); GetClientRect(ih->handle, &rect); FillRect(hdc, &rect, hBrush); DeleteObject(hBrush); /* return non zero value */ *result = 1; return 1; } else { unsigned char r, g, b; char* color = iupAttribGet(ih, "_IUPWIN_BACKGROUND_COLOR"); if (iupStrToRGB(color, &r, &g, &b)) { RECT rect; HDC hdc = (HDC)wp; SetDCBrushColor(hdc, RGB(r,g,b)); GetClientRect(ih->handle, &rect); FillRect(hdc, &rect, (HBRUSH)GetStockObject(DC_BRUSH)); /* return non zero value */ *result = 1; return 1; } } break; } case WM_DESTROY: { /* Since WM_CLOSE changed the Windows default processing */ /* WM_DESTROY is NOT received by IupDialogs */ /* Except when they are children of other IupDialogs and the parent is destroyed. */ /* So we have to destroy the child dialog. */ /* The application is responsable for destroying the children before this happen. */ IupDestroy(ih); break; } } if (msg == (UINT)WM_HELPMSG) { Ihandle* child = NULL; DWORD* struct_ptr = (DWORD*)lp; if (*struct_ptr == sizeof(CHOOSECOLOR)) { CHOOSECOLOR* choosecolor = (CHOOSECOLOR*)lp; child = (Ihandle*)choosecolor->lCustData; } if (*struct_ptr == sizeof(CHOOSEFONT)) { CHOOSEFONT* choosefont = (CHOOSEFONT*)lp; child = (Ihandle*)choosefont->lCustData; } if (child) { Icallback cb = IupGetCallback(child, "HELP_CB"); if (cb && cb(child) == IUP_CLOSE) EndDialog((HWND)iupAttribGet(child, "HWND"), IDCANCEL); } } return 0;}
开发者ID:svn2github,项目名称:iup-iup,代码行数:101,
示例15: WndProcstatic LRESULT CALLBACK WndProc(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam){ switch (uMessage) { case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(hwnd, &ps); SetMapMode(ps.hdc, MM_ANISOTROPIC); /* Set the window extent to a sane value in case the metafile doesn't */ SetWindowExtEx(ps.hdc, width, height, NULL); SetViewportExtEx(ps.hdc, width, height, NULL); SetViewportOrgEx(ps.hdc, deltax, deltay, NULL); if (isEnhanced && enhmf) { RECT r; GetClientRect(hwnd, &r); PlayEnhMetaFile(ps.hdc, enhmf, &r); } else if (hmf) PlayMetaFile(ps.hdc, hmf); EndPaint(hwnd, &ps); } break; case WM_COMMAND: /* message: command from application menu */ switch (LOWORD(wparam)) { case IDM_OPEN: { WCHAR filename[MAX_PATH]; if (FileOpen(hwnd, filename, sizeof(filename)/sizeof(WCHAR))) { szFileTitle[0] = 0; GetFileTitleW(filename, szFileTitle, sizeof(szFileTitle)/sizeof(WCHAR)); DoOpenFile(filename); UpdateWindowCaption(); } } break; case IDM_SET_EXT_TO_WIN: { RECT r; GetClientRect(hwnd, &r); width = r.right - r.left; height = r.bottom - r.top; deltax = deltay = 0; InvalidateRect( hwnd, NULL, TRUE ); } break; case IDM_LEFT: deltax += 100; InvalidateRect( hwnd, NULL, TRUE ); break; case IDM_RIGHT: deltax -= 100; InvalidateRect( hwnd, NULL, TRUE ); break; case IDM_UP: deltay += 100; InvalidateRect( hwnd, NULL, TRUE ); break; case IDM_DOWN: deltay -= 100; InvalidateRect( hwnd, NULL, TRUE ); break; case IDM_EXIT: DestroyWindow(hwnd); break; default: return DefWindowProcW(hwnd, uMessage, wparam, lparam); } break; case WM_DESTROY: /* message: window being destroyed */ PostQuitMessage(0); break; default: /* Passes it on if unprocessed */ return DefWindowProcW(hwnd, uMessage, wparam, lparam); } return 0;}
开发者ID:AlexSteel,项目名称:wine,代码行数:88,
示例16: GetClientRectBOOL CPopupList::OnMouseMove(CPoint point){ CRect rcClient; GetClientRect(&rcClient); BOOL bDraw = FALSE; if(rcClient.PtInRect(point)) { int nHoverItem = m_nHoverItem; if(m_nHoverItem != -1) { EditListItem &editListItem = m_vecItem.at(m_nHoverItem); if(editListItem.rcItem.PtInRect(point)) { if((m_pImageClose != NULL) && m_rcClose.PtInRect(point)) { bDraw = m_buttonState != enBSHover; m_buttonState = enBSHover; } else { bDraw = m_buttonState == enBSHover; m_buttonState = enBSNormal; } } else { nHoverItem = -1; bDraw = TRUE; } } if(m_nHoverItem != nHoverItem) { int nItemCount = m_vecItem.size(); for (int i = 0; i < nItemCount; i++) { EditListItem &editListItem = m_vecItem.at(i); if(editListItem.rcItem.PtInRect(point)) { m_nHoverItem = i; bDraw = TRUE; break; } } if(m_nHoverItem != -1) { SetItemPoint(); } if((m_pImageClose != NULL) && m_rcClose.PtInRect(point)) { m_buttonState = enBSHover; } else { m_buttonState = enBSNormal; } bDraw = TRUE; } } else { m_buttonState = enBSNormal; bDraw = TRUE; } return bDraw;}
开发者ID:anchowee,项目名称:DuiVision,代码行数:68,
示例17: WinMainstatic int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { AllocConsole(); //create a console freopen( "conin$","r",stdin ); freopen( "conout$","w",stdout ); freopen( "conout$","w",stderr ); printf( "Program Started, console initialized/n" ); const char WindowName[] = "Wet Clay"; int64 mSecsPerFrame = 16; //60FPS System system = { }; system.windowHeight = 680; system.windowWidth = 1080; system.ReadWholeFile = &ReadWholeFile; system.GetMostRecentMatchingFile = &GetMostRecentMatchingFile; system.TrackFileUpdates = &TrackFileUpdates; system.DidFileUpdate = &DidFileUpdate; system.WriteFile = &WriteFile; system.HasFocus = &HasFocus; //Center position of window uint16 fullScreenWidth = GetSystemMetrics( SM_CXSCREEN ); uint16 fullScreenHeight = GetSystemMetrics( SM_CYSCREEN ); uint16 windowPosX = ( fullScreenWidth / 2 ) - (system.windowWidth / 2 ); uint16 windowPosY = ( fullScreenHeight / 2 ) - (system.windowHeight / 2 ); WNDCLASSEX wc = { }; wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_OWNDC; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = WindowName; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if( !RegisterClassEx( &wc ) ) { printf( "Failed to register class/n" ); return -1; } EnableCrashingOnCrashes(); // at this point WM_CREATE message is sent/received // the WM_CREATE branch inside WinProc function will execute here HWND hwnd = CreateWindowEx( 0, WindowName, "Wet Clay App", WS_BORDER, windowPosX, windowPosY, system.windowWidth, system.windowHeight, NULL, NULL, hInstance, NULL ); RECT windowRect = { }; GetClientRect( hwnd, &windowRect ); SetWindowLong( hwnd, GWL_STYLE, 0 ); ShowWindow ( hwnd, SW_SHOWNORMAL ); UpdateWindow( hwnd ); LARGE_INTEGER timerResolution; BOOL canSupportHiResTimer = QueryPerformanceFrequency( &timerResolution ); assert( canSupportHiResTimer ); size_t systemsMemorySize = MEGABYTES( 8 ); Stack gameSlab; gameSlab.size = SIZEOF_GLOBAL_HEAP + systemsMemorySize; gameSlab.start = VirtualAlloc( NULL, gameSlab.size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE ); gameSlab.current = gameSlab.start; assert( gameSlab.start != NULL ); Stack systemsMemory = AllocateNewStackFromStack( &gameSlab, systemsMemorySize ); InitWin32WorkerThread( &systemsMemory ); GLRendererGlobalState glRendererStorage = { }; globalGLRendererStorageRef = &glRendererStorage; GLRenderDriver glDriver = Win32InitGLRenderer( hwnd, &system, globalGLRendererStorageRef ); Win32Sound win32Sound = Win32InitSound( hwnd, 60, &systemsMemory ); void* imguistate = InitImGui_LimeStone( &systemsMemory, (RenderDriver*)&glDriver, system.windowWidth, system.windowHeight ); printf( "Remaining System Memory: %Id/n", SPACE_IN_STACK( (&gameSlab) ) );//.........这里部分代码省略.........
开发者ID:tgolebiowski,项目名称:LimestoneCode,代码行数:101,
示例18: TRACE//.........这里部分代码省略......... } else { m_parent = NULL; } // Refresh the menubar pointer, if applicable if (m_bandCount >= 1 && m_bandStack[0].type == MenuBarEntry) { m_menuBar = &(m_bandStack[0]); } else { m_menuBar = NULL; } // Remove the old hooks if the menu type changed, or we don't have a menu anymore if (old && (!m_current || old->type != m_current->type)) { if (m_current && m_current->type != TrackedMenuEntry) { DisableMouseTrack(m_current->hwnd, FALSE); } hr = RemoveHooks(); if (FAILED_UNEXPECTEDLY(hr)) return hr; } // And place new ones if necessary if (m_current && (!old || old->type != m_current->type)) { hr = PlaceHooks(); if (FAILED_UNEXPECTEDLY(hr)) return hr; } // Give the user a chance to move the mouse to the new menu if (m_parent) { DisableMouseTrack(m_parent->hwnd, TRUE); } if (m_current && m_current->type == MenuPopupEntry) { if (m_captureHwnd == NULL) { // We need to restore the capture after a non-shell submenu or context menu is shown StackEntry * topMenu = m_bandStack; if (topMenu->type == MenuBarEntry) topMenu++; // Get the top-level window from the top popup CComPtr<IServiceProvider> bandSite; CComPtr<IOleWindow> deskBar; hr = topMenu->mb->GetSite(IID_PPV_ARG(IServiceProvider, &bandSite)); hr = bandSite->QueryService(SID_SMenuPopup, IID_PPV_ARG(IOleWindow, &deskBar)); CComPtr<IOleWindow> deskBarSite; hr = IUnknown_GetSite(deskBar, IID_PPV_ARG(IOleWindow, &deskBarSite)); // FIXME: Find the correct place for this HWND hWndOwner; deskBarSite->GetWindow(&hWndOwner); m_PreviousForeground = ::GetForegroundWindow(); if (m_PreviousForeground != hWndOwner) ::SetForegroundWindow(hWndOwner); else m_PreviousForeground = NULL; // Get the HWND of the top-level window HWND hWndSite; hr = deskBar->GetWindow(&hWndSite); SetMenuCapture(hWndSite); } if (!m_parent || m_parent->type == MenuBarEntry) { if (old && old->type == TrackedMenuEntry) { // FIXME: Debugging code, probably not right POINT pt2; RECT rc2; GetCursorPos(&pt2); ScreenToClient(m_current->hwnd, &pt2); GetClientRect(m_current->hwnd, &rc2); if (PtInRect(&rc2, pt2)) SendMessage(m_current->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(pt2.x, pt2.y)); else SendMessage(m_current->hwnd, WM_MOUSELEAVE, 0, 0); } } } _ASSERT(!m_parent || m_parent->type != TrackedMenuEntry); return S_OK;}
开发者ID:CSRedRat,项目名称:reactos-playground,代码行数:101,
示例19: win_procstatic u32 win_proc(MSG *pMsg){ HWND hwnd; HDC hdc; RECT rc,rc0; u32 i; hwnd =pMsg->hwnd; switch(pMsg->Code) { case MSG_CREATE: GetClientRect(hwnd,&rc0); CreateWindow(BUTTON,"关闭",WS_CHILD|BS_NORMAL|WS_BORDER|WS_VISIBLE,RectW(&rc0)-64,RectH(&rc0)-28,60,24,hwnd,ID_CLOSE,NULL); SetRect(&rc,4,8,120,100); hwndLB1=CreateWindow(LISTBOX,"列表框1",WS_CHILD|WS_BORDER|WS_VISIBLE,rc.left,rc.top,RectW(&rc),RectH(&rc),hwnd,ID_LISTBOX1,NULL); OffsetRect(&rc,RectW(&rc)+8,0); hwndLB2=CreateWindow(LISTBOX,"列表框2",WS_CHILD|WS_BORDER|WS_VISIBLE,rc.left,rc.top,RectW(&rc),RectH(&rc),hwnd,ID_LISTBOX2,NULL); GetWindowRect(hwndLB1,&rc); OffsetRect(&rc,0,RectH(&rc)+4); ScreenToClient(hwnd,(POINT*)&rc,2); CreateWindow(BUTTON,"-->",WS_CHILD|BS_NORMAL|WS_BORDER|WS_VISIBLE,rc.right-50,rc.top,50,20,hwnd,ID_RIGHT,NULL); GetWindowRect(hwndLB2,&rc); OffsetRect(&rc,0,RectH(&rc)+4); ScreenToClient(hwnd,(POINT*)&rc,2); CreateWindow(BUTTON,"<--",WS_CHILD|BS_NORMAL|WS_BORDER|WS_VISIBLE,rc.left,rc.top,50,20,hwnd,ID_LEFT,NULL); SendMessage(hwndLB1,LBM_ADDSTRING,0,(u32)"ListItem-0"); SendMessage(hwndLB1,LBM_ADDSTRING,1,(u32)"ListItem-1"); SendMessage(hwndLB1,LBM_ADDSTRING,2,(u32)"ListItem-2"); SendMessage(hwndLB1,LBM_ADDSTRING,3,(u32)"ListItem-3"); SendMessage(hwndLB1,LBM_ADDSTRING,4,(u32)"ListItem-4"); SendMessage(hwndLB1,LBM_ADDSTRING,5,(u32)"ListItem-5"); SendMessage(hwndLB1,LBM_ADDSTRING,6,(u32)"ListItem-6"); SendMessage(hwndLB1,LBM_ADDSTRING,7,(u32)"ListItem-7"); SendMessage(hwndLB1,LBM_ADDSTRING,8,(u32)"ListItem-8"); SendMessage(hwndLB1,LBM_ADDSTRING,9,(u32)"ListItem-9"); SendMessage(hwndLB1,LBM_SETTOPINDEX,0,0); SendMessage(hwndLB1,LBM_SETCURSEL,3,0); SendMessage(hwndLB2,LBM_ADDSTRING,0,(u32)"ListItem-10"); SendMessage(hwndLB2,LBM_ADDSTRING,1,(u32)"ListItem-11"); SendMessage(hwndLB2,LBM_ADDSTRING,2,(u32)"ListItem-12"); SendMessage(hwndLB2,LBM_ADDSTRING,3,(u32)"ListItem-13"); SendMessage(hwndLB2,LBM_ADDSTRING,4,(u32)"ListItem-14"); SendMessage(hwndLB2,LBM_ADDSTRING,5,(u32)"ListItem-15"); SendMessage(hwndLB2,LBM_ADDSTRING,6,(u32)"ListItem-16"); SendMessage(hwndLB2,LBM_ADDSTRING,7,(u32)"ListItem-17"); SendMessage(hwndLB2,LBM_ADDSTRING,8,(u32)"ListItem-18"); SendMessage(hwndLB2,LBM_ADDSTRING,9,(u32)"ListItem-19"); SendMessage(hwndLB2,LBM_SETTOPINDEX,0,0); SendMessage(hwndLB2,LBM_SETCURSEL,3,0); GDD_CreateTimer(hwnd,1,3000,TMR_START); GDD_CreateTimer(hwnd,2,100,TMR_START); break; //// case MSG_TIMER: { switch(pMsg->Param1) { case 1: { } break; ///// case 2: { } break; ///// } } break; case MSG_NOTIFY: { u16 event,id; event =HI16(pMsg->Param1); id =LO16(pMsg->Param1); if(event==BTN_UP && id==ID_CLOSE) { PostMessage(hwnd,MSG_CLOSE,0,0); }//// if(event==BTN_UP && id==ID_RIGHT) { char *buf;//.........这里部分代码省略.........
开发者ID:jiankangshiye,项目名称:DJYOS,代码行数:101,
示例20: InitUserGroupsListstatic VOIDInitUserGroupsList(HWND hwndDlg){ HWND hwndLV; LV_COLUMN column; RECT rect; TCHAR szStr[32]; NET_API_STATUS netStatus; PLOCALGROUP_INFO_1 pBuffer; DWORD entriesread; DWORD totalentries; DWORD_PTR resume_handle = 0; DWORD i; LV_ITEM lvi; INT iItem; HIMAGELIST hImgList; HICON hIcon; hwndLV = GetDlgItem(hwndDlg, IDC_USER_ADD_MEMBERSHIP_LIST); GetClientRect(hwndLV, &rect); hImgList = ImageList_Create(16,16,ILC_COLOR8 | ILC_MASK,5,5); hIcon = LoadImage(hApplet,MAKEINTRESOURCE(IDI_GROUP),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); ImageList_AddIcon(hImgList,hIcon); DestroyIcon(hIcon); (void)ListView_SetImageList(hwndLV, hImgList, LVSIL_SMALL); (void)ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); memset(&column, 0x00, sizeof(column)); column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT; column.fmt = LVCFMT_LEFT; column.cx = (INT)((rect.right - rect.left) * 0.40); column.iSubItem = 0; LoadString(hApplet, IDS_NAME, szStr, sizeof(szStr) / sizeof(szStr[0])); column.pszText = szStr; (void)ListView_InsertColumn(hwndLV, 0, &column); column.cx = (INT)((rect.right - rect.left) * 0.60); column.iSubItem = 1; LoadString(hApplet, IDS_DESCRIPTION, szStr, sizeof(szStr) / sizeof(szStr[0])); column.pszText = szStr; (void)ListView_InsertColumn(hwndLV, 1, &column); for (;;) { netStatus = NetLocalGroupEnum(NULL, 1, (LPBYTE*)&pBuffer, 1024, &entriesread, &totalentries, &resume_handle); if (netStatus != NERR_Success && netStatus != ERROR_MORE_DATA) break; for (i = 0; i < entriesread; i++) { memset(&lvi, 0x00, sizeof(lvi)); lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; lvi.pszText = pBuffer[i].lgrpi1_name; lvi.state = 0; lvi.iImage = 0; iItem = ListView_InsertItem(hwndLV, &lvi); ListView_SetItemText(hwndLV, iItem, 1, pBuffer[i].lgrpi1_comment); } NetApiBufferFree(pBuffer); /* No more data left */ if (netStatus != ERROR_MORE_DATA) break; }}
开发者ID:GYGit,项目名称:reactos,代码行数:74,
示例21: GetWindowRect// Все параметры могут быть NULL - вызов из GuiMacrobool CConEmuCtrl::key_ShowTabsList(DWORD VkMod, bool TestOnly, const ConEmuHotKey* hk, CRealConsole* pRCon){ // 120820 - не будем требовать наличия плагина для F12 в Far if (pRCon && pRCon->GetFarPID(false)) { // Для Far Manager - не обрабатывать. // Если юзеру нужно ConEmu-шное меню для списка табов - есть vkShowTabsList2 и GuiMacro "Tabs(8)" return false; } else { if (TestOnly) return true; //HMENU hPopup = gpConEmu->CreateVConListPopupMenu(NULL, FALSE); RECT rcWnd = {}; if (pRCon) { GetWindowRect(pRCon->GetView(), &rcWnd); } else { GetClientRect(ghWnd, &rcWnd); MapWindowPoints(ghWnd, NULL, (LPPOINT)&rcWnd, 2); } POINT pt = {(rcWnd.left+rcWnd.right)/2, (rcWnd.top+rcWnd.bottom)/2}; ChooseTabFromMenu(FALSE, pt, TPM_CENTERALIGN|TPM_VCENTERALIGN); //int nTab = gpConEmu->trackPopupMenu(tmp_TabsList, hPopup, TPM_CENTERALIGN|TPM_VCENTERALIGN|TPM_RETURNCMD, // x, y, 0, ghWnd, NULL); //if (nTab >= IDM_VCON_FIRST && nTab <= IDM_VCON_LAST) //{ // int nNewV = ((int)HIWORD(nTab))-1; // int nNewR = ((int)LOWORD(nTab))-1; // // CVirtualConsole* pVCon = gpConEmu->GetVCon(nNewV); // if (pVCon) // { // CRealConsole* pRCon = pVCon->RCon(); // if (pRCon) // { // pRCon->ActivateFarWindow(nNewR); // } // if (!gpConEmu->isActive(pVCon)) // gpConEmu->Activate(pVCon); // } //} //CESERVER_REQ_GETALLTABS::TabInfo* pTabs = NULL; //int Count = (int)CConEmuCtrl::GetOpenedTabs(pTabs); //if ((Count < 1) || !pTabs) //{ // SafeFree(pTabs); // return false; //} //WARNING("должна быть подобная функция для DropDown у тулбара"); //HMENU hPopup = CreatePopupMenu(); //int nLastConsole = 0; //for (int i = 0, k = 0; i < Count; i++, k++) //{ // if (nLastConsole != pTabs[i].ConsoleIdx) // { // AppendMenu(hPopup, MIF_SEPARATOR, 0, NULL); // nLastConsole = pTabs[i].ConsoleIdx; // } // DWORD nFlags = 0 // | (pTabs[i].Disabled ? (MF_GRAYED|MF_DISABLED) : MF_ENABLED) // | // pItems[k].Selected = (pOut->GetAllTabs.Tabs[i].ActiveConsole && pOut->GetAllTabs.Tabs[i].ActiveTab); // pItems[k].Checked = pOut->GetAllTabs.Tabs[i].ActiveTab; // pItems[k].Disabled = pOut->GetAllTabs.Tabs[i].Disabled; // pItems[k].MsgText = pOut->GetAllTabs.Tabs[i].Title; // pItems[k].UserData = i; //} //DestroyMenu(hPopup); } //int AllCount = Count + pTabs[Count-1].ConsoleIdx; //if (pItems) //{ //} return true;}
开发者ID:alexlav,项目名称:conemu,代码行数:90,
示例22: StartMenu/*------------------------------------------------ paint StartMenu (BaseBar) of IE 4 or later--------------------------------------------------*/void OnPaintStartmenuIE4(HWND hwnd, HDC hdc, BOOL bPrint){ RECT rc, rcWin, rcChild; POINT pt; COLORREF col; HBRUSH hbr; BITMAP bmp; int hClient, wClient; GetWindowRect(GetWindow(hwnd, GW_CHILD), &rcChild); GetWindowRect(hwnd, &rcWin); GetClientRect(hwnd, &rc); pt.x = 0; pt.y = 0; ClientToScreen(hwnd, &pt); if(pt.x == rcChild.left) return; rc.right = 21; wClient = rc.right; hClient = rc.bottom; if(bPrint) { int dx, dy; dx = pt.x - rcWin.left; dy = pt.y - rcWin.top; rc.left += dx; rc.right += dx; rc.top += dy; rc.bottom += dy; } // fill with color col = m_colMenu; if(col & 0x80000000) col = GetSysColor(col & 0x00ffffff); hbr = CreateSolidBrush(col); FillRect(hdc, &rc, hbr); DeleteObject(hbr); // draw bitmap if(m_hbmpMenu) { int i, j; GetObject(m_hbmpMenu, sizeof(BITMAP), &bmp); for(i = 0; ; i++) { int y, ysrc, h, x, w; for(j = 0; ; j++) { y = hClient - ((i + 1) * bmp.bmHeight); ysrc = 0; h = bmp.bmHeight; if(y < 0) { y = 0; ysrc = ((i + 1) * bmp.bmHeight) - hClient; h -= ysrc; } x = j * bmp.bmWidth; w = bmp.bmWidth; if(x + w > wClient) { w -= ((j + 1) * bmp.bmWidth) - wClient; } if(w > 0 && h > 0) BitBlt(hdc, rc.left + x, rc.top + y, w, h, m_hdcMemMenu, 0, ysrc, SRCCOPY); if(!m_bTile || w < bmp.bmWidth) break; } if(!m_bTile || y == 0) break; } }}
开发者ID:k-takata,项目名称:TClockLight,代码行数:70,
示例23: HandleGLSceneUpdatevoid HandleGLSceneUpdate(HDC hDC){ if(!bTargetAcquired && hdcAcquiredDC == NULL) { logOutput << CurrentTimeString() << "setting up gl data" << endl; PIXELFORMATDESCRIPTOR pfd; hwndTarget = WindowFromDC(hDC); int pixFormat = GetPixelFormat(hDC); DescribePixelFormat(hDC, pixFormat, sizeof(pfd), &pfd); if(pfd.cColorBits == 32 && hwndTarget) { bTargetAcquired = true; hdcAcquiredDC = hDC; glcaptureInfo.format = GS_BGR; } OSInitializeTimer(); } if(hDC == hdcAcquiredDC) { if(bCapturing && WaitForSingleObject(hSignalEnd, 0) == WAIT_OBJECT_0) bStopRequested = true; if(bCapturing && !IsWindow(hwndOBS)) { hwndOBS = NULL; bStopRequested = true; } if(bCapturing && bStopRequested) { RUNEVERYRESET logOutput << CurrentTimeString() << "stop requested, terminating gl capture" << endl; ClearGLData(); bCapturing = false; bStopRequested = false; bReacquiring = false; } if(!bCapturing && WaitForSingleObject(hSignalRestart, 0) == WAIT_OBJECT_0) { hwndOBS = FindWindow(OBS_WINDOW_CLASS, NULL); if(hwndOBS) bCapturing = true; } RECT rc; GetClientRect(hwndTarget, &rc); if(bCapturing && bReacquiring) { if(lastCX != rc.right || lastCY != rc.bottom) //reset if continuing to size within the 3 seconds { reacquireStart = OSGetTimeMicroseconds(); lastCX = rc.right; lastCY = rc.bottom; } if(OSGetTimeMicroseconds()-reacquireTime >= 3000000) { //3 second to reacquire RUNEVERYRESET logOutput << CurrentTimeString() << "reacquiring gl due to resize..." << endl; bReacquiring = false; } else { return; } } if(bCapturing && (!bHasTextures || rc.right != glcaptureInfo.cx || rc.bottom != glcaptureInfo.cy)) { if (!rc.right || !rc.bottom) return; if(bHasTextures) //resizing { ClearGLData(); bReacquiring = true; reacquireStart = OSGetTimeMicroseconds(); lastCX = rc.right; lastCY = rc.bottom; return; } else { if(hwndOBS) DoGLCPUHook(rc); else ClearGLData(); } } LONGLONG timeVal = OSGetTimeMicroseconds(); //check keep alive state, dumb but effective if(bCapturing) { if (!keepAliveTime) keepAliveTime = timeVal;//.........这里部分代码省略.........
开发者ID:AaronMike,项目名称:OBS,代码行数:101,
示例24: WndProcstatic LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ switch (message){ case WM_DESTROY: PostQuitMessage(0); return 0; case WM_CLOSE: mplayer_put_key(KEY_CLOSE_WIN); break; case WM_WINDOWPOSCHANGED: { int tmpheight=0; /*calculate new window rect*/ if(!vo_fs){ RECT rd; POINT point_window; if(!hWnd)hWnd=hwnd; ShowCursor(TRUE); point_window.x = 0; point_window.y = 0; ClientToScreen(hWnd,&point_window); GetClientRect(hWnd,&rd); vo_dwidth=rd.right - rd.left; vo_dheight=rd.bottom - rd.top; vo_dx =point_window.x; vo_dy =point_window.y; // aspect(&vo_dwidth, &vo_dheight, A_NOZOOM); /* keep aspect on resize, borrowed from vo_directx.c */ tmpheight = ((float)vo_dwidth/window_aspect); tmpheight += tmpheight % 2; if(tmpheight > vo_dheight) { vo_dwidth = ((float)vo_dheight*window_aspect); vo_dwidth += vo_dwidth % 2; } else vo_dheight = tmpheight; rd.right = rd.left + vo_dwidth; rd.bottom = rd.top + vo_dheight; if(rd.left < 0) rd.left = 0; if(rd.right > vo_screenwidth) rd.right = vo_screenwidth; if(rd.top < 0) rd.top = 0; if(rd.bottom > vo_screenheight) rd.bottom = vo_screenheight; AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0); SetWindowPos(hWnd, HWND_TOPMOST, vo_dx+rd.left, vo_dy+rd.top, rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER); } else { if(ShowCursor(FALSE)>=0)while(ShowCursor(FALSE)>=0){} aspect(&vo_dwidth, &vo_dheight, A_ZOOM); vo_dx = (vo_screenwidth - vo_dwidth)/2; vo_dy = (vo_screenheight - vo_dheight)/2; } /*update vidix*/ /* FIXME: implement runtime resize/move if possible, this way is very ugly! */ vidix_stop(); if(vidix_init(image_width, image_height, vo_dx, vo_dy, vo_dwidth, vo_dheight, image_format, vo_depthonscreen, vo_screenwidth, vo_screenheight) != 0) mp_msg(MSGT_VO, MSGL_FATAL, "Can't initialize VIDIX driver: %s/n", strerror(errno)); /*set colorkey*/ vidix_start(); mp_msg(MSGT_VO, MSGL_V, "[winvidix] window properties: pos: %dx%d, size: %dx%d/n",vo_dx, vo_dy, vo_dwidth, vo_dheight); if(vidix_grkey_support()){ vidix_grkey_get(&gr_key); gr_key.key_op = KEYS_PUT; gr_key.ckey.op = CKEY_TRUE; if(vo_fs)gr_key.ckey.red = gr_key.ckey.green = gr_key.ckey.blue = 0; else { gr_key.ckey.red = gr_key.ckey.blue = 255; gr_key.ckey.green = 0; } vidix_grkey_set(&gr_key); } } break; case WM_SYSCOMMAND: switch (wParam){ case SC_SCREENSAVE: case SC_MONITORPOWER: return 0; } break; case WM_KEYDOWN: switch (wParam){ case VK_LEFT: {mplayer_put_key(KEY_LEFT);break;} case VK_UP: {mplayer_put_key(KEY_UP);break;} case VK_RIGHT: {mplayer_put_key(KEY_RIGHT);break;} case VK_DOWN: {mplayer_put_key(KEY_DOWN);break;} case VK_TAB: {mplayer_put_key(KEY_TAB);break;} case VK_CONTROL: {mplayer_put_key(KEY_CTRL);break;} case VK_DELETE: {mplayer_put_key(KEY_DELETE);break;}//.........这里部分代码省略.........
开发者ID:Gamer125,项目名称:wiibrowser,代码行数:101,
示例25: Button_WndProc//.........这里部分代码省略......... break; case WM_SYSKEYUP: if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == _totlower((TCHAR)wParam)) { if (bct->dwStyle & MBS_PUSHBUTTON) { if (bct->pbState) bct->pbState = 0; else bct->pbState = 1; InvalidateRect(bct->hwnd, NULL, TRUE); } else SetFocus(hwndBtn); SendMessage(GetParent(hwndBtn), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndBtn), BN_CLICKED), (LPARAM)hwndBtn); return 0; } break; case WM_THEMECHANGED: // themed changed, reload theme object LoadTheme(bct); InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it break; case WM_SETFONT: // remember the font so we can use it later bct->hFont = (HFONT)wParam; // maybe we should redraw? break; case WM_NCPAINT: case WM_PAINT: { PAINTSTRUCT ps; HDC hdcPaint; HDC hdcMem; HBITMAP hbmMem; HDC hOld; RECT rcClient; if (hdcPaint = BeginPaint(hwndBtn, &ps)) { GetClientRect(bct->hwnd, &rcClient); hdcMem = CreateCompatibleDC(hdcPaint); hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top); hOld = (HDC)SelectObject(hdcMem, hbmMem); // If its a push button, check to see if it should stay pressed if ((bct->dwStyle & MBS_PUSHBUTTON) && bct->pbState) bct->stateId = PBS_PRESSED; if ((bct->dwStyle & MBS_FLAT) && bct->hThemeToolbar || bct->hThemeButton) PaintThemeButton(bct, hdcMem, &rcClient); else PaintButton(bct, hdcMem, &rcClient); BitBlt(hdcPaint, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hdcMem, 0, 0, SRCCOPY); SelectObject(hdcMem, hOld); DeleteObject(hbmMem); DeleteDC(hdcMem); EndPaint(hwndBtn, &ps); } } return 0; case BM_SETIMAGE: if (wParam == IMAGE_ICON) { bct->hIcon = (HICON)lParam; bct->hBitmap = NULL; InvalidateRect(bct->hwnd, NULL, TRUE); } else if (wParam == IMAGE_BITMAP) { bct->hIcon = NULL; bct->hBitmap = (HBITMAP)lParam; InvalidateRect(bct->hwnd, NULL, TRUE); } else if (wParam == NULL && lParam == NULL) {
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:67,
注:本文中的GetClientRect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetClientSize函数代码示例 C++ GetClientObject函数代码示例 |