这篇教程C++ GetCursorPos函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetCursorPos函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCursorPos函数的具体用法?C++ GetCursorPos怎么用?C++ GetCursorPos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetCursorPos函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ReleaseCapture//鼠标消息VOID CPasswordKeyboard::OnLButtonUp(UINT nFlags, CPoint Point){ __super::OnLButtonUp(nFlags,Point); //取消捕获 if (m_bMouseDown==true) { //取消捕获 ReleaseCapture(); //设置变量 m_bMouseDown=false; //获取光标 CPoint MousePoint; GetCursorPos(&MousePoint); ScreenToClient(&MousePoint); //更新位置 WORD wHoverRow=m_wHoverRow; WORD wHoverLine=m_wHoverLine; SetCurrentStation(MousePoint); //点击处理 if ((m_wHoverRow==wHoverRow)&&(m_wHoverLine==wHoverLine)) { //关闭按钮 if ((m_wHoverLine==LINE_FUNCTION)&&(m_wHoverRow==ROW_CLOSE_KEY)) { //设置焦点 CONTAINING_RECORD(this,CPasswordControl,m_PasswordKeyboard)->m_edPassword.SetFocus(); //销毁窗口 DestroyWindow(); return; } //虚拟编码 WORD wViraulCode=GetVirualKeyCode(m_wHoverLine,m_wHoverRow); //按钮处理 switch (wViraulCode) { case VK_SHIFT: //切换按钮 { //设置变量 m_bShiftStatus=!m_bShiftStatus; break; } case VK_CAPITAL: //大写按钮 { //变量定义 INPUT Input[2]; ZeroMemory(Input,sizeof(Input)); //设置变量 Input[1].ki.dwFlags=KEYEVENTF_KEYUP; Input[0].type=Input[1].type=INPUT_KEYBOARD; Input[0].ki.wVk=Input[1].ki.wVk=wViraulCode; //模拟输入 SendInput(CountArray(Input),Input,sizeof(INPUT)); break; } default: //默认按钮 { //设置变量 m_bShiftStatus=(GetKeyState(VK_SHIFT)&0xF0)>0; //发送消息 CPasswordControl * pPasswordControl=CONTAINING_RECORD(this,CPasswordControl,m_PasswordKeyboard); if (pPasswordControl!=NULL) pPasswordControl->m_edPassword.SendMessage(WM_CHAR,wViraulCode,0L); break; } } } //更新界面 RedrawWindow(NULL,NULL,RDW_FRAME|RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASENOW); } return;}
开发者ID:lonyzone,项目名称:oathx-ogrex-editor,代码行数:88,
示例2: dcvoid CBrushPaletteWnd::OnPaint() { { CPaintDC dc(this); // device context for painting } // skip if already drawing extern BOOL _bInTestGame; if( _bInTestGame) return; if( m_iTimerID == -1) { m_iTimerID = (int) SetTimer( 1, 10, NULL); } POINT ptMouse; GetCursorPos( &ptMouse); ScreenToClient( &ptMouse); // if there is a valid drawport, and the drawport can be locked if( m_pDrawPort != NULL ) { m_pDrawPort->SetAsCurrent(); CWorldEditorView *pWorldEditorView = theApp.GetActiveView(); ASSERT( pWorldEditorView != NULL); // clear background m_pDrawPort->Fill( C_lGRAY|CT_OPAQUE); // erase z-buffer m_pDrawPort->FillZBuffer(ZBUF_BACK); // for all brushes for( INDEX iBrush=0; iBrush<CT_BRUSHES; iBrush++) { // get current brush's box in pixels inside window PIXaabbox2D boxBrush = GetBrushBBox( iBrush); RenderBrushShape( iBrush, boxBrush, m_pDrawPort); TIME tm=_pTimer->GetRealTimeTick(); // if we are drawing selected brush if(iBrush==theApp.m_fCurrentTerrainBrush) { m_pDrawPort->SetAsCurrent(); FLOAT fFactor=sin(tm*8)/2.0f+0.5f; COLOR colSelected=LerpColor(C_lGRAY,C_RED,fFactor); m_pDrawPort->DrawBorder(boxBrush.Min()(1)-1, boxBrush.Min()(2)-1, boxBrush.Max()(1)-boxBrush.Min()(1)+2, boxBrush.Max()(2)-boxBrush.Min()(2)+2, colSelected|CT_OPAQUE); } PIXaabbox2D boxPoint( PIX2D( ptMouse.x, ptMouse.y), PIX2D(ptMouse.x, ptMouse.y) ); if( (boxBrush & boxPoint) == boxPoint) { m_pDrawPort->SetAsCurrent(); INDEX iRot=((ULONG)(tm*25.0f))&7; ULONG ulLineType=0x0f0f0f0f<<iRot; m_pDrawPort->DrawBorder(boxBrush.Min()(1)-1, boxBrush.Min()(2)-1, boxBrush.Max()(1)-boxBrush.Min()(1)+2, boxBrush.Max()(2)-boxBrush.Min()(2)+2, C_BLUE|CT_OPAQUE, ulLineType); } } // if there is a valid viewport if (m_pViewPort!=NULL) { m_pViewPort->SwapBuffers(); } }}
开发者ID:rdrago,项目名称:LCSource,代码行数:65,
示例3: switchvoid CQListCtrl::OnTimer(UINT_PTR nIDEvent) { //http://support.microsoft.com/kb/200054 //OnTimer() Is Not Called Repeatedly for a List Control bool callBase = true; switch(nIDEvent) { case TIMER_SHOW_PROPERTIES: { if( theApp.m_bShowingQuickPaste ) ShowFullDescription(true); KillTimer(TIMER_SHOW_PROPERTIES); callBase = false; } break; case TIMER_HIDE_SCROL: { CPoint cursorPos; GetCursorPos(&cursorPos); CRect crWindow; this->GetWindowRect(&crWindow); //check and see if they moved out of the scroll area //If they did tell our parent so if(MouseInScrollBarArea(crWindow, cursorPos) == false) { StopHideScrollBarTimer(); } callBase = false; } break; case TIMER_SHOW_SCROLL: { CPoint cursorPos; GetCursorPos(&cursorPos); CRect crWindow; this->GetWindowRect(&crWindow); //Adjust for the v-scroll bar being off of the screen crWindow.right -= theApp.m_metrics.ScaleX(GetSystemMetrics(SM_CXVSCROLL)); crWindow.bottom -= theApp.m_metrics.ScaleX(::GetSystemMetrics(SM_CXHSCROLL)); //Check and see if we are still in the cursor area if(MouseInScrollBarArea(crWindow, cursorPos)) { m_timerToHideScrollAreaSet = true; GetParent()->SendMessage(NM_SHOW_HIDE_SCROLLBARS, 1, 0); //Start looking to hide the scroll bars SetTimer(TIMER_HIDE_SCROL, 1000, NULL); } KillTimer(TIMER_SHOW_SCROLL); callBase = false; } break; } if(callBase) { CListCtrl::OnTimer(nIDEvent); }}
开发者ID:erdincay,项目名称:ditto-clipboard,代码行数:73,
示例4: IN_MouseMove/*===========IN_MouseMove===========*/void IN_MouseMove (usercmd_t *cmd){ int mx, my; HDC hdc; int i; DIDEVICEOBJECTDATA od; DWORD dwElements; HRESULT hr; if (!mouseactive) return; if (dinput) { mx = 0; my = 0; for (;;) { dwElements = 1; hr = IDirectInputDevice_GetDeviceData(g_pMouse, sizeof(DIDEVICEOBJECTDATA), &od, &dwElements, 0); if ((hr == DIERR_INPUTLOST) || (hr == DIERR_NOTACQUIRED)) { dinput_acquired = true; IDirectInputDevice_Acquire(g_pMouse); break; } /* Unable to read data or no data available */ if (FAILED(hr) || dwElements == 0) { break; } /* Look at the element to see what happened */ switch (od.dwOfs) { case DIMOFS_X: mx += od.dwData; break; case DIMOFS_Y: my += od.dwData; break; case DIMOFS_BUTTON0: if (od.dwData & 0x80) mstate_di |= 1; else mstate_di &= ~1; break; case DIMOFS_BUTTON1: if (od.dwData & 0x80) mstate_di |= (1<<1); else mstate_di &= ~(1<<1); break; case DIMOFS_BUTTON2: if (od.dwData & 0x80) mstate_di |= (1<<2); else mstate_di &= ~(1<<2); break; } } // perform button actions for (i=0 ; i<mouse_buttons ; i++) { if ( (mstate_di & (1<<i)) && !(mouse_oldbuttonstate & (1<<i)) ) { Key_Event (K_MOUSE1 + i, true); } if ( !(mstate_di & (1<<i)) && (mouse_oldbuttonstate & (1<<i)) ) { Key_Event (K_MOUSE1 + i, false); } } mouse_oldbuttonstate = mstate_di; } else { GetCursorPos (¤t_pos); mx = current_pos.x - window_center_x + mx_accum; my = current_pos.y - window_center_y + my_accum;//.........这里部分代码省略.........
开发者ID:CHMyFork,项目名称:Quake-VS2015,代码行数:101,
示例5: SetCursorPosvoid CGUIDialogKeyboardGeneric::MoveCursor(int iAmount){ if (!m_strEditing.IsEmpty()) return; SetCursorPos(GetCursorPos() + iAmount);}
开发者ID:nremenda,项目名称:xbmc,代码行数:6,
示例6: GetCursorPosvoid CToolTipCtrlEx::OnPaint(){ POINT Pos; GetCursorPos(&Pos); CRect PRect; WindowFromPoint(Pos)->GetWindowRect(PRect); CPaintDC dc(this); // device context for painting CRect Rect,R1; CRect WRect; Orientations Orient=NW; BOOL Over=0,Left=0; Over=Pos.y >(PRect.top+(PRect.bottom-PRect.top)/2); Left=Pos.x <(PRect.left+(PRect.right-PRect.left)/2); if(Over & Left)Orient=NW; else if(Over & !Left)Orient=NE; else if(!Over & Left)Orient=SW; else if(!Over & !Left)Orient=SE; dc.SelectObject(GetFont()); CString Tip=_T(""),TStr=_T(""); GetWindowText(Tip); UINT Width=0; UINT Rows=1; UINT iPos=0; Tip.Replace(_T("/r"),_T("")); while(iPos<Tip.GetLength()) { if(Tip.GetAt(iPos)=='/n') { CSize Sz1=dc.GetTextExtent(TStr); Width=(Width > Sz1.cx) ? Width : Sz1.cx; Rows+=1; TStr=_T(""); } else { TStr+=Tip.GetAt(iPos); } iPos++; } if(TStr.GetLength()) { CSize Sz1=dc.GetTextExtent(TStr); Width=(Width > Sz1.cx) ? Width : Sz1.cx; } if(Rows==1) { CSize Sz1=dc.GetTextExtent(Tip); Width=(Width > Sz1.cx) ? Width : Sz1.cx; } Width+=2; GetWindowRect(WRect); TEXTMETRIC TM; dc.GetTextMetrics(&TM); if(Over) { WRect.bottom=PRect.top; WRect.top=WRect.bottom-(Rows*(TM.tmHeight)+4); } else { WRect.top=PRect.bottom; WRect.bottom=WRect.top+(Rows*(TM.tmHeight)+4); } UINT T=WRect.Width()-(20+Width); WRect.left=Pos.x; WRect.right=WRect.left+20+Width; if(WRect.right>GetSystemMetrics(SM_CXSCREEN)-25) { WRect.OffsetRect(-(WRect.right-(GetSystemMetrics(SM_CXSCREEN)-25)),0); } MoveWindow(&WRect,1); ShowWindow(1); GetClientRect(Rect); dc.FillSolidRect(Rect,m_bkColor); R1=Rect; R1.right=R1.left+15; dc.FillSolidRect(R1,m_leftColor); Rect.left=R1.right+1; dc.SetBkMode(TRANSPARENT); Rect.top+=1; UINT iT=(Rect.Width()-Width)/2; Rect.left+=iT; dc.SetTextColor(m_textColor); if(Rows==1) { dc.DrawText(Tip,Rect,DT_LEFT|DT_VCENTER|DT_SINGLELINE); } else { dc.DrawText(Tip,Rect,DT_TOP|DT_LEFT|DT_WORDBREAK);//.........这里部分代码省略.........
开发者ID:segafan,项目名称:Construct-classic,代码行数:101,
示例7: GiveFocusToScreenvoid GiveFocusToScreen(unsigned int ScreenIndex, tree_node *FocusNode, bool Mouse, bool UpdateFocus){ screen_info *Screen = GetDisplayFromScreenID(ScreenIndex); if(Screen && Screen != KWMScreen.Current) { KWMScreen.PrevSpace = KWMScreen.Current->ActiveSpace; KWMScreen.Current = Screen; Screen->ActiveSpace = GetActiveSpaceOfDisplay(Screen); ShouldActiveSpaceBeManaged(); space_info *Space = GetActiveSpaceOfScreen(Screen); DEBUG("GiveFocusToScreen() " << ScreenIndex << / ": Space transition ended " << KWMScreen.PrevSpace << / " -> " << Screen->ActiveSpace); if(UpdateFocus) { if(Space->Initialized && FocusNode) { DEBUG("Populated Screen 'Window -f Focus'"); UpdateActiveWindowList(Screen); FilterWindowList(Screen); SetWindowFocusByNode(FocusNode); MoveCursorToCenterOfFocusedWindow(); } else if(Space->Initialized && Space->RootNode) { DEBUG("Populated Screen Key/Mouse Focus"); UpdateActiveWindowList(Screen); FilterWindowList(Screen); bool WindowBelowCursor = IsAnyWindowBelowCursor(); if(Mouse && !WindowBelowCursor) ClearFocusedWindow(); else if(Mouse && WindowBelowCursor) FocusWindowBelowCursor(); if(!Mouse) { if(Space->FocusedWindowID == -1) { if(Space->Settings.Mode == SpaceModeBSP) { void *FocusNode = NULL; GetFirstLeafNode(Space->RootNode, (void**)&FocusNode); Space->FocusedWindowID = ((tree_node*)FocusNode)->WindowID; } else if(Space->Settings.Mode == SpaceModeMonocle) { if(Space->RootNode->List) Space->FocusedWindowID = Space->RootNode->List->WindowID; } } FocusWindowByID(Space->FocusedWindowID); MoveCursorToCenterOfFocusedWindow(); } } else { if(!Space->Initialized || Space->Settings.Mode == SpaceModeFloating || !Space->RootNode) { DEBUG("Uninitialized Screen"); ClearFocusedWindow(); if(!Mouse) CGWarpMouseCursorPosition(CGPointMake(Screen->X + (Screen->Width / 2), Screen->Y + (Screen->Height / 2))); if(Space->Settings.Mode != SpaceModeFloating && !Space->RootNode) { CGPoint ClickPos = GetCursorPos(); CGEventRef ClickEvent = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, ClickPos, kCGMouseButtonLeft); CGEventSetFlags(ClickEvent, 0); CGEventPost(kCGHIDEventTap, ClickEvent); CFRelease(ClickEvent); ClickEvent = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseUp, ClickPos, kCGMouseButtonLeft); CGEventSetFlags(ClickEvent, 0); CGEventPost(kCGHIDEventTap, ClickEvent); CFRelease(ClickEvent); } } } } }}
开发者ID:dylanharrington,项目名称:kwm,代码行数:91,
示例8: ShowTrayMenuvoid ShowTrayMenu() { POINT pt; GetCursorPos(&pt); WCHAR szBuff[MAX_LANGLEN]; HMENU hmenu = CreatePopupMenu(); for (int i = 0; i <= (IDM_EXIT - IDM_STTRAYNEXT); i++) { LangLoadString(IDS_STTRAYNEXT + i, szBuff, SIZEOF_ARRAY(szBuff)); AppendMenu(hmenu, MF_STRING, IDM_STTRAYNEXT + i, szBuff); } InsertMenu(hmenu, IDM_CONFIG, MF_SEPARATOR | MF_BYCOMMAND, 0, NULL); InsertMenu(hmenu, IDM_EXIT, MF_SEPARATOR | MF_BYCOMMAND, 0, NULL); HMENU hmenuPopup = CreatePopupMenu(); for (int i = 0; i <= (IDM_ABOUT - IDM_DOCUMENTATION); i++) { LangLoadString(IDS_DOCUMENTATION + i, szBuff, SIZEOF_ARRAY(szBuff)); AppendMenu(hmenuPopup, MF_STRING, IDM_DOCUMENTATION + i, szBuff); } LangLoadString(IDS_HELP, szBuff, SIZEOF_ARRAY(szBuff)); InsertMenu(hmenu, IDM_CONFIG, MF_STRING | MF_BYCOMMAND | MF_POPUP, (UINT_PTR)hmenuPopup, szBuff); InsertMenu(hmenu, 4, MF_SEPARATOR | MF_BYPOSITION, 0, NULL); hmenuPopup = CreatePopupMenu(); for (int i = 0; i <= (IDM_NEWEXCLUSION - IDM_HIDE); i++) { LangLoadString(IDS_HIDE + i, szBuff, SIZEOF_ARRAY(szBuff)); AppendMenu(hmenuPopup, MF_STRING, IDM_HIDE + i, szBuff); } InsertMenu(hmenuPopup, IDM_NEWEXCLUSION, MF_SEPARATOR | MF_BYCOMMAND, 0, NULL); InsertMenu(hmenuPopup, IDM_REPLACEALTTAB, MF_SEPARATOR | MF_BYCOMMAND, 0, NULL); CheckMenuItem(hmenuPopup, IDM_REPLACEALTTAB, !(g_dwFlags & TSF_NOREPLACEALTTAB) ? (MF_BYCOMMAND | MF_CHECKED) : (MF_BYCOMMAND | MF_UNCHECKED)); CheckMenuItem(hmenuPopup, IDM_INSTSWITCHER, (g_dwFlags & TSF_INSTSWITCHER) ? (MF_BYCOMMAND | MF_CHECKED) : (MF_BYCOMMAND | MF_UNCHECKED)); CheckMenuItem(hmenuPopup, IDM_STICKYALTTAB, (g_dwFlags & TSF_STICKYALTTAB) ? (MF_BYCOMMAND | MF_CHECKED) : (MF_BYCOMMAND | MF_UNCHECKED)); CheckMenuItem(hmenuPopup, IDM_HOOKALTTAB, (g_dwFlags & TSF_HOOKALTTAB) ? (MF_BYCOMMAND | MF_CHECKED) : (MF_BYCOMMAND | MF_UNCHECKED));// CheckMenuItem(hmenuPopup, IDM_EXTMOUSE, (g_dwFlags & TSF_EXTMOUSE) // ? (MF_BYCOMMAND | MF_CHECKED) : (MF_BYCOMMAND | MF_UNCHECKED)); LangLoadString(IDS_QUICKCONFIG, szBuff, SIZEOF_ARRAY(szBuff)); InsertMenu(hmenu, IDM_CONFIG, MF_STRING | MF_BYCOMMAND | MF_POPUP, (UINT_PTR)hmenuPopup, szBuff); SetForegroundWindow(g_hwndMain); UINT uMenuID = (UINT)TrackPopupMenu(hmenu, TPM_RIGHTBUTTON | TPM_RIGHTALIGN | TPM_NONOTIFY | TPM_RETURNCMD, pt.x, pt.y, 0, g_hwndMain, NULL); PostMessage(g_hwndMain, WM_NULL, 0, 0); DestroyMenu(hmenu); switch (uMenuID) { case IDM_STTRAYNEXT: ShowTaskSwitchWnd(IDH_STTRAYNEXT); break; case IDM_STITRAYNEXT: ShowTaskSwitchWnd(IDH_STITRAYNEXT); break; case IDM_CONFIG: ConfigTaskSwitchXP(); break; case IDM_HIDE: ShowTrayIcon(FALSE); break; case IDM_REPLACEALTTAB: ReplaceAltTab((g_dwFlags & TSF_NOREPLACEALTTAB) ? (g_dwFlags & ~TSF_NOREPLACEALTTAB) : (g_dwFlags | TSF_NOREPLACEALTTAB)); break; case IDM_INSTSWITCHER: ReplaceAltTab((g_dwFlags & TSF_INSTSWITCHER) ? (g_dwFlags & ~TSF_INSTSWITCHER) : (g_dwFlags | TSF_INSTSWITCHER)); break; case IDM_STICKYALTTAB: g_dwFlags ^= TSF_STICKYALTTAB; break; case IDM_HOOKALTTAB: ReplaceAltTab((g_dwFlags & TSF_HOOKALTTAB) ? (g_dwFlags & ~TSF_HOOKALTTAB) : (g_dwFlags | TSF_HOOKALTTAB)); break;// case IDM_EXTMOUSE:// EnableExtMouse(!(g_dwFlags & TSF_EXTMOUSE), g_dwFlags & TSF_WHEELTAB);// break; case IDM_NEWEXCLUSION: ConfigTaskSwitchXP(L"/newexcl"); break; case IDM_DOCUMENTATION: HelpTaskSwitchXP(); break; case IDM_HOMEPAGE: ShellExecute(NULL, L"open", L"http://www.ntwind.com/taskswitchxp/", NULL, NULL, SW_SHOWNORMAL); break; case IDM_ABOUT: ConfigTaskSwitchXP(L"/about"); break; case IDM_EXIT: DestroyWindow(g_hwndMain); break; }//.........这里部分代码省略.........
开发者ID:gvsurenderreddy,项目名称:winswitch,代码行数:101,
示例9: mainint main(){ srand(time(NULL)); // Create the main window sf::RenderWindow window(sf::VideoMode(800, 600), "Astroides"); //used for getting the mouse posistion. sf::VideoMode desktop = sf::VideoMode::getDesktopMode(); const int window_height = desktop.height; const int window_width = desktop.width; window.setFramerateLimit(60); sf::Clock clock = sf::Clock(); sf::Time elapsedTime; //BackGround sf::Texture backGroundTexture; sf::Sprite backGroundSprite; backGroundTexture.loadFromFile("Resorces/Img/background.png"); backGroundSprite.setTexture(backGroundTexture); backGroundSprite.setPosition(0, 0); //Entities Player player = Player(); EnemyManager eManager; ProjectileManager* projectileMgr = ProjectileManager::instance(); InputManager* inputMgr = InputManager::instance(); //set up world. sf::Vector2f worldBounds = sf::Vector2f(MAP_WIDTH, MAP_HEIGHT); int numPacksSwarmers = 10; int numSwarmersPerPack = 10; int numSwarmerEnemies = numPacksSwarmers * numSwarmersPerPack; int numFactories = 20; //create some Enemies for (int i = 0; i < numPacksSwarmers; i++) { for (int z = 0; z < numSwarmersPerPack; z++) { Swarmer * e = new Swarmer((1000 * i), (700 * i)); //Starts all enemy in the center of the screen. eManager.addEnemy(e); } } for (int i = 0; i < numFactories; i++) { Factory * f = new Factory(&eManager); eManager.addFactory(f); } // Start game loop while (window.isOpen()) { // Process events sf::Event Event; while (window.pollEvent(Event)) { if (Event.type == Event.KeyPressed && Event.key.code == sf::Keyboard::Escape) { window.close(); } switch (Event.type) { // Close window : exit case sf::Event::Closed: window.close(); break; default: break; }//end switch }//end while InputManager::instance()->UpdatePressedKeys(Event); player.Update(worldBounds); projectileMgr->Update(window); //Get the mouse posistion and send it to the swarm method. POINT mousePos; if (GetCursorPos(&mousePos)) { if (ScreenToClient(window.getSystemHandle(), &mousePos)) { //std::cout << "mouse pos : (" << mousePos.x << ", " << mousePos.y << ")" << std::endl; eManager.swarmEAI(player.GetPos()); } } //eManager.flocking(); eManager.CheckCollisions(); eManager.UpdateFactories(&player); eManager.UpdatePredators(player.GetPos()); eManager.CollisionSwarm(&player); eManager.CollisionPred(&player); //prepare frame window.clear();//.........这里部分代码省略.........
开发者ID:DaveMold,项目名称:AI,代码行数:101,
示例10: DefWindowProc// Called from the Windows notification handler thread, in its message loopLRESULT CALLBACKDesktopIndicatorHandler::WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam){ // Check for our special notification message if ((uMessage != WM_DESKTOPINDICATOR_CLICK)) { return DefWindowProc(hWnd, uMessage, wParam, lParam); } DesktopIndicatorHandler *pthis = (DesktopIndicatorHandler *) GetWindowLong(hWnd, GWL_USERDATA); switch (lParam) { case WM_LBUTTONDBLCLK: // Execute the default action of the right-click popup menu pthis->restoreApplication(); break; //case WM_LBUTTONDOWN: //case WM_RBUTTONDOWN: //case WM_LBUTTONUP: //break; case WM_RBUTTONUP: // Display popup menu on right click { SetForegroundWindow(hWnd); POINT pos; GetCursorPos(&pos); int cxMenuCheck = GetSystemMetrics(SM_CXMENUCHECK); int cyMenuCheck = GetSystemMetrics(SM_CYMENUCHECK); HMENU hMenu = CreatePopupMenu(); UAppendMenu(hMenu, MF_STRING, MNU_RESTORE, pthis->m_lpwszItemRestore); // L"Restore"; UAppendMenu(hMenu, MF_STRING, MNU_ABOUT, pthis->m_lpwszItemAbout); // L"About..."; UAppendMenu(hMenu, MF_SEPARATOR, 0, (LPCWSTR)NULL); UAppendMenu(hMenu, MF_STRING, MNU_EXIT_AFTER, pthis->m_lpwszItemExitLater); // L"Exit After Transfers"; UAppendMenu(hMenu, MF_STRING, MNU_EXIT, pthis->m_lpwszItemExit); // L"Exit"; //Load 15x15 bitmaps for unchecked state of menu options //Remap colors #000000, #808080, #C0C0C0, #DFDFDF, #FFFFFF //to 3D colors: DlgText, 3DDark, 3DFace, 3DLight, WindowBg HBITMAP hbmpRestore = (HBITMAP)LoadImageA( ::g_hInstance, MAKEINTRESOURCEA(IDB_RESTORE), IMAGE_BITMAP, cxMenuCheck, cyMenuCheck, LR_LOADMAP3DCOLORS); HBITMAP hbmpHelp = (HBITMAP)LoadImageA( ::g_hInstance, MAKEINTRESOURCEA(IDB_HELP), IMAGE_BITMAP, cxMenuCheck, cyMenuCheck, LR_LOADMAP3DCOLORS); HBITMAP hbmpWaitClose = (HBITMAP)LoadImageA( ::g_hInstance, MAKEINTRESOURCEA(IDB_WAITCLOSE), IMAGE_BITMAP, cxMenuCheck, cyMenuCheck, LR_LOADMAP3DCOLORS); HBITMAP hbmpClose = (HBITMAP)LoadImageA( ::g_hInstance, MAKEINTRESOURCEA(IDB_CLOSE), IMAGE_BITMAP, cxMenuCheck, cyMenuCheck, LR_LOADMAP3DCOLORS); SetMenuItemBitmaps(hMenu, MNU_RESTORE, MF_BYCOMMAND, hbmpRestore, (HBITMAP)NULL); SetMenuItemBitmaps(hMenu, MNU_ABOUT, MF_BYCOMMAND, hbmpHelp, (HBITMAP)NULL); SetMenuItemBitmaps(hMenu, MNU_EXIT_AFTER, MF_BYCOMMAND, hbmpWaitClose, (HBITMAP)NULL); SetMenuItemBitmaps(hMenu, MNU_EXIT, MF_BYCOMMAND, hbmpClose, (HBITMAP)NULL); SetMenuDefaultItem(hMenu, MNU_RESTORE, MF_BYCOMMAND); switch (TrackPopupMenu(hMenu, TPM_CENTERALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, /* return an item.wID instead of BOOL */ pos.x, pos.y, 0, hWnd, (LPCRECT)NULL)) { case MNU_RESTORE: pthis->restoreApplication(); break; case MNU_ABOUT: pthis->showAboutWindow(); break; case MNU_EXIT_AFTER: pthis->exitAfterTransfers(); break; case MNU_EXIT: pthis->exitApplication(); break; } DestroyMenu(hMenu); DeleteObject((HGDIOBJ)hbmpRestore); DeleteObject((HGDIOBJ)hbmpClose); } break; case WM_DESTROY: PostQuitMessage(0); break; } return 0;}
开发者ID:BackupTheBerlios,项目名称:limewire,代码行数:95,
示例11: ProcessPageShowContextMenuvoid ProcessPageShowContextMenu(DWORD dwProcessId){ HMENU hMenu; HMENU hSubMenu; HMENU hPriorityMenu; POINT pt; SYSTEM_INFO si; HANDLE hProcess; DWORD dwProcessPriorityClass; WCHAR strDebugger[260]; DWORD dwDebuggerSize; HKEY hKey; memset(&si, 0, sizeof(SYSTEM_INFO)); GetCursorPos(&pt); GetSystemInfo(&si); hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_PROCESS_PAGE_CONTEXT)); hSubMenu = GetSubMenu(hMenu, 0); hPriorityMenu = GetSubMenu(hSubMenu, 4); hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwProcessId); dwProcessPriorityClass = GetPriorityClass(hProcess); CloseHandle(hProcess); if (si.dwNumberOfProcessors < 2) RemoveMenu(hSubMenu, ID_PROCESS_PAGE_SETAFFINITY, MF_BYCOMMAND); if (!DebugChannelsAreSupported()) RemoveMenu(hSubMenu, ID_PROCESS_PAGE_DEBUGCHANNELS, MF_BYCOMMAND); switch (dwProcessPriorityClass) { case REALTIME_PRIORITY_CLASS: CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, MF_BYCOMMAND); break; case HIGH_PRIORITY_CLASS: CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_HIGH, MF_BYCOMMAND); break; case ABOVE_NORMAL_PRIORITY_CLASS: CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL, MF_BYCOMMAND); break; case NORMAL_PRIORITY_CLASS: CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_NORMAL, MF_BYCOMMAND); break; case BELOW_NORMAL_PRIORITY_CLASS: CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL, MF_BYCOMMAND); break; case IDLE_PRIORITY_CLASS: CheckMenuRadioItem(hPriorityMenu, ID_PROCESS_PAGE_SETPRIORITY_REALTIME, ID_PROCESS_PAGE_SETPRIORITY_LOW, ID_PROCESS_PAGE_SETPRIORITY_LOW, MF_BYCOMMAND); break; } if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software//Microsoft//Windows NT//CurrentVersion//AeDebug", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { dwDebuggerSize = sizeof(strDebugger); if (RegQueryValueExW(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS) { CharUpper(strDebugger); if (wcsstr(strDebugger, L"DRWTSN32")) EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED); } else EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED); RegCloseKey(hKey); } else { EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED); } TrackPopupMenu(hSubMenu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, hMainWnd, NULL); DestroyMenu(hMenu);}
开发者ID:Moteesh,项目名称:reactos,代码行数:72,
示例12: ShowStatusMenustatic VOID ShowStatusMenu( _In_ HWND hwndDlg ){ PPH_STRING cacheEntryName; cacheEntryName = PhGetSelectedListViewItemText(ListViewWndHandle); if (cacheEntryName) { POINT cursorPos; PPH_EMENU menu; PPH_EMENU_ITEM selectedItem; GetCursorPos(&cursorPos); menu = PhCreateEMenu(); PhInsertEMenuItem(menu, PhCreateEMenuItem(0, 1, L"Remove", NULL, NULL), -1); selectedItem = PhShowEMenu( menu, ListViewWndHandle, PH_EMENU_SHOW_LEFTRIGHT, PH_ALIGN_LEFT | PH_ALIGN_TOP, cursorPos.x, cursorPos.y ); if (selectedItem && selectedItem->Id != -1) { switch (selectedItem->Id) { case 1: { INT lvItemIndex = PhFindListViewItemByFlags( ListViewWndHandle, -1, LVNI_SELECTED ); if (lvItemIndex != -1) { if (!PhGetIntegerSetting(L"EnableWarnings") || PhShowConfirmMessage( hwndDlg, L"remove", cacheEntryName->Buffer, NULL, FALSE )) { PATOM_TABLE_INFORMATION atomTable = NULL; if (!NT_SUCCESS(PhEnumAtomTable(&atomTable))) return; for (ULONG i = 0; i < atomTable->NumberOfAtoms; i++) { PATOM_BASIC_INFORMATION atomInfo = NULL; if (!NT_SUCCESS(PhQueryAtomTableEntry(atomTable->Atoms[i], &atomInfo))) continue; if (!PhEqualStringZ(atomInfo->Name, cacheEntryName->Buffer, TRUE)) continue; do { if (!NT_SUCCESS(NtDeleteAtom(atomTable->Atoms[i]))) { break; } PhFree(atomInfo); atomInfo = NULL; if (!NT_SUCCESS(PhQueryAtomTableEntry(atomTable->Atoms[i], &atomInfo))) break; } while (atomInfo->UsageCount >= 1); ListView_DeleteItem(ListViewWndHandle, lvItemIndex); if (atomInfo) { PhFree(atomInfo); } } PhFree(atomTable); } } } break; } } PhDestroyEMenu(menu); PhDereferenceObject(cacheEntryName); }}
开发者ID:phplugins,项目名称:plugins-extra,代码行数:100,
示例13: WndProcLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){ switch (message) { case WM_COMMAND: switch (LOWORD(wParam)) { case ID_PM_REALTIME: SetProcessPriority(REALTIME_PRIORITY_CLASS); break; case ID_PM_HIGH: SetProcessPriority(HIGH_PRIORITY_CLASS); break; case ID_PM_ABOVE_NORMAL: SetProcessPriority(ABOVE_NORMAL_PRIORITY_CLASS); break; case ID_PM_NORMAL: SetProcessPriority(NORMAL_PRIORITY_CLASS); break; case ID_PM_BELOW_NORMAL: SetProcessPriority(BELOW_NORMAL_PRIORITY_CLASS); break; case ID_PM_IDLE: SetProcessPriority(IDLE_PRIORITY_CLASS); break; } switch (HIWORD(wParam)) { case 1: { if (lParam == (LPARAM)ListBoxProcess) ShowModule(); } break; default: return DefWindowProc(hWnd, message, wParam, lParam); break; } break; case WM_CONTEXTMENU: if (SendMessage(ListBoxProcess, LB_GETCURSEL, 0, 0) != LB_ERR) { POINT cursorPosition; GetCursorPos(&cursorPosition); TrackPopupMenu(PopupMenu, TPM_BOTTOMALIGN | TPM_LEFTALIGN, cursorPosition.x, cursorPosition.y, 0, hWnd, NULL); } break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); break; } return 0;}
开发者ID:Raumo0,项目名称:Labs,代码行数:63,
示例14: ifvoid EMU::update_input(){#ifdef USE_SHIFT_NUMPAD_KEY // update numpad key status if(key_shift_pressed && !key_shift_released) { if(key_status[VK_SHIFT] == 0) { // shift key is newly pressed key_status[VK_SHIFT] = 0x80;#ifdef NOTIFY_KEY_DOWN vm->key_down(VK_SHIFT, false);#endif } } else if(!key_shift_pressed && key_shift_released) { if(key_status[VK_SHIFT] != 0) { // shift key is newly released key_status[VK_SHIFT] = 0;#ifdef NOTIFY_KEY_DOWN vm->key_up(VK_SHIFT);#endif // check l/r shift if(!(GetAsyncKeyState(VK_LSHIFT) & 0x8000)) key_status[VK_LSHIFT] &= 0x7f; if(!(GetAsyncKeyState(VK_RSHIFT) & 0x8000)) key_status[VK_RSHIFT] &= 0x7f; } } key_shift_pressed = key_shift_released = false;#endif // release keys#ifdef USE_AUTO_KEY if(lost_focus && autokey_phase == 0) {#else if(lost_focus) {#endif // we lost key focus so release all pressed keys for(int i = 0; i < 256; i++) { if(key_status[i] & 0x80) { key_status[i] &= 0x7f;#ifdef NOTIFY_KEY_DOWN if(!key_status[i]) { vm->key_up(i); }#endif } } } else { for(int i = 0; i < 256; i++) { if(key_status[i] & 0x7f) { key_status[i] = (key_status[i] & 0x80) | ((key_status[i] & 0x7f) - 1);#ifdef NOTIFY_KEY_DOWN if(!key_status[i]) { vm->key_up(i); }#endif } } } lost_focus = false; // update joystick status memset(joy_status, 0, sizeof(joy_status)); for(int i = 0; i < joy_num && i < 2; i++) { JOYINFOEX joyinfo; joyinfo.dwSize = sizeof(JOYINFOEX); joyinfo.dwFlags = JOY_RETURNALL; if(joyGetPosEx(i, &joyinfo) == JOYERR_NOERROR) { if(joyinfo.dwYpos < 0x3fff) joy_status[i] |= 0x01; // up if(joyinfo.dwYpos > 0xbfff) joy_status[i] |= 0x02; // down if(joyinfo.dwXpos < 0x3fff) joy_status[i] |= 0x04; // left if(joyinfo.dwXpos > 0xbfff) joy_status[i] |= 0x08; // right joy_status[i] |= ((joyinfo.dwButtons & joy_mask[i]) << 4); } }#ifdef USE_KEY_TO_JOY // emulate joystick #1 with keyboard if(key_status[0x26]) joy_status[0] |= 0x01; // up if(key_status[0x28]) joy_status[0] |= 0x02; // down if(key_status[0x25]) joy_status[0] |= 0x04; // left if(key_status[0x27]) joy_status[0] |= 0x08; // right#endif // update mouse status memset(mouse_status, 0, sizeof(mouse_status)); if(mouse_enabled) { // get current status POINT pt; GetCursorPos(&pt); ScreenToClient(main_window_handle, &pt); mouse_status[0] = pt.x - display_width / 2; mouse_status[1] = pt.y - display_height / 2; mouse_status[2] = (GetAsyncKeyState(VK_LBUTTON) & 0x8000) ? 1 : 0; mouse_status[2] |= (GetAsyncKeyState(VK_RBUTTON) & 0x8000) ? 2 : 0; mouse_status[2] |= (GetAsyncKeyState(VK_MBUTTON) & 0x8000) ? 4 : 0; // move mouse cursor to the center of window if(!(mouse_status[0] == 0 && mouse_status[1] == 0)) { pt.x = display_width / 2; pt.y = display_height / 2; ClientToScreen(main_window_handle, &pt); SetCursorPos(pt.x, pt.y);//.........这里部分代码省略.........
开发者ID:meesokim,项目名称:fc-100,代码行数:101,
示例15: GetMessageTimeWebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam){ WebMouseWheelEvent result; //(WebInputEvent::Uninitialized()); result.type = WebInputEvent::MouseWheel; // TODO(pkasting): http://b/1117926 Are we guaranteed that the message that // GetMessageTime() refers to is the same one that we're passed in? Perhaps // one of the construction parameters should be the time passed by the // caller, who would know for sure. result.timeStampSeconds = GetMessageTime() / 1000.0; result.button = WebMouseEvent::ButtonNone; // Get key state, coordinates, and wheel delta from event. typedef SHORT (WINAPI *GetKeyStateFunction)(int key); GetKeyStateFunction getKeyState; UINT keyState; float wheelDelta; bool horizontalScroll = false; if ((message == WM_VSCROLL) || (message == WM_HSCROLL)) { // Synthesize mousewheel event from a scroll event. This is needed to // simulate middle mouse scrolling in some laptops. Use GetAsyncKeyState // for key state since we are synthesizing the input event. getKeyState = GetAsyncKeyState; keyState = 0; if (getKeyState(VK_SHIFT)) keyState |= MK_SHIFT; if (getKeyState(VK_CONTROL)) keyState |= MK_CONTROL; // NOTE: There doesn't seem to be a way to query the mouse button state // in this case. POINT cursorPosition = {0}; GetCursorPos(&cursorPosition); result.globalX = cursorPosition.x; result.globalY = cursorPosition.y; switch (LOWORD(wparam)) { case SB_LINEUP: // == SB_LINELEFT wheelDelta = WHEEL_DELTA; break; case SB_LINEDOWN: // == SB_LINERIGHT wheelDelta = -WHEEL_DELTA; break; case SB_PAGEUP: wheelDelta = 1; result.scrollByPage = true; break; case SB_PAGEDOWN: wheelDelta = -1; result.scrollByPage = true; break; default: // We don't supoprt SB_THUMBPOSITION or SB_THUMBTRACK here. wheelDelta = 0; break; } if (message == WM_HSCROLL) horizontalScroll = true; } else { // Non-synthesized event; we can just read data off the event. getKeyState = GetKeyState; keyState = GET_KEYSTATE_WPARAM(wparam); result.globalX = static_cast<short>(LOWORD(lparam)); result.globalY = static_cast<short>(HIWORD(lparam)); wheelDelta = static_cast<float>(GET_WHEEL_DELTA_WPARAM(wparam)); if (message == WM_MOUSEHWHEEL) { horizontalScroll = true; wheelDelta = -wheelDelta; // Windows is <- -/+ ->, WebKit <- +/- ->. } } if (keyState & MK_SHIFT) horizontalScroll = true; // Set modifiers based on key state. if (keyState & MK_SHIFT) result.modifiers |= WebInputEvent::ShiftKey; if (keyState & MK_CONTROL) result.modifiers |= WebInputEvent::ControlKey; if (getKeyState(VK_MENU) & 0x8000) result.modifiers |= WebInputEvent::AltKey; if (keyState & MK_LBUTTON) result.modifiers |= WebInputEvent::LeftButtonDown; if (keyState & MK_MBUTTON) result.modifiers |= WebInputEvent::MiddleButtonDown; if (keyState & MK_RBUTTON) result.modifiers |= WebInputEvent::RightButtonDown; // Set coordinates by translating event coordinates from screen to client. POINT clientPoint = { result.globalX, result.globalY }; MapWindowPoints(0, hwnd, &clientPoint, 1); result.x = clientPoint.x; result.y = clientPoint.y; result.windowX = result.x; result.windowY = result.y;//.........这里部分代码省略.........
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:101,
示例16: handledbool CGUIDialogKeyboardGeneric::OnAction(const CAction &action){ bool handled(true); if (action.GetID() == ACTION_BACKSPACE) { Backspace(); } else if (action.GetID() == ACTION_ENTER) { OnOK(); } else if (action.GetID() == ACTION_CURSOR_LEFT) { MoveCursor( -1); } else if (action.GetID() == ACTION_CURSOR_RIGHT) { if (m_strEditing.IsEmpty() && (unsigned int) GetCursorPos() == m_strEdit.size() && (m_strEdit.size() == 0 || m_strEdit[m_strEdit.size() - 1] != ' ')) { // add a space Character(L' '); } else MoveCursor(1); } else if (action.GetID() == ACTION_SHIFT) { OnShift(); } else if (action.GetID() == ACTION_SYMBOLS) { OnSymbols(); } else if (action.GetID() >= REMOTE_0 && action.GetID() <= REMOTE_9) { OnRemoteNumberClick(action.GetID()); } else if (action.GetID() == ACTION_PASTE) { OnPasteClipboard(); } else if (action.GetID() >= KEY_VKEY && action.GetID() < KEY_ASCII) { // input from the keyboard (vkey, not ascii) if (!m_strEditing.IsEmpty()) return handled; uint8_t b = action.GetID() & 0xFF; if (b == XBMCVK_HOME) { SetCursorPos(0); } else if (b == XBMCVK_END) { SetCursorPos(m_strEdit.GetLength()); } else if (b == XBMCVK_LEFT) { MoveCursor( -1); } else if (b == XBMCVK_RIGHT) { MoveCursor(1); } else if (b == XBMCVK_RETURN || b == XBMCVK_NUMPADENTER) { OnOK(); } else if (b == XBMCVK_DELETE) { if (GetCursorPos() < m_strEdit.GetLength()) { MoveCursor(1); Backspace(); } } else if (b == XBMCVK_BACK) Backspace(); else if (b == XBMCVK_ESCAPE) Close(); } else if (action.GetID() >= KEY_ASCII) { // input from the keyboard //char ch = action.GetID() & 0xFF; int ch = action.GetUnicode(); // Ignore non-printing characters if ( !((0 <= ch && ch < 0x8) || (0xE <= ch && ch < 0x1B) || (0x1C <= ch && ch < 0x20)) ) { switch (ch) { case 0x8: // backspace Backspace(); break; case 0x9: // Tab (do nothing) case 0xB: // Non-printing character, ignore case 0xC: // Non-printing character, ignore break; case 0xA: // enter case 0xD: // enter OnOK(); break; case 0x1B: // escape Close(); break;//.........这里部分代码省略.........
开发者ID:nremenda,项目名称:xbmc,代码行数:101,
示例17: ASSERT_VALID//--------------------------------------------------------------------------------------//void CBCGPDragFrameImpl::MoveDragFrame (BOOL bForceMove){ ASSERT_VALID (m_pDraggedWnd); m_pFinalTargetBar = NULL; if (m_pDraggedWnd == NULL || m_pDockManager == NULL) { return; } if (m_pWndDummy == NULL) { m_pWndDummy = new CBCGPDummyDockingControlBar; m_pWndDummy->CreateEx (0, _T (""), BCGCBProGetTopLevelFrame (m_pDraggedWnd), CRect (0, 0, 0, 0), FALSE, BCGP_DUMMY_WND_ID, WS_CHILD); } CSize szSencitivity = CBCGPDockingControlBar::GetDragSencitivity (); CPoint ptMouse; GetCursorPos (&ptMouse); CPoint ptOffset = ptMouse - m_ptHot; if (abs (ptOffset.x) < szSencitivity.cx && abs (ptOffset.y) < szSencitivity.cy && m_rectDrag.IsRectEmpty () && !bForceMove) { return; } m_bDragStarted = TRUE; m_pDockManager->LockUpdate (TRUE); CRect rectOld = m_rectExpectedDocked.IsRectEmpty () ? m_rectDrag : m_rectExpectedDocked; BOOL bFirstTime = FALSE; if (m_rectDrag.IsRectEmpty ()) { if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPMiniFrameWnd))) { m_pDraggedWnd->GetWindowRect (m_rectDrag); } else if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPControlBar))) { CBCGPControlBar* pBar = DYNAMIC_DOWNCAST (CBCGPControlBar, m_pDraggedWnd); ASSERT_VALID (pBar); m_pDraggedWnd->GetWindowRect (m_rectDrag); // if the bar is docked then the floating rect has to be set to recent floating rect if (pBar->GetParentMiniFrame () == NULL) { m_rectDrag.right = m_rectDrag.left + pBar->m_recentDockInfo.m_rectRecentFloatingRect.Width (); m_rectDrag.bottom = m_rectDrag.top + pBar->m_recentDockInfo.m_rectRecentFloatingRect.Height (); } if (!m_rectDrag.PtInRect (m_ptHot)) { int nOffset = m_rectDrag.left - m_ptHot.x; m_rectDrag.OffsetRect (-nOffset - 5, 0); // offset of mouse pointer // from the drag rect bound } } bFirstTime = TRUE; } BOOL bDrawTab = FALSE; CBCGPDockingControlBar* pOldTargetBar = m_pTargetBar; CRect rectExpected; rectExpected.SetRectEmpty (); CBCGPSmartDockingManager* pSDManager = NULL; BOOL bSDockingIsOn = FALSE; if (m_pDockManager != NULL && (pSDManager = m_pDockManager->GetSDManagerPermanent()) != NULL && pSDManager->IsStarted()) { bSDockingIsOn = TRUE; } m_pDockManager->CalcExpectedDockedRect (m_pDraggedWnd, ptMouse, rectExpected, bDrawTab, &m_pTargetBar); if (pOldTargetBar != NULL && m_nInsertedTabID != -1 && (pOldTargetBar != m_pTargetBar || !bDrawTab)) { RemoveTabPreDocking (pOldTargetBar); bFirstTime = TRUE; } BOOL bCanBeAttached = TRUE; if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPMiniFrameWnd)))//.........这里部分代码省略.........
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:101,
示例18: timeGetTimebool CGUIDialogKeyboard::OnAction(const CAction &action){ // check if we're doing a search, and if so, interrupt the search timer. DWORD now = timeGetTime(); if (m_lastSearchUpdate || m_lastSearchUpdate + SEARCH_DELAY >= now) m_lastSearchUpdate = now; if (action.wID == ACTION_BACKSPACE#ifdef __APPLE__ || action.wID == ACTION_PARENT_DIR#endif ) { Backspace(); return true; } else if (action.wID == ACTION_ENTER) { OnOK(); return true; } else if (action.wID == ACTION_CURSOR_LEFT) { MoveCursor( -1); return true; } else if (action.wID == ACTION_CURSOR_RIGHT) { if ((unsigned int) GetCursorPos() == m_strEdit.size() && (m_strEdit.size() == 0 || m_strEdit[m_strEdit.size() - 1] != ' ')) { // add a space Character(L' '); } else MoveCursor(1); return true; } else if (action.wID == ACTION_SHIFT) { OnShift(); return true; } else if (action.wID == ACTION_SYMBOLS) { OnSymbols(); return true; } else if (action.wID >= REMOTE_0 && action.wID <= REMOTE_9) { OnRemoteNumberClick(action.wID); return true; } else if (action.wID >= (WORD)KEY_VKEY && action.wID < (WORD)KEY_ASCII) { // input from the keyboard (vkey, not ascii) BYTE b = action.wID & 0xFF; if (b == 0x25) MoveCursor( -1); // left else if (b == 0x27) MoveCursor(1); // right else if (b == 0x0D) OnOK(); // enter else if (b == 0x08) Backspace(); // backspace else if (b == 0x1B) Close(); // escape else if (b == 0x20) Character(b); // space return true; } else if (action.wID >= KEY_ASCII) { // input from the keyboard //char ch = action.wID & 0xFF; switch (action.unicode) { case 13: // enter case 10: // enter OnOK(); break; case 8: // backspace Backspace(); break; case 27: // escape Close(); break; default: //use character input Character(action.unicode); break; } return true; } return CGUIDialog::OnAction(action);}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:85,
示例19: GetCursorPos//// Process mouse click in the target list. For a worker, assign the selected// target. For a manager, distribute the assigned targets among its net servers.//void CPageNetwork::OnClickTTargets(NMHDR* pNMHDR, LRESULT* pResult) { CPoint point; TV_HITTESTINFO test_info; TargetSelType state; // Get the cursor position. GetCursorPos( &point ); test_info.pt = point; m_TTargets.ScreenToClient( &(test_info.pt) ); // Check to see whether the cursor is on an item. m_TTargets.HitTest( &test_info ); // Check that we have an interface item. if ( !test_info.hItem || !m_TTargets.GetParentItem( test_info.hItem ) ) return; // A new target assignment is being made. Clear the results since they are // for a configuration we no longer have. theApp.pView->ResetDisplayforNewTest(); // Toggle the selection if the control key is pressed. if ( GetKeyState( VK_CONTROL ) & 0x8000 && GetSelectionCheck( test_info.hItem ) == TargetChecked ) { state = TargetUnChecked; } else { state = TargetChecked; } switch ( theApp.pView->m_pWorkerView->GetSelectedType() ) { case WORKER: // All clicks work the same for the worker. SelectRange( test_info.hItem, test_info.hItem, TRUE, state ); break; case MANAGER: // A shift click extends the selection from the last selected item // to the currently focused item. When the control key is also // pressed, any previous selection is not cleared. if ( (GetKeyState( VK_SHIFT ) & 0x8000 ) && selected ) { // We have a previous item (not the first click) and the shift // key is down. SelectRange( selected, test_info.hItem, !(GetKeyState( VK_CONTROL ) & 0x8000) ); } else if ( GetKeyState( VK_CONTROL ) & 0x8000 ) { // The control key is down. SelectRange( test_info.hItem, test_info.hItem, FALSE, state ); } else { SelectRange( test_info.hItem, test_info.hItem, TRUE, state ); } break; default: ErrorMessage( "Unexpected selection type in CPageNetwork::" "OnClickTTargets()." ); return; } // immediately refresh the display (create/delete NetClients as needed) StoreTargetSelection(); ShowSettings(); EnableWindow(); *pResult = 0;}
开发者ID:BackupTheBerlios,项目名称:iometer-svn,代码行数:77,
示例20: timeGetTimevoid CNewRandom::Initialize(){ ++g_dwNewRandomInstanceCounter; DWORD dw; dw = timeGetTime(); AddRandomObject(&dw, 4); LARGE_INTEGER li; QueryPerformanceCounter(&li); AddRandomObject(&li, sizeof(LARGE_INTEGER)); SYSTEMTIME st; ZeroMemory(&st, sizeof(SYSTEMTIME)); GetLocalTime(&st); AddRandomObject(&st, sizeof(SYSTEMTIME)); POINT pt; GetCursorPos(&pt); AddRandomObject(&pt, sizeof(POINT)); WORD ww; ww = (WORD)(rand()); AddRandomObject(&ww, 2); ww = (WORD)(rand()); AddRandomObject(&ww, 2); ww = (WORD)(rand()); AddRandomObject(&ww, 2); GetCaretPos(&pt); AddRandomObject(&pt, sizeof(POINT)); MEMORYSTATUS ms; GlobalMemoryStatus(&ms); AddRandomObject(&ms, sizeof(MEMORYSTATUS)); dw = (DWORD)(UINT_PTR)GetActiveWindow(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetCapture(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetClipboardOwner(); AddRandomObject(&dw, 4);#ifndef _WIN32_WCE // No support under Windows CE dw = (DWORD)(UINT_PTR)GetClipboardViewer(); AddRandomObject(&dw, 4);#endif dw = GetCurrentProcessId(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetCurrentProcess(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetActiveWindow(); AddRandomObject(&dw, 4); dw = GetCurrentThreadId(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetCurrentThread(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetDesktopWindow(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetFocus(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetForegroundWindow(); AddRandomObject(&dw, 4);#ifndef _WIN32_WCE dw = (DWORD)GetInputState(); AddRandomObject(&dw, 4); #endif dw = GetMessagePos(); AddRandomObject(&dw, 4);#ifndef _WIN32_WCE dw = (DWORD)GetMessageTime(); AddRandomObject(&dw, 4);#endif dw = (DWORD)(UINT_PTR)GetOpenClipboardWindow(); AddRandomObject(&dw, 4); dw = (DWORD)(UINT_PTR)GetProcessHeap(); AddRandomObject(&dw, 4); SYSTEM_INFO si; GetSystemInfo(&si); AddRandomObject(&si, sizeof(SYSTEM_INFO)); dw = (DWORD)randXorShift(); AddRandomObject(&dw, 4);//.........这里部分代码省略.........
开发者ID:xt9852,项目名称:KeePassXT,代码行数:101,
示例21: DlgProcIconImport//.........这里部分代码省略......... ImageList_DragEnter(hwndDragOver, ptDrag.x, ptDrag.y); } ImageList_DragMove(ptDrag.x, ptDrag.y); if (hwndOver == hPPreview) { ScreenToClient(hPPreview, &lvhti.pt); if (ListView_HitTest(hPPreview, &lvhti) != -1) { if (lvhti.iItem != dropHiLite) { ImageList_DragLeave(hwndDragOver); if (dropHiLite != -1) ListView_SetItemState(hPPreview, dropHiLite, 0, LVIS_DROPHILITED); dropHiLite = lvhti.iItem; ListView_SetItemState(hPPreview, dropHiLite, LVIS_DROPHILITED, LVIS_DROPHILITED); UpdateWindow(hPPreview); ImageList_DragEnter(hwndDragOver, ptDrag.x, ptDrag.y); } onItem = 1; } } if (!onItem && dropHiLite != -1) { ImageList_DragLeave(hwndDragOver); ListView_SetItemState(hPPreview, dropHiLite, 0, LVIS_DROPHILITED); UpdateWindow(hPPreview); ImageList_DragEnter(hwndDragOver, ptDrag.x, ptDrag.y); dropHiLite = -1; } MySetCursor(onItem ? IDC_ARROW : IDC_NO); } break; case WM_LBUTTONUP: if (dragging) { ReleaseCapture(); ImageList_EndDrag(); dragging = 0; if (dropHiLite != -1) { TCHAR path[MAX_PATH], fullPath[MAX_PATH], filename[MAX_PATH]; LVITEM lvi; GetDlgItemText(hwndDlg, IDC_ICONSET, fullPath, SIZEOF(fullPath)); PathToRelativeT(fullPath, filename); lvi.mask = LVIF_PARAM; lvi.iItem = dragItem; lvi.iSubItem = 0; ListView_GetItem(hPreview, &lvi); mir_sntprintf(path, SIZEOF(path), _T("%s,%d"), filename, (int)lvi.lParam); SendMessage(hwndParent, DM_CHANGEICON, dropHiLite, (LPARAM)path); ListView_SetItemState( GetDlgItem(hwndParent, IDC_PREVIEW), dropHiLite, 0, LVIS_DROPHILITED); } } break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case IDC_PREVIEW: switch (((LPNMHDR)lParam)->code) { case LVN_BEGINDRAG: SetCapture(hwndDlg); dragging = 1; dragItem = ((LPNMLISTVIEW)lParam)->iItem; dropHiLite = -1; ImageList_BeginDrag(ListView_GetImageList(hPreview, LVSIL_NORMAL), dragItem, GetSystemMetrics(SM_CXICON)/2, GetSystemMetrics(SM_CYICON)/2); { POINT pt; RECT rc; GetCursorPos(&pt); GetWindowRect(hwndDlg, &rc); ImageList_DragEnter(hwndDlg, pt.x - rc.left, pt.y - rc.top); hwndDragOver = hwndDlg; } break; } break; } break; case WM_SIZE: // make the dlg resizeable if (!IsIconic(hwndDlg)) { UTILRESIZEDIALOG urd = {0}; urd.cbSize = sizeof(urd); urd.hInstance = hInst; urd.hwndDlg = hwndDlg; urd.lParam = 0; // user-defined urd.lpTemplate = MAKEINTRESOURCEA(IDD_ICOLIB_IMPORT); urd.pfnResizer = IconDlg_Resize; CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd); } break; case WM_CLOSE: DestroyWindow(hwndDlg); EnableWindow( GetDlgItem(hwndParent, IDC_IMPORT), TRUE); break; } return FALSE;}
开发者ID:martok,项目名称:miranda-ng,代码行数:101,
示例22: gather_random_faststatic intgather_random_fast( void (*add)(const void*, size_t, int), int requester ){ static int addedFixedItems = 0; if ( debug_me ) log_debug ("rndw32#gather_random_fast: req=%d/n", requester ); /* Get various basic pieces of system information: Handle of active * window, handle of window with mouse capture, handle of clipboard owner * handle of start of clpboard viewer list, pseudohandle of current * process, current process ID, pseudohandle of current thread, current * thread ID, handle of desktop window, handle of window with keyboard * focus, whether system queue has any events, cursor position for last * message, 1 ms time for last message, handle of window with clipboard * open, handle of process heap, handle of procs window station, types of * events in input queue, and milliseconds since Windows was started */ { byte buffer[20*sizeof(ulong)], *bufptr; bufptr = buffer; #define ADD(f) do { ulong along = (ulong)(f); / memcpy (bufptr, &along, sizeof (along) ); / bufptr += sizeof (along); } while (0) ADD ( GetActiveWindow ()); ADD ( GetCapture ()); ADD ( GetClipboardOwner ()); ADD ( GetClipboardViewer ()); ADD ( GetCurrentProcess ()); ADD ( GetCurrentProcessId ()); ADD ( GetCurrentThread ()); ADD ( GetCurrentThreadId ()); ADD ( GetDesktopWindow ()); ADD ( GetFocus ()); ADD ( GetInputState ()); ADD ( GetMessagePos ()); ADD ( GetMessageTime ()); ADD ( GetOpenClipboardWindow ()); ADD ( GetProcessHeap ()); ADD ( GetProcessWindowStation ()); ADD ( GetQueueStatus (QS_ALLEVENTS)); ADD ( GetTickCount ()); assert ( bufptr-buffer < sizeof (buffer) ); (*add) ( buffer, bufptr-buffer, requester ); #undef ADD } /* Get multiword system information: Current caret position, current * mouse cursor position */ { POINT point; GetCaretPos (&point); (*add) ( &point, sizeof (point), requester ); GetCursorPos (&point); (*add) ( &point, sizeof (point), requester ); } /* Get percent of memory in use, bytes of physical memory, bytes of free * physical memory, bytes in paging file, free bytes in paging file, user * bytes of address space, and free user bytes */ { MEMORYSTATUS memoryStatus; memoryStatus.dwLength = sizeof (MEMORYSTATUS); GlobalMemoryStatus (&memoryStatus); (*add) ( &memoryStatus, sizeof (memoryStatus), requester ); } /* Get thread and process creation time, exit time, time in kernel mode, and time in user mode in 100ns intervals */ { HANDLE handle; FILETIME creationTime, exitTime, kernelTime, userTime; DWORD minimumWorkingSetSize, maximumWorkingSetSize; handle = GetCurrentThread (); GetThreadTimes (handle, &creationTime, &exitTime, &kernelTime, &userTime); (*add) ( &creationTime, sizeof (creationTime), requester ); (*add) ( &exitTime, sizeof (exitTime), requester ); (*add) ( &kernelTime, sizeof (kernelTime), requester ); (*add) ( &userTime, sizeof (userTime), requester ); handle = GetCurrentProcess (); GetProcessTimes (handle, &creationTime, &exitTime, &kernelTime, &userTime); (*add) ( &creationTime, sizeof (creationTime), requester ); (*add) ( &exitTime, sizeof (exitTime), requester ); (*add) ( &kernelTime, sizeof (kernelTime), requester ); (*add) ( &userTime, sizeof (userTime), requester ); /* Get the minimum and maximum working set size for the current process */ GetProcessWorkingSetSize (handle, &minimumWorkingSetSize, &maximumWorkingSetSize); (*add) ( &minimumWorkingSetSize, sizeof (&minimumWorkingSetSize), requester ); (*add) ( &maximumWorkingSetSize, sizeof (&maximumWorkingSetSize), requester ); } /* The following are fixed for the lifetime of the process so we only * add them once */ if (!addedFixedItems) { STARTUPINFO startupInfo;//.........这里部分代码省略.........
开发者ID:BridgeNY,项目名称:purdue,代码行数:101,
示例23: doFlyEffectvoid doFlyEffect(LICE_IBitmap *fb, HWND hwnd){ static int initted; if (!initted) { initted=1; cam = new pl_Cam; cam->Fov=90.0; cam->WantZBuffer=true; if (cam->WantZBuffer) cam->Sort = -1; cam->Y = 800; // move the camera up from the ground cam->Pitch = 180.0; setup_materials(mat); // intialize materials and palette land = setup_landscape(mat[0],mat[1],mat[2]); // create landscape sky = land->Children.Get(0); // unhierarchicalize the sky from the land land->Children.Delete(0); sky2 = land->Children.Get(0); land->Children.Delete(0); int x; for(x=0; x<sizeof(lights)/sizeof(lights[0]); x++) { lights[x].Set(PL_LIGHT_POINT,(x%4 - 1.5) * LAND_SIZE /4.0, 500+(rand()%1000), (x/4-1.5)*LAND_SIZE/4.0,(rand()%1000)/700.0,(rand()%1000)/700.0,(rand()%1000)/700.0,LAND_SIZE*1.0); } } LICE_Clear(fb,0); cam->Begin(fb); int x; for(x=0; x<sizeof(lights)/sizeof(lights[0]); x++) cam->RenderLight(&lights[x]); // lots of rendering special casing if (draw_sky) { // if we're drawing the sky if (cam->Y > 2000) { // if above the sky, only render the skies, with // no far clip plane cam->RenderObject(sky); cam->RenderObject(sky2); } else { // otherwise, render the sky (but not the second sky), // and the land, with a far clip plane cam->RenderObject(sky); cam->RenderObject(land); } } else { // not drawing sky, just render the land cam->RenderObject(land); } cam->End(); // finish rendering static POINT lpos; POINT p; GetCursorPos(&p); int mouse_x = 0; int mouse_y = 0; int mouse_b=0; if (hwnd) { mouse_x = p.x-lpos.x; mouse_y = p.y-lpos.y; if (GetAsyncKeyState(VK_LBUTTON)&0x8000) mouse_b|=2; RECT r; GetWindowRect(hwnd,&r); p.x=(r.right+r.left)/2; p.y=(r.bottom+r.top)/2; SetCursorPos(p.x,p.y); } lpos=p; // We calculate the amount of time in thousanths of seconds this frame took double prevtime = 10; //((uclock() / (float) UCLOCKS_PER_SEC) - prevtime)*1000.0; if (mouse_b & 2) { // if right button hit, we go forward quickly cam->X -= prevtime*4*sin(cam->Pan*PL_PI/180.0)*cos(cam->Pitch*PL_PI/180.0); cam->Z += prevtime*4*cos(cam->Pan*PL_PI/180.0)*cos(cam->Pitch*PL_PI/180.0); cam->Y += prevtime*4*sin(cam->Pitch*PL_PI/180.0); } else if (mouse_b & 1) { // if left button hit, we go forward slowly cam->X -= prevtime*2*sin(cam->Pan*PL_PI/180.0)*cos(cam->Pitch*PL_PI/180.0); cam->Z += prevtime*2*cos(cam->Pan*PL_PI/180.0)*cos(cam->Pitch*PL_PI/180.0); cam->Y += prevtime*2*sin(cam->Pitch*PL_PI/180.0); } cam->Pitch += (mouse_y*mouse_sens); // update pitch and pan of ship cam->Pan += (mouse_x*mouse_sens)*(-cos(cam->Pitch*PL_PI/180.0)); if (cam->X > LAND_SIZE/2) cam->X = LAND_SIZE/2; // make sure we don't go//.........这里部分代码省略.........
开发者ID:modulexcite,项目名称:licecap-1,代码行数:101,
示例24: DialogProcLRESULT CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){ switch (message) { case WM_INITDIALOG: Init(hDlg); return TRUE; case WM_COMMAND: { int id = LOWORD(wParam); if (id == IDC_BUTTON_START) { server.Start(); } if (id == ID_NOTITYICONMENU_EXIT) // 点击退出菜单,退出应用 { Shell_NotifyIcon(NIM_DELETE,&g_nid); EndDialog(hDlg, 0); } break; } case WM_SYSCOMMAND: if (wParam == SC_CLOSE) // 暂时隐藏程序,不退出 { ShowWindow(g_hMainWnd, SW_HIDE); } break; case WM_AIRSOUND_NOTIFY: if(wParam == IDC_NOTIFYICON) { if(lParam == WM_LBUTTONDOWN) { ShowWindow(g_hMainWnd, SW_SHOWNORMAL); SetForegroundWindow(g_hMainWnd); return TRUE; } if (lParam == WM_RBUTTONDOWN) { HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU_NOTIFYICON)); POINT point; GetCursorPos(&point); TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, point.x, point.y, 0, g_hMainWnd, NULL); PostMessage(g_hMainWnd, WM_NULL, NULL, NULL); } } case WM_PAINT: { BOOL bCompEnabled; DwmIsCompositionEnabled(&bCompEnabled); if (bCompEnabled) { PAINTSTRUCT ps; HDC hDC = BeginPaint(g_hMainWnd, &ps); RECT rcClient; GetClientRect(g_hMainWnd, &rcClient); HBRUSH hBrush = CreateSolidBrush(RGB(0, 0, 0)); FillRect(hDC, &rcClient, hBrush); DrawGlowingText(hDC, IDC_STATIC); EndPaint(g_hMainWnd, &ps); } } break; } return FALSE;}
开发者ID:EndlessCheng,项目名称:AirSound,代码行数:73,
示例25: definedvoidCMainFrame::updateImageInfo(){ const CFlyCapDoc* pDoc = (CFlyCapDoc*)GetActiveDocument(); CView* pView = (CView*)GetActiveView(); if( m_wndStatusBar && pDoc != NULL && pView != NULL ) { char pszText[ 64 ]; if( m_ImageInfoMode == TIMESTAMP ) { // Setup the timestamp information FlyCaptureTimestamp timeStamp = pDoc->m_imageRaw.timeStamp; #if defined (WIN64) __time64_t tmpTime = timeStamp.ulSeconds; char* pszTemp = ::_ctime64( &tmpTime );#elif defined (WIN32) time_t lTemp = timeStamp.ulSeconds; char* pszTemp = ::ctime( &lTemp );#else#error ** No time conversion **#endif if( pszTemp == NULL ) { return; } int iMilliSec = timeStamp.ulMicroSeconds / 1000; sprintf( pszText, "%.19s.%.03d %s (%03u,%04u)/n", pszTemp, iMilliSec, &pszTemp[ 20 ], timeStamp.ulCycleSeconds, timeStamp.ulCycleCount ); } else if( m_ImageInfoMode == CURSOR ) { // Setup the cursor and image information CRect rect; CPoint pt; COLORREF cr; int iWidth = 0; int iHeight = 0; int iSBOffsetX = 0; // the offset of the horizontal scrollbar int iSBOffsetY = 0; // the offset of the vertical scrollbar // get the position of the scroll bars. // used to calculate the co-ordinates of the image. iSBOffsetX = pView->GetScrollPos(SB_HORZ); iSBOffsetY = pView->GetScrollPos(SB_VERT); pDoc->getImageSize( &iWidth, &iHeight ); CDC* pDC = pView->GetDC(); pDC->GetClipBox( &rect ); GetCursorPos( &pt ); pView->ScreenToClient( &pt ); cr = GetPixel( pDC->GetSafeHdc(), pt.x, pt.y ); pView->ReleaseDC( pDC ); // Check that this window is active and // that the cursor is within bounds of the clipping rect if( this == GetActiveWindow() && pt.x >= 0 && pt.x < rect.Width() && pt.y >= 0 && pt.y < rect.Height() ) { sprintf( pszText, "Image(%dx%d) Cursor(%d,%d) RGB(%u,%u,%u)", iWidth, iHeight, pt.x + iSBOffsetX, pt.y + iSBOffsetY, cr & 0xFF, (cr & 0xFF00) >> 8, (cr & 0xFF0000) >> 16 ); }
开发者ID:PrincetonPAVE,项目名称:old_igvc,代码行数:78,
示例26: EventArea_WndProcstatic LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ switch(msg) { case WM_MEASUREITEM: { MEASUREITEMSTRUCT *lpi = (LPMEASUREITEMSTRUCT) lParam; MENUITEMINFOA mii = {0}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA | MIIM_ID; if (GetMenuItemInfoA(g_CluiData.hMenuNotify, lpi->itemID, FALSE, &mii) != 0) { if (mii.dwItemData == lpi->itemData) { lpi->itemWidth = 8 + 16; lpi->itemHeight = 0; return TRUE; } } } break; case WM_DRAWITEM: { LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT) lParam; if (dis->hwndItem == (HWND) g_CluiData.hMenuNotify) { NotifyMenuItemExData *nmi = 0; MENUITEMINFOA mii = {0}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA; if (GetMenuItemInfoA(g_CluiData.hMenuNotify, (UINT) dis->itemID, FALSE, &mii) != 0) { nmi = (NotifyMenuItemExData *) mii.dwItemData; if (nmi) { int iIcon = cli_GetContactIcon(nmi->hContact); ske_ImageList_DrawEx(g_himlCListClc, nmi->iIcon, dis->hDC, 2, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL); ske_ImageList_DrawEx(g_himlCListClc, iIcon, dis->hDC, 2+GetSystemMetrics(SM_CXSMICON)+2, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL); return TRUE; } } } break; } case WM_LBUTTONUP: if (g_CluiData.bEventAreaEnabled) SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_NOTIFYBUTTON, 0), 0); break; case WM_COMMAND: if (LOWORD(wParam) == IDC_NOTIFYBUTTON) { int iSelection; MENUITEMINFO mii = {0}; POINT pt; struct NotifyMenuItemExData *nmi = 0; int iCount = GetMenuItemCount(g_CluiData.hMenuNotify); BOOL result; GetCursorPos(&pt); mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA; if (iCount > 1) iSelection = TrackPopupMenu(g_CluiData.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL); else iSelection = GetMenuItemID(g_CluiData.hMenuNotify, 0); result = GetMenuItemInfo(g_CluiData.hMenuNotify, (UINT) iSelection, FALSE, &mii); if (result != 0) { nmi = (struct NotifyMenuItemExData *) mii.dwItemData; if (nmi) { CLISTEVENT *cle = MyGetEvent(iSelection); if (cle) { CLISTEVENT *cle1 = NULL; CallService(cle->pszService, (WPARAM) NULL, (LPARAM) cle); // re-obtain the pointer, it may already be invalid/point to another event if the // event we're interested in was removed by the service (nasty one...) cle1 = MyGetEvent(iSelection); if (cle1 != NULL) CallService(MS_CLIST_REMOVEEVENT, (WPARAM) cle->hContact, (LPARAM) cle->hDbEvent); } } } break; } break; case WM_SIZE: if (!g_CluiData.fLayered) InvalidateRect(hwnd,NULL,FALSE); return DefWindowProc(hwnd, msg, wParam, lParam); case WM_ERASEBKGND: return 1; case WM_PAINT: if (GetParent(hwnd) == pcli->hwndContactList && g_CluiData.fLayered) CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE,(WPARAM)hwnd,0); else if (GetParent(hwnd) == pcli->hwndContactList && !g_CluiData.fLayered) { HDC hdc, hdc2; HBITMAP hbmp,hbmpo; RECT rc = {0}; GetClientRect(hwnd,&rc); rc.right++; rc.bottom++;//.........这里部分代码省略.........
开发者ID:0xmono,项目名称:miranda-ng,代码行数:101,
示例27: handle_mousestatic void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf){ int i; Sint16 xrel, yrel; Uint8 state; Uint8 button; DWORD timestamp = 0; /* Sanity check. Mailing list reports this being NULL unexpectedly. */ if (SDL_PublicSurface == NULL) { return; } /* If the mouse was lost, regain some sense of mouse state */ if ( mouse_lost && (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) { POINT mouse_pos; Uint8 old_state; Uint8 new_state; /* Set ourselves up with the current cursor position */ GetCursorPos(&mouse_pos); ScreenToClient(SDL_Window, &mouse_pos); post_mouse_motion( 0, (Sint16)mouse_pos.x, (Sint16)mouse_pos.y); /* Check for mouse button changes */ old_state = SDL_GetMouseState(NULL, NULL); new_state = 0; { /* Get the new DirectInput button state for the mouse */#if DIRECTINPUT_VERSION >= 0x700 DIMOUSESTATE2 distate;#else DIMOUSESTATE distate;#endif HRESULT result; result=IDirectInputDevice2_GetDeviceState(SDL_DIdev[1], sizeof(distate), &distate); if ( result != DI_OK ) { /* Try again next time */ SetDIerror( "IDirectInputDevice2::GetDeviceState", result); return; } for ( i=3; i>=0; --i ) { if ( (distate.rgbButtons[i]&0x80) == 0x80 ) { new_state |= 0x01; } new_state <<= 1; } } for ( i=0; i<8; ++i ) { if ( (old_state&0x01) != (new_state&0x01) ) { button = (Uint8)(i+1); /* Map DI button numbers to SDL */ switch ( button ) { case 2: button = SDL_BUTTON_RIGHT; break; case 3: button = SDL_BUTTON_MIDDLE; break; case 4: button = SDL_BUTTON_X1; break; case 5: button = SDL_BUTTON_X2; break; default: break; } if ( new_state & 0x01 ) { /* Grab mouse so we get mouse-up */ if ( ++mouse_pressed > 0 ) { SetCapture(SDL_Window); } state = SDL_PRESSED; } else { /* Release mouse after all mouse-ups */ if ( --mouse_pressed <= 0 ) { ReleaseCapture(); mouse_pressed = 0; } state = SDL_RELEASED; } if ( mouse_buttons_swapped ) { if ( button == 1 ) button = 3; else if ( button == 3 ) button = 1; } posted = SDL_PrivateMouseButton(state, button, 0, 0); } old_state >>= 1; new_state >>= 1; } mouse_lost = 0; return; }
开发者ID:3bu1,项目名称:crossbridge,代码行数:89,
示例28: ON_MOUSE_PRESS_RELEASEvoid AppClass::ProcessMouse(void){ m_bArcBall = false; m_bFPC = false; float fSpeed = 0.01f;#pragma region ON_MOUSE_PRESS_RELEASE static bool bLastLeft = false, bLastMiddle = false, bLastRight = false;#define ON_MOUSE_PRESS_RELEASE(key, pressed_action, released_action){ / bool pressed = sf::Mouse::isButtonPressed(sf::Mouse::Button::key); / if(pressed){ / if(!bLast##key) pressed_action;}/*Just pressed? *// else if(bLast##key) released_action;/*Just released?*// bLast##key = pressed; } //remember the state#pragma endregion bool bLeft = false; ON_MOUSE_PRESS_RELEASE(Left, NULL, bLeft = true) if (bLeft) { //Turn off the visibility of all BOs for all instances m_pMeshMngr->SetVisibleBO(BD_NONE, "ALL", -1); //Get the Position and direction of the click on the screen std::pair<vector3, vector3> pair = m_pCameraMngr->GetClickAndDirectionOnWorldSpace(sf::Mouse::getPosition().x, sf::Mouse::getPosition().y); float fDistance = 0;//Stores the distance to the first colliding object m_selection = m_pMeshMngr->IsColliding(pair.first, pair.second, fDistance); //If there is a collision if (m_selection.first >= 0) { //Turn on the BO of the group m_pMeshMngr->SetVisibleBO(BD_OB, m_selection.first, m_selection.second); //Turn of the BO of the instance but not the group m_pMeshMngr->SetVisibleBO(BD_NONE, m_selection.first, -2); } } if(sf::Mouse::isButtonPressed(sf::Mouse::Button::Middle)) m_bArcBall = true; if(sf::Mouse::isButtonPressed(sf::Mouse::Button::Right)) m_bFPC = true; if (m_bFPC) { //the following code is taken from ReEngAppClass.h CameraRotation ln 351 UINT MouseX, MouseY; // Coordinates for the mouse UINT CenterX, CenterY; // Coordinates for the center of the screen. //Initialize the position of the pointer to the middle of the screen CenterX = m_pSystem->GetWindowX() + m_pSystem->GetWindowWidth() / 2; CenterY = m_pSystem->GetWindowY() + m_pSystem->GetWindowHeight() / 2; //Calculate the position of the mouse and store it POINT pt; GetCursorPos(&pt); MouseX = pt.x; MouseY = pt.y; //Calculate the difference in view with the angle float fAngleX = 0.0f; float fAngleY = 0.0f; float fDeltaMouse = 0.0f; if (MouseX < CenterX) { fDeltaMouse = static_cast<float>(CenterX - MouseX); fAngleY += fDeltaMouse * fSpeed; } else if (MouseX > CenterX) { fDeltaMouse = static_cast<float>(MouseX - CenterX); fAngleY -= fDeltaMouse * fSpeed; } if (MouseY < CenterY) { fDeltaMouse = static_cast<float>(CenterY - MouseY); fAngleX -= fDeltaMouse * fSpeed; } else if (MouseY > CenterY) { fDeltaMouse = static_cast<float>(MouseY - CenterY); fAngleX += fDeltaMouse * fSpeed; } //Change the Yaw and the Pitch of the camera myCam->ChangeYaw(-fAngleY * 3.0f); myCam->ChangePitch(fAngleX * 3.0f); SetCursorPos(CenterX, CenterY);//Position the mouse in the center }}
开发者ID:ToothlessHawkins,项目名称:ReEngineApp_2015s,代码行数:89,
示例29: MUS_RenewMousevoid MUS_RenewMouse( HWND hwnd, int active, int Flag_MenuSelected ){ int i; int x,y; int mx,my; MOUSE_CHECK *mc; POINT mp; static int bl=OFF,bm=OFF,br=OFF; static int lcnt=0, mcnt=0, rcnt=0; int rect_err; GetCursorPos( &mp ); ScreenToClient( hwnd, &mp ); MouseStruct.mx = mx = mp.x; MouseStruct.my = my = mp.y; x = mx-400; y = my-300; MouseStruct.interval = x*x + y*y; MouseStruct.active = active; rect_err = !(0 < mx && 0 < my && MouseStruct.disp_w >= mx && MouseStruct.disp_h >= my); MouseStruct.no = -1; if( !rect_err ){ for(i=0; i<MOUSE_REST_MAX ;i++){ mc = &MouseCheck[MouseStruct.lno][i]; if( mc->flag ){ if( mc->sx <= mx && mc->sy <= my && mc->sx+mc->w > mx && mc->sy+mc->h > my ){ MouseStruct.no = i; break; } } } } MouseStruct.wheel = MouseStruct.wheel_get; if( MouseStruct.wheel_get ){ MouseStruct.wheel_get = 0; } if( !MouseStruct.click_through && active ){ if(MouseStruct.same_time){ if( !(MouseStruct.bl || MouseStruct.br || MouseStruct.bm) ){ MouseStruct.bl = (GetAsyncKeyState(VK_LBUTTON)&0x8001)?ON:OFF; if( !MouseStruct.bl ){ MouseStruct.br = (GetAsyncKeyState(VK_RBUTTON)&0x8001)?ON:OFF; if( !MouseStruct.br ){ MouseStruct.bm = (GetAsyncKeyState(VK_MBUTTON)&0x8001)?ON:OFF; } } }else{ if(MouseStruct.bl) MouseStruct.bl = (GetAsyncKeyState(VK_LBUTTON)&0x8001)?ON:OFF; else GetAsyncKeyState(VK_LBUTTON); if(MouseStruct.br) MouseStruct.br = (GetAsyncKeyState(VK_RBUTTON)&0x8001)?ON:OFF; else GetAsyncKeyState(VK_RBUTTON); if(MouseStruct.bm) MouseStruct.bm = (GetAsyncKeyState(VK_MBUTTON)&0x8001)?ON:OFF; else GetAsyncKeyState(VK_MBUTTON); if( !(MouseStruct.bl || MouseStruct.br || MouseStruct.bm) ){ MouseStruct.bl = (GetAsyncKeyState(VK_LBUTTON)&0x8001)?ON:OFF; if( !MouseStruct.bl ){ MouseStruct.br = (GetAsyncKeyState(VK_RBUTTON)&0x8001)?ON:OFF; if( !MouseStruct.br ){ MouseStruct.bm = (GetAsyncKeyState(VK_MBUTTON)&0x8001)?ON:OFF; } } } } }else{ MouseStruct.bl = (GetAsyncKeyState(VK_LBUTTON)&0x8001)?ON:OFF; MouseStruct.br = (GetAsyncKeyState(VK_RBUTTON)&0x8001)?ON:OFF; MouseStruct.bm = (GetAsyncKeyState(VK_MBUTTON)&0x8001)?ON:OFF; } if(Flag_MenuSelected>0){ Flag_MenuSelected--; MouseStruct.bl = OFF; MouseStruct.br = OFF; MouseStruct.bm = OFF; } }else{ MouseStruct.click_through = 0; GetAsyncKeyState(VK_LBUTTON); GetAsyncKeyState(VK_RBUTTON); GetAsyncKeyState(VK_MBUTTON); } if( GetSystemMetrics(SM_SWAPBUTTON) ){ int work = MouseStruct.bl; MouseStruct.bl = MouseStruct.br; MouseStruct.br = work; } lcnt = (MouseStruct.bl) ? min(8,lcnt+1) : 0; rcnt = (MouseStruct.br) ? min(8,rcnt+1) : 0; mcnt = (MouseStruct.bm) ? min(8,mcnt+1) : 0; MouseStruct.btl = (lcnt==8) || (lcnt==1);//.........这里部分代码省略.........
开发者ID:0xrofi,项目名称:Aquaplus,代码行数:101,
注:本文中的GetCursorPos函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetDB函数代码示例 C++ GetCurrentTimestamp函数代码示例 |