本文整理汇总了C++中GET_Y_LPARAM函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_Y_LPARAM函数的具体用法?C++ GET_Y_LPARAM怎么用?C++ GET_Y_LPARAM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_Y_LPARAM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MsgProc
// The window's message handler
static LRESULT WINAPI MsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_KEYDOWN:
switch (wParam)
{
// use ESC to quit application
case VK_ESCAPE:
{
g_bDone = true;
PostQuitMessage(0);
return 0;
}
break;
// use space to pause playback
case VK_SPACE:
{
g_bRunning = !g_bRunning;
}
break;
}
break;
// resize the window
// even though we disable resizing (see next event handler below)
// we need to be able to handle this event properly because the
// windowing system calls it.
case WM_SIZE:
{
// store new window size in our globals.
g_nClientAreaWidth = GET_X_LPARAM(lParam);
g_nClientAreaHeight = GET_Y_LPARAM(lParam);
D3DVIEWPORT9 oViewport;
oViewport.X = 0;
oViewport.Y = 0;
oViewport.Width = g_nClientAreaWidth;
oViewport.Height = g_nClientAreaHeight;
oViewport.MaxZ = 1.0f;
oViewport.MinZ = 0.0f;
g_pD3DDevice->SetViewport(&oViewport);
D3DMATRIX oViewMatrix = {1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
};
// scale viewport to be of window width and height
oViewMatrix._11 = 2.0f/g_nClientAreaWidth;
oViewMatrix._22 = 2.0f/g_nClientAreaHeight;
// translate viewport so that lower left corner represents
// (0, 0) and upper right corner is (width, height)
oViewMatrix._41 = -1.0f - 1.0f / g_nClientAreaWidth;
oViewMatrix._42 = -1.0f + 1.0f / g_nClientAreaHeight;
if (0 != g_pD3DDevice)
{
g_pD3DDevice->SetTransform(D3DTS_VIEW, &oViewMatrix);
}
renderVideoFrame(hWnd, g_bUseInterop);
return 0; // Jump Back
}
// disallow resizing.
case WM_GETMINMAXINFO:
{
MINMAXINFO *pMinMaxInfo = reinterpret_cast<MINMAXINFO *>(lParam);
pMinMaxInfo->ptMinTrackSize.x = g_nWindowWidth;
pMinMaxInfo->ptMinTrackSize.y = g_nWindowHeight;
pMinMaxInfo->ptMaxTrackSize.x = g_nWindowWidth;
pMinMaxInfo->ptMaxTrackSize.y = g_nWindowHeight;
return 0;
}
case WM_DESTROY:
g_bDone = true;
PostQuitMessage(0);
return 0;
case WM_PAINT:
ValidateRect(hWnd, NULL);
return 0;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}
示例2: point
static inline POINT point(LPARAM lParam)
{
POINT point = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
return point;
}
示例3: winMWExtWMWindowProc
//.........这里部分代码省略.........
case WM_DESTROY:
#if CYGMULTIWINDOW_DEBUG
winDebug ("winMWExtWMWindowProc - WM_DESTROY\n");
#endif
/* Free the shaodw DC; which allows the bitmap to be freed */
DeleteDC (pRLWinPriv->hdcShadow);
pRLWinPriv->hdcShadow = NULL;
/* Free the shadow bitmap */
DeleteObject (pRLWinPriv->hbmpShadow);
pRLWinPriv->hbmpShadow = NULL;
/* Free the screen DC */
ReleaseDC (pRLWinPriv->hWnd, pRLWinPriv->hdcScreen);
pRLWinPriv->hdcScreen = NULL;
/* Free shadow buffer info header */
free (pRLWinPriv->pbmihShadow);
pRLWinPriv->pbmihShadow = NULL;
pRLWinPriv->fResized = FALSE;
pRLWinPriv->pfb = NULL;
free (pRLWinPriv);
RemoveProp (hwnd, WIN_WINDOW_PROP);
break;
case WM_MOUSEMOVE:
#if CYGMULTIWINDOW_DEBUG && 0
winDebug ("winMWExtWMWindowProc - WM_MOUSEMOVE\n");
#endif
/* Unpack the client area mouse coordinates */
ptMouse.x = GET_X_LPARAM(lParam);
ptMouse.y = GET_Y_LPARAM(lParam);
/* Translate the client area mouse coordinates to screen coordinates */
ClientToScreen (hwnd, &ptMouse);
/* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
ptMouse.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
ptMouse.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
/* We can't do anything without privates */
if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
break;
/* Has the mouse pointer crossed screens? */
if (pScreen != miPointerGetScreen(inputInfo.pointer))
miPointerSetScreen (inputInfo.pointer, pScreenInfo->dwScreen,
ptMouse.x - pScreenInfo->dwXOffset,
ptMouse.y - pScreenInfo->dwYOffset);
/* Are we tracking yet? */
if (!s_fTracking)
{
TRACKMOUSEEVENT tme;
/* Setup data structure */
ZeroMemory (&tme, sizeof (tme));
tme.cbSize = sizeof (tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hwnd;
/* Call the tracking function */
if (!(*g_fpTrackMouseEvent) (&tme))
ErrorF ("winMWExtWMWindowProc - _TrackMouseEvent failed\n");
示例4: globalPositionForEvent
static IntPoint globalPositionForEvent(HWND hWnd, LPARAM lParam)
{
POINT point = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
ClientToScreen(hWnd, &point);
return point;
}
示例5: switch
bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
{
switch(m->message) {
case MYWM_NOTIFYICON:
{
int message = 0;
QPoint gpos;
if (version == NOTIFYICON_VERSION_4) {
Q_ASSERT(q_uNOTIFYICONID == HIWORD(m->lParam));
message = LOWORD(m->lParam);
gpos = QPoint(GET_X_LPARAM(m->wParam), GET_Y_LPARAM(m->wParam));
} else {
Q_ASSERT(q_uNOTIFYICONID == m->wParam);
message = m->lParam;
gpos = QCursor::pos();
}
switch (message) {
case NIN_SELECT:
case NIN_KEYSELECT:
if (ignoreNextMouseRelease)
ignoreNextMouseRelease = false;
else
emit q->activated(QSystemTrayIcon::Trigger);
break;
case WM_LBUTTONDBLCLK:
ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse
// release we must ignore it
emit q->activated(QSystemTrayIcon::DoubleClick);
break;
case WM_CONTEXTMENU:
if (q->contextMenu()) {
q->contextMenu()->popup(gpos);
q->contextMenu()->activateWindow();
}
emit q->activated(QSystemTrayIcon::Context);
break;
case NIN_BALLOONUSERCLICK:
emit q->messageClicked();
break;
case WM_MBUTTONUP:
emit q->activated(QSystemTrayIcon::MiddleClick);
break;
default:
break;
}
break;
}
default:
if (m->message == MYWM_TASKBARCREATED)
trayMessage(NIM_ADD);
else
return QWidget::winEvent(m, result);
break;
}
return 0;
}
示例6: AdjustDisplayRectangle
int COXListPopup::Pick(CRect rect, CRect rectParent)
{
AdjustDisplayRectangle(rect, rectParent);
MoveWindow(rect);
ShowWindow(SW_SHOWNA);
SetCapture();
// init message loop
bool bBreak = false;
int iReturnItemIdx = -1;
while (!bBreak)
{
MSG msg;
VERIFY(::GetMessage(&msg, NULL, 0, 0));
if (msg.message == WM_LBUTTONUP)
{
// Get the item under the mouse cursor
int xPos = GET_X_LPARAM(msg.lParam);
int yPos = GET_Y_LPARAM(msg.lParam);
BOOL bOutside;
UINT nIndex = ItemFromPoint(CPoint(xPos, yPos), bOutside);
if (!bOutside)
iReturnItemIdx = (int) nIndex;
bBreak = true;
}
else if (msg.message == WM_KEYDOWN)
{
// Handle ESCAPE, UP, DOWN and ENTER
if (msg.wParam == VK_ESCAPE)
bBreak = true;
else if (msg.wParam == VK_UP)
{
int iSel = GetCurSel();
if (iSel == -1 || iSel == 0)
SetCurSel(0);
else
SetCurSel(iSel - 1);
}
else if (msg.wParam == VK_DOWN)
{
// Move the selection 1 item down
int iSel = GetCurSel();
if (iSel == -1)
SetCurSel(0);
else if (iSel == GetCount() - 1)
{
// Do nothing
}
else
SetCurSel(iSel + 1);
}
else if (msg.wParam == VK_RETURN)
{
iReturnItemIdx = GetCurSel();
bBreak = true;
}
}
else if (msg.message == WM_LBUTTONDOWN)
{
// Do nothing
}
else if (msg.message == WM_MOUSEMOVE)
{
// Select the item under the mouse cursor
int xPos = GET_X_LPARAM(msg.lParam);
int yPos = GET_Y_LPARAM(msg.lParam);
BOOL bOutside;
UINT nIndex = ItemFromPoint(CPoint(xPos, yPos), bOutside);
if (!bOutside)
SetCurSel((int) nIndex);
}
else
{
DispatchMessage(&msg);
}
}
ReleaseCapture();
ShowWindow(SW_HIDE);
return iReturnItemIdx;
}
示例7: WndProc
static LRESULT CALLBACK
WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
int redraw = 0;
switch (message) {
case WM_CHAR: {
switch (wparam) {
case '+':
the_scale *= 1.2f;
redraw = 1;
break;
case '-':
the_scale /= 1.2f;
redraw = 1;
break;
case 'f':
case 'F': {
float wscale, hscale;
wscale = win_width / (float)the_width;
hscale = win_height / (float)the_height;
the_scale *= wscale > hscale ? hscale : wscale;
redraw = 1;
break;
}
case '1':
the_scale = 1.0;
redraw = 1;
break;
case 'q':
case 'Q':
finish = 1;
break;
}
break;
}
case WM_PAINT: {
HFONT font;
BeginPaint(hwnd, &the_output.ps);
font = CreateFont(the_output.loutput.fontsize, 0, 0, 0, 0, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, NULL);
SelectObject(the_output.ps.hdc, (HGDIOBJ) font);
windows_box(&the_output, 0xff, 0xff, 0xff, 0, 0, win_width, 0, win_height);
the_output.max_x = 0;
the_output.max_y = 0;
output_draw(&the_output.loutput);
the_width = the_output.max_x;
the_height = the_output.max_y;
DeleteObject(font);
EndPaint(hwnd, &the_output.ps);
break;
}
case WM_LBUTTONDOWN:
state = 1;
x = GET_X_LPARAM(lparam);
y = GET_Y_LPARAM(lparam);
break;
case WM_LBUTTONUP:
state = 0;
break;
case WM_MOUSEMOVE:
if (!(wparam & MK_LBUTTON))
state = 0;
if (state) {
int new_x = GET_X_LPARAM(lparam);
int new_y = GET_Y_LPARAM(lparam);
x_delta -= new_x - x;
y_delta -= new_y - y;
x = new_x;
y = new_y;
redraw = 1;
}
break;
case WM_KEYDOWN:
switch (wparam) {
case VK_ESCAPE:
finish = 1;
break;
case VK_LEFT:
x_delta -= win_width/10;
redraw = 1;
break;
case VK_RIGHT:
x_delta += win_width/10;
redraw = 1;
break;
case VK_UP:
y_delta -= win_height/10;
redraw = 1;
break;
case VK_DOWN:
y_delta += win_height/10;
redraw = 1;
break;
case VK_PRIOR:
if (control) {
x_delta -= win_width;
redraw = 1;
} else {
y_delta -= win_height;
redraw = 1;
//.........这里部分代码省略.........
示例8: GET_X_LPARAM
LRESULT SystemFrame::onTabContextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) {
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; // location of mouse click
tabMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, m_hWnd);
return TRUE;
}
示例9: User32DefWindowProc
LRESULT WINAPI
User32DefWindowProc(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
BOOL bUnicode)
{
PWND pWnd = NULL;
if (hWnd)
{
pWnd = ValidateHwnd(hWnd);
if (!pWnd) return 0;
}
switch (Msg)
{
case WM_NCPAINT:
{
return DefWndNCPaint(hWnd, (HRGN)wParam, -1);
}
case WM_NCCALCSIZE:
{
return DefWndNCCalcSize(hWnd, (BOOL)wParam, (RECT*)lParam);
}
case WM_POPUPSYSTEMMENU:
{
/* This is an undocumented message used by the windows taskbar to
display the system menu of windows that belong to other processes. */
HMENU menu = GetSystemMenu(hWnd, FALSE);
if (menu)
TrackPopupMenu(menu, TPM_LEFTBUTTON|TPM_RIGHTBUTTON,
LOWORD(lParam), HIWORD(lParam), 0, hWnd, NULL);
return 0;
}
case WM_NCACTIVATE:
{
return DefWndNCActivate(hWnd, wParam, lParam);
}
case WM_NCHITTEST:
{
POINT Point;
Point.x = GET_X_LPARAM(lParam);
Point.y = GET_Y_LPARAM(lParam);
return (DefWndNCHitTest(hWnd, Point));
}
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
iF10Key = iMenuSysKey = 0;
break;
case WM_NCLBUTTONDOWN:
{
return (DefWndNCLButtonDown(hWnd, wParam, lParam));
}
case WM_LBUTTONDBLCLK:
return (DefWndNCLButtonDblClk(hWnd, HTCLIENT, lParam));
case WM_NCLBUTTONDBLCLK:
{
return (DefWndNCLButtonDblClk(hWnd, wParam, lParam));
}
case WM_NCRBUTTONDOWN:
return NC_HandleNCRButtonDown( hWnd, wParam, lParam );
case WM_RBUTTONUP:
{
POINT Pt;
Pt.x = GET_X_LPARAM(lParam);
Pt.y = GET_Y_LPARAM(lParam);
ClientToScreen(hWnd, &Pt);
lParam = MAKELPARAM(Pt.x, Pt.y);
if (bUnicode)
{
SendMessageW(hWnd, WM_CONTEXTMENU, (WPARAM)hWnd, lParam);
}
else
{
SendMessageA(hWnd, WM_CONTEXTMENU, (WPARAM)hWnd, lParam);
}
break;
}
case WM_NCRBUTTONUP:
/*
* FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
* in Windows), but what _should_ we do? According to MSDN :
* "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
* message to the window". When is it appropriate?
*/
break;
//.........这里部分代码省略.........
示例10: switch
BOOL CTutorialWindow::ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT & lResult) {
switch (uMsg) {
case WM_CREATE:
{
lResult = OnCreate(reinterpret_cast<LPCREATESTRUCT>(lParam));
return TRUE;
}
case WM_DESTROY:
{
OnDestroy();
lResult = 0;
return TRUE;
}
case WM_CLOSE:
{
OnClose();
lResult = 0;
return TRUE;
}
case WM_KEYDOWN:
{
OnKeyDown((TCHAR)wParam, (UINT)lParam & 0xfff, (UINT)((lParam >> 16) & 0xffff));
lResult = 0;
return TRUE;
}
case WM_LBUTTONDOWN:
{
OnLButtonDown(wParam, CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
lResult = 0;
return TRUE;
}
case WM_CONTEXTMENU:
{
OnContextMenu((HWND)wParam, CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
lResult = 0;
return TRUE;
}
case WM_SETFOCUS:
{
OnSetFocus((HWND)wParam);
lResult = 0;
return TRUE;
}
case WM_PAINT:
{
OnPaint((HDC)wParam);
lResult = 0;
return TRUE;
}
case WM_PRINTCLIENT:
{
OnPrintClient((HDC)wParam, (UINT)lParam);
lResult = 0;
return TRUE;
}
}
// The framework will call DefWindowProc() for us.
return FALSE;
}
示例11: WndProc
//.........这里部分代码省略.........
case WM_CHAR:
case WM_SYSCHAR: {
int mods = mod_state(vo);
int code = wParam;
// Windows enables Ctrl+Alt when AltGr (VK_RMENU) is pressed.
// E.g. AltGr+9 on a German keyboard would yield Ctrl+Alt+[
// Warning: wine handles this differently. Don't test this on wine!
if (key_state(vo, VK_RMENU))
mods &= ~(MP_KEY_MODIFIER_CTRL | MP_KEY_MODIFIER_ALT);
// Apparently Ctrl+A to Ctrl+Z is special cased, and produces
// character codes from 1-26. Work it around.
// Also, enter/return (including the keypad variant) and CTRL+J both
// map to wParam==10. As a workaround, check VK_RETURN to
// distinguish these two key combinations.
if ((mods & MP_KEY_MODIFIER_CTRL) && code >= 1 && code <= 26
&& !key_state(vo, VK_RETURN))
code = code - 1 + (mods & MP_KEY_MODIFIER_SHIFT ? 'A' : 'a');
if (code >= 32 && code < (1<<21)) {
mp_input_put_key(vo->input_ctx, code | mods);
// At least with Alt+char, not calling DefWindowProcW stops
// Windows from emitting a beep.
return 0;
}
break;
}
case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT && !w32->cursor_visible) {
SetCursor(NULL);
return TRUE;
}
break;
case WM_MOUSELEAVE:
w32->tracking = FALSE;
mp_input_put_key(vo->input_ctx, MP_KEY_MOUSE_LEAVE);
break;
case WM_MOUSEMOVE: {
if (!w32->tracking)
w32->tracking = TrackMouseEvent(&w32->trackEvent);
// Windows can send spurious mouse events, which would make the mpv
// core unhide the mouse cursor on completely unrelated events. See:
// https://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx
int x = GET_X_LPARAM(lParam);
int y = GET_Y_LPARAM(lParam);
if (x != w32->mouse_x || y != w32->mouse_y) {
w32->mouse_x = x;
w32->mouse_y = y;
vo_mouse_movement(vo, x, y);
}
break;
}
case WM_LBUTTONDOWN:
mouse_button = MP_MOUSE_BTN0 | MP_KEY_STATE_DOWN;
break;
case WM_LBUTTONUP:
mouse_button = MP_MOUSE_BTN0 | MP_KEY_STATE_UP;
break;
case WM_MBUTTONDOWN:
mouse_button = MP_MOUSE_BTN1 | MP_KEY_STATE_DOWN;
break;
case WM_MBUTTONUP:
mouse_button = MP_MOUSE_BTN1 | MP_KEY_STATE_UP;
break;
case WM_RBUTTONDOWN:
mouse_button = MP_MOUSE_BTN2 | MP_KEY_STATE_DOWN;
break;
case WM_RBUTTONUP:
mouse_button = MP_MOUSE_BTN2 | MP_KEY_STATE_UP;
break;
case WM_MOUSEWHEEL: {
int x = GET_WHEEL_DELTA_WPARAM(wParam);
mouse_button = x > 0 ? MP_MOUSE_BTN3 : MP_MOUSE_BTN4;
break;
}
case WM_XBUTTONDOWN:
mouse_button = HIWORD(wParam) == 1 ? MP_MOUSE_BTN5 : MP_MOUSE_BTN6;
mouse_button |= MP_KEY_STATE_DOWN;
break;
case WM_XBUTTONUP:
mouse_button = HIWORD(wParam) == 1 ? MP_MOUSE_BTN5 : MP_MOUSE_BTN6;
mouse_button |= MP_KEY_STATE_UP;
break;
}
if (mouse_button && vo->opts->enable_mouse_movements) {
int x = GET_X_LPARAM(lParam);
int y = GET_Y_LPARAM(lParam);
mouse_button |= mod_state(vo);
if (mouse_button == (MP_MOUSE_BTN0 | MP_KEY_STATE_DOWN) &&
!vo->opts->fullscreen && !mp_input_test_dragging(vo->input_ctx, x, y))
{
// Window dragging hack
ReleaseCapture();
SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
return 0;
}
mp_input_put_key(vo->input_ctx, mouse_button);
}
return DefWindowProcW(hWnd, message, wParam, lParam);
}
示例12: GetWindowLong
LRESULT CALLBACK ServiceDiscovery::WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {
PAINTSTRUCT ps;
HDC hdc;
ServiceDiscovery *p=(ServiceDiscovery *) GetWindowLong(hWnd, GWL_USERDATA);
switch (message) {
case WM_CREATE:
{
p=(ServiceDiscovery *) (((CREATESTRUCT *)lParam)->lpCreateParams);
SetWindowLong(hWnd, GWL_USERDATA, (LONG) p );
//p->nodeList=VirtualListView::ref(new VirtualListView(hWnd, std::string("disco")));
DiscoListView * dlv = new DiscoListView(hWnd, std::string("disco"));
//dlv->serviceDiscovery=p->thisRef;
p->nodeList=VirtualListView::ref(dlv);
p->nodeList->setParent(hWnd);
p->nodeList->showWindow(true);
//p->nodeList->wrapList=false;
//p->nodeList->colorInterleaving=true;
RECT rect;
p->editWnd=DoCreateComboControl(hWnd);
GetWindowRect(p->editWnd, &rect);
p->editHeight=rect.bottom-rect.top+2;
mru::readMru(MRU_DISCO_JIDS, p->editWnd, NULL);
//p->msgList->bindODRList(p->contact->messageList);
break;
}
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
{
//p->contact->nUnread=0;
RECT rc = {0, 0, 200, tabHeight};
SetBkMode(hdc, TRANSPARENT);
//SetTextColor(hdc, p->contact->getColor());
//p->contact->draw(hdc, rc);
skin->drawElement(hdc, icons::ICON_CLOSE, p->width-2-skin->getElementWidth(), 0);
skin->drawElement(hdc, icons::ICON_SEARCH_INDEX, p->width-4-skin->getElementWidth()*2, 0);
/*SetBkMode(hdc, TRANSPARENT);
LPCTSTR t=p->title.c_str();
DrawText(hdc, t, -1, &rc, DT_CALCRECT | DT_LEFT | DT_TOP);
DrawText(hdc, t, -1, &rc, DT_LEFT | DT_TOP);*/
}
EndPaint(hWnd, &ps);
break;
case WM_SIZE:
{
HDWP hdwp;
RECT rc;
int height=GET_Y_LPARAM(lParam);
p->width=GET_X_LPARAM(lParam);
// Calculate the display rectangle, assuming the
// tab control is the size of the client area.
SetRect(&rc, 0, 0,
GET_X_LPARAM(lParam), height );
// Size the tab control to fit the client area.
hdwp = BeginDeferWindowPos(2);
DeferWindowPos(hdwp, p->editWnd, NULL, 1, 1,
GET_X_LPARAM(lParam)-(tabHeight*2+2), p->editHeight,
SWP_NOZORDER
);
DeferWindowPos(hdwp, p->nodeList->getHWnd(), HWND_TOP, 0, p->editHeight,
GET_X_LPARAM(lParam), height - p->editHeight,
SWP_NOZORDER
);
EndDeferWindowPos(hdwp);
break;
}
case WM_COMMAND:
{
switch (LOWORD(wParam)) {
case IDOK:
{
updateComboHistory(p->editWnd);
while (!p->nodes.empty()) p->nodes.pop();
p->nodeList->bindODRList(ODRListRef());
p->newNode.clear();
p->go();
break;
}
}
//.........这里部分代码省略.........
示例13: DisplayProc
LRESULT CALLBACK DisplayProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
static bool firstErase = true;
switch (message) {
case WM_ACTIVATE:
if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) {
g_activeWindow = WINDOW_MAINWINDOW;
}
break;
case WM_SIZE:
break;
case WM_SETFOCUS:
break;
case WM_ERASEBKGND:
if (firstErase) {
firstErase = false;
// Paint black on first erase while OpenGL stuff is loading
return DefWindowProc(hWnd, message, wParam, lParam);
}
// Then never erase, let the OpenGL drawing take care of everything.
return 1;
// Poor man's touch - mouse input. We send the data asynchronous touch events for minimal latency.
case WM_LBUTTONDOWN:
if (!touchHandler.hasTouch() ||
(GetMessageExtraInfo() & MOUSEEVENTF_MASK_PLUS_PENTOUCH) != MOUSEEVENTF_FROMTOUCH_NOPEN)
{
// Hack: Take the opportunity to show the cursor.
mouseButtonDown = true;
float x = GET_X_LPARAM(lParam) * g_dpi_scale_x;
float y = GET_Y_LPARAM(lParam) * g_dpi_scale_y;
WindowsRawInput::SetMousePos(x, y);
TouchInput touch;
touch.id = 0;
touch.flags = TOUCH_DOWN;
touch.x = x;
touch.y = y;
NativeTouch(touch);
SetCapture(hWnd);
// Simulate doubleclick, doesn't work with RawInput enabled
static double lastMouseDown;
double now = real_time_now();
if ((now - lastMouseDown) < 0.001 * GetDoubleClickTime()) {
if (!g_Config.bShowTouchControls && !g_Config.bMouseControl && GetUIState() == UISTATE_INGAME && g_Config.bFullscreenOnDoubleclick) {
SendToggleFullscreen(!g_Config.bFullScreen);
}
lastMouseDown = 0.0;
} else {
lastMouseDown = real_time_now();
}
}
break;
case WM_MOUSEMOVE:
if (!touchHandler.hasTouch() ||
(GetMessageExtraInfo() & MOUSEEVENTF_MASK_PLUS_PENTOUCH) != MOUSEEVENTF_FROMTOUCH_NOPEN)
{
// Hack: Take the opportunity to show the cursor.
mouseButtonDown = (wParam & MK_LBUTTON) != 0;
int cursorX = GET_X_LPARAM(lParam);
int cursorY = GET_Y_LPARAM(lParam);
if (abs(cursorX - prevCursorX) > 1 || abs(cursorY - prevCursorY) > 1) {
hideCursor = false;
SetTimer(hwndMain, TIMER_CURSORMOVEUPDATE, CURSORUPDATE_MOVE_TIMESPAN_MS, 0);
}
prevCursorX = cursorX;
prevCursorY = cursorY;
float x = (float)cursorX * g_dpi_scale_x;
float y = (float)cursorY * g_dpi_scale_y;
WindowsRawInput::SetMousePos(x, y);
if (wParam & MK_LBUTTON) {
TouchInput touch;
touch.id = 0;
touch.flags = TOUCH_MOVE;
touch.x = x;
touch.y = y;
NativeTouch(touch);
}
}
break;
case WM_LBUTTONUP:
if (!touchHandler.hasTouch() ||
(GetMessageExtraInfo() & MOUSEEVENTF_MASK_PLUS_PENTOUCH) != MOUSEEVENTF_FROMTOUCH_NOPEN)
{
// Hack: Take the opportunity to hide the cursor.
mouseButtonDown = false;
float x = (float)GET_X_LPARAM(lParam) * g_dpi_scale_x;
float y = (float)GET_Y_LPARAM(lParam) * g_dpi_scale_y;
WindowsRawInput::SetMousePos(x, y);
//.........这里部分代码省略.........
示例14: windowProc
//.........这里部分代码省略.........
}
case WM_LBUTTONUP:
case WM_RBUTTONUP:
case WM_MBUTTONUP:
case WM_XBUTTONUP:
{
const int mods = getKeyMods();
ReleaseCapture();
if (uMsg == WM_LBUTTONUP)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_RELEASE, mods);
else if (uMsg == WM_RBUTTONUP)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_RELEASE, mods);
else if (uMsg == WM_MBUTTONUP)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_RELEASE, mods);
else
{
if (HIWORD(wParam) == XBUTTON1)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_4, GLFW_RELEASE, mods);
else if (HIWORD(wParam) == XBUTTON2)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_5, GLFW_RELEASE, mods);
return TRUE;
}
return 0;
}
case WM_MOUSEMOVE:
{
const int x = GET_X_LPARAM(lParam);
const int y = GET_Y_LPARAM(lParam);
if (window->cursorMode == GLFW_CURSOR_DISABLED)
{
if (_glfw.cursorWindow != window)
break;
_glfwInputCursorMotion(window,
x - window->win32.cursorPosX,
y - window->win32.cursorPosY);
}
else
_glfwInputCursorMotion(window, x, y);
window->win32.cursorPosX = x;
window->win32.cursorPosY = y;
if (!window->win32.cursorTracked)
{
TRACKMOUSEEVENT tme;
ZeroMemory(&tme, sizeof(tme));
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = window->win32.handle;
TrackMouseEvent(&tme);
window->win32.cursorTracked = GL_TRUE;
_glfwInputCursorEnter(window, GL_TRUE);
}
return 0;
}
示例15: switch
LRESULT CALLBACK Explorerplusplus::TreeViewHolderWindowNotifyHandler(LPARAM lParam)
{
switch(((LPNMHDR)lParam)->code)
{
case TVN_ITEMEXPANDING:
return OnTreeViewItemExpanding(lParam);
break;
case TVN_SELCHANGED:
OnTreeViewSelChanged(lParam);
break;
case TVN_BEGINLABELEDIT:
OnTreeViewBeginLabelEdit(lParam);
break;
case TVN_ENDLABELEDIT:
OnTreeViewEndLabelEdit(lParam);
break;
case TVN_KEYDOWN:
return OnTreeViewKeyDown(lParam);
break;
case TVN_BEGINDRAG:
/* Forward the message to the treeview for it to handle. */
SendMessage(m_hTreeView,WM_NOTIFY,0,lParam);
break;
case TVN_GETDISPINFO:
SendMessage(m_hTreeView,WM_NOTIFY,0,lParam);
break;
case NM_RCLICK:
{
NMHDR *nmhdr = NULL;
POINT ptCursor;
DWORD dwPos;
TVHITTESTINFO tvht;
nmhdr = (NMHDR *)lParam;
if(nmhdr->hwndFrom == m_hTreeView)
{
dwPos = GetMessagePos();
ptCursor.x = GET_X_LPARAM(dwPos);
ptCursor.y = GET_Y_LPARAM(dwPos);
tvht.pt = ptCursor;
ScreenToClient(m_hTreeView,&tvht.pt);
TreeView_HitTest(m_hTreeView,&tvht);
if((tvht.flags & TVHT_NOWHERE) == 0)
{
OnTreeViewRightClick((WPARAM)tvht.hItem,(LPARAM)&ptCursor);
}
}
}
break;
}
return 0;
}