本文整理汇总了C++中DefWindowProcW函数的典型用法代码示例。如果您正苦于以下问题:C++ DefWindowProcW函数的具体用法?C++ DefWindowProcW怎么用?C++ DefWindowProcW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DefWindowProcW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UT_DefWindowProc
LRESULT UT_DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam,LPARAM lParam)
{
return DefWindowProcW(hWnd, Msg, wParam, lParam);
}
示例2: GB_draw
static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
#endif
{
static const int states[] = { GBS_NORMAL, GBS_NORMAL, GBS_NORMAL, GBS_DISABLED, GBS_NORMAL };
RECT bgRect, textRect, contentRect;
int state = states[ drawState ];
WCHAR *text = get_button_text(hwnd);
LOGFONTW lf;
HFONT font, hPrevFont = NULL;
BOOL created_font = FALSE;
#ifdef __REACTOS__ /* r74406 */
HWND parent;
HBRUSH hBrush;
RECT clientRect;
#endif
HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf);
if (SUCCEEDED(hr)) {
font = CreateFontIndirectW(&lf);
if (!font)
TRACE("Failed to create font\n");
else {
hPrevFont = SelectObject(hDC, font);
created_font = TRUE;
}
} else {
#ifdef __REACTOS__ /* r73885 */
font = get_button_font(hwnd);
#else
font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
#endif
hPrevFont = SelectObject(hDC, font);
}
GetClientRect(hwnd, &bgRect);
textRect = bgRect;
if (text)
{
SIZE textExtent;
GetTextExtentPoint32W(hDC, text, lstrlenW(text), &textExtent);
bgRect.top += (textExtent.cy / 2);
textRect.left += 10;
textRect.bottom = textRect.top + textExtent.cy;
textRect.right = textRect.left + textExtent.cx + 4;
ExcludeClipRect(hDC, textRect.left, textRect.top, textRect.right, textRect.bottom);
}
GetThemeBackgroundContentRect(theme, hDC, BP_GROUPBOX, state, &bgRect, &contentRect);
ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom);
#ifdef __REACTOS__ /* r73885 & r74149 */
if (prfFlag == 0)
{
if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state))
DrawThemeParentBackground(hwnd, hDC, NULL);
}
#else
if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state))
DrawThemeParentBackground(hwnd, hDC, NULL);
#endif
#ifdef __REACTOS__ /* r74406 */
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 );
GetClientRect(hwnd, &clientRect);
FillRect( hDC, &clientRect, hBrush );
#endif
DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);
SelectClipRgn(hDC, NULL);
if (text)
{
InflateRect(&textRect, -2, 0);
DrawThemeText(theme, hDC, BP_GROUPBOX, state, text, lstrlenW(text), 0, 0, &textRect);
HeapFree(GetProcessHeap(), 0, text);
}
if (created_font) DeleteObject(font);
if (hPrevFont) SelectObject(hDC, hPrevFont);
}
示例3: UpDownWindowProc
/***********************************************************************
* UpDownWndProc
*/
static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
static const WCHAR themeClass[] = {'S','p','i','n',0};
HTHEME theme;
TRACE("hwnd=%p msg=%04x wparam=%08lx lparam=%08lx\n", hwnd, message, wParam, lParam);
if (!infoPtr && (message != WM_CREATE))
return DefWindowProcW (hwnd, message, wParam, lParam);
switch(message)
{
case WM_CREATE:
infoPtr = Alloc (sizeof(UPDOWN_INFO));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize the info struct */
infoPtr->Self = hwnd;
infoPtr->Notify = ((LPCREATESTRUCTW)lParam)->hwndParent;
infoPtr->dwStyle = ((LPCREATESTRUCTW)lParam)->style;
infoPtr->AccelCount = 0;
infoPtr->AccelVect = 0;
infoPtr->AccelIndex = -1;
infoPtr->CurVal = 0;
infoPtr->MinVal = 100;
infoPtr->MaxVal = 0;
infoPtr->Base = 10; /* Default to base 10 */
infoPtr->Buddy = 0; /* No buddy window yet */
infoPtr->Flags = 0; /* And no flags */
SetWindowLongW (hwnd, GWL_STYLE, infoPtr->dwStyle & ~WS_BORDER);
/* Do we pick the buddy win ourselves? */
if (infoPtr->dwStyle & UDS_AUTOBUDDY)
UPDOWN_SetBuddy (infoPtr, GetWindow (hwnd, GW_HWNDPREV));
OpenThemeData (hwnd, themeClass);
TRACE("UpDown Ctrl creation, hwnd=%p\n", hwnd);
break;
case WM_DESTROY:
Free (infoPtr->AccelVect);
if(infoPtr->Buddy) RemovePropW(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
Free (infoPtr);
SetWindowLongPtrW (hwnd, 0, 0);
theme = GetWindowTheme (hwnd);
CloseThemeData (theme);
TRACE("UpDown Ctrl destruction, hwnd=%p\n", hwnd);
break;
case WM_ENABLE:
if (wParam) {
infoPtr->dwStyle &= ~WS_DISABLED;
} else {
infoPtr->dwStyle |= WS_DISABLED;
UPDOWN_CancelMode (infoPtr);
}
InvalidateRect (infoPtr->Self, NULL, FALSE);
break;
case WM_STYLECHANGED:
if (wParam == GWL_STYLE) {
infoPtr->dwStyle = ((LPSTYLESTRUCT)lParam)->styleNew;
InvalidateRect (infoPtr->Self, NULL, FALSE);
}
break;
case WM_THEMECHANGED:
theme = GetWindowTheme (hwnd);
CloseThemeData (theme);
OpenThemeData (hwnd, themeClass);
InvalidateRect (hwnd, NULL, FALSE);
break;
case WM_TIMER:
/* is this the auto-press timer? */
if(wParam == TIMER_AUTOPRESS) {
KillTimer(hwnd, TIMER_AUTOPRESS);
infoPtr->Flags &= ~(FLAG_PRESSED | FLAG_ARROW);
InvalidateRect(infoPtr->Self, NULL, FALSE);
}
/* if initial timer, kill it and start the repeat timer */
if(wParam == TIMER_AUTOREPEAT) {
int temp;
KillTimer(hwnd, TIMER_AUTOREPEAT);
/* if no accel info given, used default timer */
if(infoPtr->AccelCount==0 || infoPtr->AccelVect==0) {
infoPtr->AccelIndex = -1;
temp = REPEAT_DELAY;
} else {
infoPtr->AccelIndex = 0; /* otherwise, use it */
//.........这里部分代码省略.........
示例4: HostWndProcW
//.........这里部分代码省略.........
case WM_MOUSEMOVE:
recordMouseEvent(lastMessage);
break;
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
if(GetFocus() != hwnd) SetFocus(hwnd);
SetCapture(hwnd); /* capture mouse input */
recordMouseEvent(lastMessage);
break;
case WM_LBUTTONUP:
case WM_RBUTTONUP:
case WM_MBUTTONUP:
if(GetFocus() != hwnd) SetFocus(hwnd);
ReleaseCapture(); /* release mouse capture */
recordMouseEvent(lastMessage);
break;
/*keyboard events*/
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_KEYUP:
case WM_SYSKEYUP:
case WM_CHAR:
case WM_SYSCHAR:
recordKeyboardEvent(lastMessage);
break;
/*window events*/
case WM_MOVE:
case WM_SIZE:
if ((GetWindowRect(hwnd, &boundingRect)) != 0){
sqWindowEvent *windowevent = (sqWindowEvent*) sqNextEventPut();
windowevent->type = EventTypeWindow;
windowevent->timeStamp = lastMessage ? lastMessage->time : GetTickCount();
windowevent->action = WindowEventMetricChange;
windowevent->value1 = boundingRect.left ;
windowevent->value2 = boundingRect.top;
windowevent->value3 = boundingRect.right;
windowevent->value4 = boundingRect.bottom;
windowevent->windowIndex =(int) hwnd;
}
break;
case WM_PAINT:
if ((GetWindowRect(hwnd, &boundingRect)) != 0){
sqWindowEvent *windowevent = (sqWindowEvent*) sqNextEventPut();
windowevent->type = EventTypeWindow;
windowevent->timeStamp = lastMessage ? lastMessage->time : GetTickCount();
windowevent->action = WindowEventPaint;
windowevent->value1 = boundingRect.left ;
windowevent->value2 = boundingRect.top;
windowevent->value3 = boundingRect.right;
windowevent->value4 = boundingRect.bottom;
windowevent->windowIndex =(int) hwnd;
}
break;
case WM_CLOSE:
{
sqWindowEvent *windowevent = (sqWindowEvent*) sqNextEventPut();
windowevent->type = EventTypeWindow;
windowevent->timeStamp = lastMessage ? lastMessage->time : GetTickCount();
windowevent->action = WindowEventClose;
windowevent->windowIndex =(int) hwnd;
}
break;
case WM_ACTIVATE:
{
sqWindowEvent *windowevent = (sqWindowEvent*) sqNextEventPut();
windowevent->type = EventTypeWindow;
windowevent->timeStamp = lastMessage ? lastMessage->time : GetTickCount();
if (wParam == WA_INACTIVE) windowevent->action = WindowEventIconise;
else windowevent->action = WindowEventActivated;
windowevent->windowIndex =(int) hwnd;
}
break;
case WM_GETMINMAXINFO:
{
sqWindowEvent *windowevent = (sqWindowEvent*) sqNextEventPut();
windowevent->type = EventTypeWindow;
windowevent->timeStamp = lastMessage ? lastMessage->time : GetTickCount();
if (IsIconic(hwnd) != 0)windowevent->action = WindowEventIconise;
else windowevent->action = WindowEventActivated;
windowevent->windowIndex =(int) hwnd;
}
break;
}
return DefWindowProcW(hwnd,message,wParam,lParam);
}
示例5: PAGER_WindowProc
static LRESULT WINAPI
PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PAGER_INFO *infoPtr = (PAGER_INFO *)GetWindowLongPtrW(hwnd, 0);
if (!infoPtr && (uMsg != WM_CREATE))
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
switch (uMsg)
{
case EM_FMTLINES:
return PAGER_FmtLines(infoPtr);
case PGM_FORWARDMOUSE:
return PAGER_ForwardMouse (infoPtr, (BOOL)wParam);
case PGM_GETBKCOLOR:
return PAGER_GetBkColor(infoPtr);
case PGM_GETBORDER:
return PAGER_GetBorder(infoPtr);
case PGM_GETBUTTONSIZE:
return PAGER_GetButtonSize(infoPtr);
case PGM_GETPOS:
return PAGER_GetPos(infoPtr);
case PGM_GETBUTTONSTATE:
return PAGER_GetButtonState (infoPtr, (INT)lParam);
/* case PGM_GETDROPTARGET: */
case PGM_RECALCSIZE:
return PAGER_RecalcSize(infoPtr);
case PGM_SETBKCOLOR:
return PAGER_SetBkColor (infoPtr, (COLORREF)lParam);
case PGM_SETBORDER:
return PAGER_SetBorder (infoPtr, (INT)lParam);
case PGM_SETBUTTONSIZE:
return PAGER_SetButtonSize (infoPtr, (INT)lParam);
case PGM_SETCHILD:
return PAGER_SetChild (infoPtr, (HWND)lParam);
case PGM_SETPOS:
return PAGER_SetPos(infoPtr, (INT)lParam, FALSE);
case WM_CREATE:
return PAGER_Create (hwnd, (LPCREATESTRUCTW)lParam);
case WM_DESTROY:
return PAGER_Destroy (infoPtr);
case WM_SIZE:
return PAGER_Size (infoPtr, (INT)wParam, (short)LOWORD(lParam), (short)HIWORD(lParam));
case WM_NCPAINT:
return PAGER_NCPaint (infoPtr, (HRGN)wParam);
case WM_WINDOWPOSCHANGING:
return PAGER_WindowPosChanging (infoPtr, (WINDOWPOS*)lParam);
case WM_STYLECHANGED:
return PAGER_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam);
case WM_NCCALCSIZE:
return PAGER_NCCalcSize (infoPtr, wParam, (LPRECT)lParam);
case WM_NCHITTEST:
return PAGER_NCHitTest (infoPtr, (short)LOWORD(lParam), (short)HIWORD(lParam));
case WM_MOUSEMOVE:
if (infoPtr->bForward && infoPtr->hwndChild)
PostMessageW(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam);
return PAGER_MouseMove (infoPtr, (INT)wParam, (short)LOWORD(lParam), (short)HIWORD(lParam));
case WM_LBUTTONDOWN:
return PAGER_LButtonDown (infoPtr, (INT)wParam, (short)LOWORD(lParam), (short)HIWORD(lParam));
case WM_LBUTTONUP:
return PAGER_LButtonUp (infoPtr, (INT)wParam, (short)LOWORD(lParam), (short)HIWORD(lParam));
case WM_ERASEBKGND:
return PAGER_EraseBackground (infoPtr, (HDC)wParam);
case WM_TIMER:
return PAGER_Timer (infoPtr, (INT)wParam);
case WM_NOTIFY:
case WM_COMMAND:
return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam);
default:
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
}
}
示例6: Child_WndProc
static LRESULT CALLBACK Child_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_PAINT:
return Child_OnPaint(hWnd);
case WM_SIZE:
return Child_OnSize(hWnd);
case WM_NOTIFY: {
HHInfo *info = (HHInfo*)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
NMHDR *nmhdr = (NMHDR*)lParam;
switch(nmhdr->code) {
case TCN_SELCHANGE:
return OnTabChange(hWnd);
case TVN_SELCHANGEDW:
return OnTopicChange(info, (void*)((NMTREEVIEWW *)lParam)->itemNew.lParam);
case NM_DBLCLK:
if(!info)
return 0;
switch(info->current_tab)
{
case TAB_INDEX:
return OnTopicChange(info, (void*)((NMITEMACTIVATE *)lParam)->lParam);
case TAB_SEARCH:
return OnTopicChange(info, (void*)((NMITEMACTIVATE *)lParam)->lParam);
}
break;
case NM_RETURN:
if(!info)
return 0;
switch(info->current_tab) {
case TAB_INDEX: {
HWND hwndList = info->tabs[TAB_INDEX].hwnd;
LVITEMW lvItem;
lvItem.iItem = (int) SendMessageW(hwndList, LVM_GETSELECTIONMARK, 0, 0);
lvItem.mask = TVIF_PARAM;
SendMessageW(hwndList, LVM_GETITEMW, 0, (LPARAM)&lvItem);
OnTopicChange(info, (void*) lvItem.lParam);
return 0;
}
case TAB_SEARCH: {
if(nmhdr->hwndFrom == info->search.hwndEdit) {
char needle[100];
DWORD i, len;
len = GetWindowTextA(info->search.hwndEdit, needle, sizeof(needle));
if(!len)
{
FIXME("Unable to get search text.\n");
return 0;
}
/* Convert the requested text for comparison later against the
* lower case version of HTML file contents.
*/
for(i=0;i<len;i++)
needle[i] = tolower(needle[i]);
InitSearch(info, needle);
return 0;
}else if(nmhdr->hwndFrom == info->search.hwndList) {
HWND hwndList = info->search.hwndList;
LVITEMW lvItem;
lvItem.iItem = (int) SendMessageW(hwndList, LVM_GETSELECTIONMARK, 0, 0);
lvItem.mask = TVIF_PARAM;
SendMessageW(hwndList, LVM_GETITEMW, 0, (LPARAM)&lvItem);
OnTopicChange(info, (void*) lvItem.lParam);
return 0;
}
break;
}
}
break;
}
break;
}
default:
return DefWindowProcW(hWnd, message, wParam, lParam);
}
return 0;
}
示例7: IME_WindowProc
//.........这里部分代码省略.........
return 0L;
default:
break;
}
}
switch(msg)
{
case WM_CREATE:
{
LPIMEPRIVATE myPrivate;
LPINPUTCONTEXT lpIMC;
SetWindowTextA(hwnd,"Wine Ime Active");
lpIMC = LockRealIMC(hIMC);
if (lpIMC)
{
myPrivate = ImmLockIMCC(lpIMC->hPrivate);
myPrivate->hwndDefault = hwnd;
ImmUnlockIMCC(lpIMC->hPrivate);
}
UnlockRealIMC(hIMC);
return TRUE;
}
case WM_PAINT:
PaintDefaultIMEWnd(hIMC, hwnd);
return FALSE;
case WM_NCCREATE:
return TRUE;
case WM_SETFOCUS:
if (wParam)
SetFocus((HWND)wParam);
else
FIXME("Received focus, should never have focus\n");
break;
case WM_IME_COMPOSITION:
DefaultIMEComposition(hIMC, hwnd, lParam);
break;
case WM_IME_STARTCOMPOSITION:
DefaultIMEStartComposition(hIMC, hwnd);
break;
case WM_IME_ENDCOMPOSITION:
TRACE("IME message %s, 0x%lx, 0x%lx\n",
"WM_IME_ENDCOMPOSITION", wParam, lParam);
ShowWindow(hwnd,SW_HIDE);
break;
case WM_IME_SELECT:
TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_IME_SELECT", wParam, lParam);
break;
case WM_IME_CONTROL:
TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_IME_CONTROL", wParam, lParam);
rc = 1;
break;
case WM_IME_NOTIFY:
rc = ImeHandleNotify(hIMC,hwnd,msg,wParam,lParam);
break;
default:
TRACE("Non-standard message 0x%x\n",msg);
}
/* check the MSIME messages */
if (msg == WM_MSIME_SERVICE)
{
TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_SERVICE", wParam, lParam);
rc = FALSE;
}
else if (msg == WM_MSIME_RECONVERTOPTIONS)
{
TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_RECONVERTOPTIONS", wParam, lParam);
}
else if (msg == WM_MSIME_MOUSE)
{
TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_MOUSE", wParam, lParam);
}
else if (msg == WM_MSIME_RECONVERTREQUEST)
{
TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_RECONVERTREQUEST", wParam, lParam);
}
else if (msg == WM_MSIME_RECONVERT)
{
TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_RECONVERT", wParam, lParam);
}
else if (msg == WM_MSIME_QUERYPOSITION)
{
TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_QUERYPOSITION", wParam, lParam);
}
else if (msg == WM_MSIME_DOCUMENTFEED)
{
TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_DOCUMENTFEED", wParam, lParam);
}
/* DefWndProc if not an IME message */
if (!rc && !((msg >= WM_IME_STARTCOMPOSITION && msg <= WM_IME_KEYLAST) ||
(msg >= WM_IME_SETCONTEXT && msg <= WM_IME_KEYUP)))
rc = DefWindowProcW(hwnd,msg,wParam,lParam);
return rc;
}
示例8: TaskManagerWndProc
//.........这里部分代码省略.........
TaskManager_OnRestoreMainWindow();
break;
}
break;
case WM_NOTIFY:
pnmh = (LPNMHDR)lParam;
if ((pnmh->hwndFrom == hTabWnd) &&
(pnmh->idFrom == IDC_TAB) &&
(pnmh->code == TCN_SELCHANGE))
{
TaskManager_OnTabWndSelChange();
}
break;
case WM_NCPAINT:
hdc = GetDC(hDlg);
GetClientRect(hDlg, &rc);
Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
ReleaseDC(hDlg, hdc);
break;
case WM_PAINT:
hdc = BeginPaint(hDlg, &ps);
GetClientRect(hDlg, &rc);
Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
EndPaint(hDlg, &ps);
break;
case WM_SIZING:
/* Make sure the user is sizing the dialog */
/* in an acceptable range */
pRC = (LPRECT)lParam;
if ((wParam == WMSZ_LEFT) || (wParam == WMSZ_TOPLEFT) || (wParam == WMSZ_BOTTOMLEFT)) {
/* If the width is too small enlarge it to the minimum */
if (nMinimumWidth > (pRC->right - pRC->left))
pRC->left = pRC->right - nMinimumWidth;
} else {
/* If the width is too small enlarge it to the minimum */
if (nMinimumWidth > (pRC->right - pRC->left))
pRC->right = pRC->left + nMinimumWidth;
}
if ((wParam == WMSZ_TOP) || (wParam == WMSZ_TOPLEFT) || (wParam == WMSZ_TOPRIGHT)) {
/* If the height is too small enlarge it to the minimum */
if (nMinimumHeight > (pRC->bottom - pRC->top))
pRC->top = pRC->bottom - nMinimumHeight;
} else {
/* If the height is too small enlarge it to the minimum */
if (nMinimumHeight > (pRC->bottom - pRC->top))
pRC->bottom = pRC->top + nMinimumHeight;
}
return TRUE;
case WM_SIZE:
/* Handle the window sizing in it's own function */
OnSize(wParam, LOWORD(lParam), HIWORD(lParam));
break;
case WM_MOVE:
/* Handle the window moving in it's own function */
OnMove(wParam, LOWORD(lParam), HIWORD(lParam));
break;
case WM_DESTROY:
ShowWindow(hDlg, SW_HIDE);
TrayIcon_ShellRemoveTrayIcon();
wp.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(hDlg, &wp);
TaskManagerSettings.Left = wp.rcNormalPosition.left;
TaskManagerSettings.Top = wp.rcNormalPosition.top;
TaskManagerSettings.Right = wp.rcNormalPosition.right;
TaskManagerSettings.Bottom = wp.rcNormalPosition.bottom;
if (IsZoomed(hDlg) || (wp.flags & WPF_RESTORETOMAXIMIZED))
TaskManagerSettings.Maximized = TRUE;
else
TaskManagerSettings.Maximized = FALSE;
return DefWindowProcW(hDlg, message, wParam, lParam);
case WM_TIMER:
/* Refresh the performance data */
PerfDataRefresh();
RefreshApplicationPage();
RefreshProcessPage();
RefreshPerformancePage();
TrayIcon_ShellUpdateTrayIcon();
break;
case WM_ENTERMENULOOP:
TaskManager_OnEnterMenuLoop(hDlg);
break;
case WM_EXITMENULOOP:
TaskManager_OnExitMenuLoop(hDlg);
break;
case WM_MENUSELECT:
TaskManager_OnMenuSelect(hDlg, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
break;
}
return 0;
}
示例9: handleMessage
LRESULT handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) override
{
switch (uMsg)
{
// If the user tries to destroy the window
case WM_DESTROY:
// Send a quit message with value of false to exit the loop
PostQuitMessage(false);
return 0;
// If the user clicks the window
case WM_LBUTTONDOWN:
{
// Pointer for the file dialog
CComPtr<IFileOpenDialog> fileDialog;
// Try to create the dialog
HRESULT hr = fileDialog.CoCreateInstance(__uuidof(FileOpenDialog));
// If it failed to create the file dialog
if (FAILED(hr)) {
displayError(L"Could not open file selection dialog!");
return 0;
}
// Ask the user to select a file
hr = fileDialog->Show(nullptr);
// If the user chose Cancel
if (FAILED(hr)) {
displayError(L"No file selected!");
return 0;
}
// The selected file
CComPtr<IShellItem> item;
// Get the selected file
hr = fileDialog->GetResult(&item);
if (FAILED(hr)) {
displayError(L"File selection failed!");
return 0;
}
PWSTR filePath;
// Get the absolute name of the chosen file
hr = item->GetDisplayName(SIGDN_FILESYSPATH, &filePath);
if (FAILED(hr)) {
displayError(L"Could not get file path!");
return 0;
}
// Display the absolute file path
MessageBox(hWnd, filePath, L"File selected", MB_OK);
// Release memory from the string
CoTaskMemFree(filePath);
return 0;
}
// If Windows wants to repaint the app
case WM_PAINT:
{
PAINTSTRUCT ps;
// Fill in the paint structure with info from the area to repaint
HDC hDC = BeginPaint(hWnd, &ps);
// Create a new solid brush for the background
HBRUSH color{ CreateSolidBrush(RGB(120, 120, 120)) };
// Paint the window
FillRect(hDC, &ps.rcPaint, color);
// Stop painting
EndPaint(hWnd, &ps);
// Delete the brush to save memory
DeleteObject(color);
}
return 0;
default:
// If we don't handle the message, use the default window process
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
}
示例10: switch
//.........这里部分代码省略.........
flags |= WKE_RBUTTON;
if (wkeFireMouseEvent(this, message, x, y, flags))
return 0;
}
break;
case WM_CONTEXTMENU:
{
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
if (pt.x != -1 && pt.y != -1)
ScreenToClient(hwnd, &pt);
unsigned int flags = 0;
if (wParam & MK_CONTROL)
flags |= WKE_CONTROL;
if (wParam & MK_SHIFT)
flags |= WKE_SHIFT;
if (wParam & MK_LBUTTON)
flags |= WKE_LBUTTON;
if (wParam & MK_MBUTTON)
flags |= WKE_MBUTTON;
if (wParam & MK_RBUTTON)
flags |= WKE_RBUTTON;
if (wkeFireContextMenuEvent(this, pt.x, pt.y, flags))
return 0;
}
break;
case WM_MOUSEWHEEL:
{
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
ScreenToClient(hwnd, &pt);
int delta = GET_WHEEL_DELTA_WPARAM(wParam);
unsigned int flags = 0;
if (wParam & MK_CONTROL)
flags |= WKE_CONTROL;
if (wParam & MK_SHIFT)
flags |= WKE_SHIFT;
if (wParam & MK_LBUTTON)
flags |= WKE_LBUTTON;
if (wParam & MK_MBUTTON)
flags |= WKE_MBUTTON;
if (wParam & MK_RBUTTON)
flags |= WKE_RBUTTON;
if (wkeFireMouseWheelEvent(this, pt.x, pt.y, delta, flags))
return 0;
}
break;
case WM_SETFOCUS:
wkeSetFocus(this);
return 0;
case WM_KILLFOCUS:
wkeKillFocus(this);
return 0;
case WM_IME_STARTCOMPOSITION:
{
wkeRect caret = wkeGetCaretRect(this);
CANDIDATEFORM form;
form.dwIndex = 0;
form.dwStyle = CFS_EXCLUDE;
form.ptCurrentPos.x = caret.x;
form.ptCurrentPos.y = caret.y + caret.h;
form.rcArea.top = caret.y;
form.rcArea.bottom = caret.y + caret.h;
form.rcArea.left = caret.x;
form.rcArea.right = caret.x + caret.w;
COMPOSITIONFORM compForm;
compForm.ptCurrentPos = form.ptCurrentPos;
compForm.rcArea = form.rcArea;
compForm.dwStyle = CFS_POINT;
HIMC hIMC = ImmGetContext(hwnd);
ImmSetCandidateWindow(hIMC, &form);
ImmSetCompositionWindow(hIMC, &compForm);
ImmReleaseContext(hwnd, hIMC);
}
return 0;
}
return DefWindowProcW(hwnd, message, wParam, lParam);
}
示例11: tableWndProc
static LRESULT CALLBACK tableWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
struct table *t;
HDC dc;
PAINTSTRUCT ps;
NMHDR *nmhdr = (NMHDR *) lParam;
NMHEADERW *nm = (NMHEADERW *) lParam;
t = (struct table *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
if (t == NULL) {
// we have to do things this way because creating the header control will fail mysteriously if we create it first thing
// (which is fine; we can get the parent hInstance this way too)
if (uMsg == WM_NCCREATE) {
CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam;
t = (struct table *) malloc(sizeof (struct table));
if (t == NULL)
abort();
ZeroMemory(t, sizeof (struct table));
t->hwnd = hwnd;
// TODO this should be a global
t->defaultFont = (HFONT) GetStockObject(SYSTEM_FONT);
if (t->defaultFont == NULL)
abort();
t->font = t->defaultFont;
t->selected = 5;t->count=100;//TODO
t->header = CreateWindowExW(0,
WC_HEADERW, L"",
// TODO is HOTTRACK needed?
WS_CHILD | HDS_FULLDRAG | HDS_HORZ | HDS_HOTTRACK,
0, 0, 0, 0,
t->hwnd, (HMENU) 100, cs->hInstance, NULL);
if (t->header == NULL)
abort();
{t->imagelist = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32, 1, 1);
if(t->imagelist==NULL)abort();
{
HICON icon;
int unused;
icon = LoadIconW(NULL, IDI_ERROR);
if(icon == NULL)abort();
if (ImageList_AddIcon(t->imagelist, icon) == -1)abort();
if (ImageList_GetIconSize(t->imagelist, &unused, &(t->imagelistHeight)) == 0)abort();
}
}
t->checkboxes = makeCheckboxImageList(t->hwnd, &(t->theme), &(t->checkboxWidth), &(t->checkboxHeight));
t->focusedColumn = -1;
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) t);
}
// even if we did the above, fall through
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
switch (uMsg) {
case WM_PAINT:
dc = BeginPaint(hwnd, &ps);
if (dc == NULL)
abort();
drawItems(t, dc, ps.rcPaint);
EndPaint(hwnd, &ps);
return 0;
case WM_SETFONT:
t->font = (HFONT) wParam;
if (t->font == NULL)
t->font = t->defaultFont;
// also set the header font
SendMessageW(t->header, WM_SETFONT, wParam, lParam);
if (LOWORD(lParam) != FALSE) {
// the scrollbar page size will change so redraw that too
// also recalculate the header height
// TODO do that when this is FALSE too somehow
resize(t);
redrawAll(t);
}
return 0;
case WM_GETFONT:
return (LRESULT) t->font;
case WM_VSCROLL:
vscroll(t, wParam);
return 0;
case WM_MOUSEWHEEL:
wheelscroll(t, wParam);
return 0;
case WM_HSCROLL:
hscroll(t, wParam);
return 0;
case WM_SIZE:
resize(t);
return 0;
case WM_LBUTTONDOWN:
selectItem(t, wParam, lParam);
return 0;
case WM_SETFOCUS:
case WM_KILLFOCUS:
// all we need to do here is redraw the highlight
// TODO ensure giving focus works right
redrawRow(t, t->selected);
return 0;
case WM_KEYDOWN:
keySelect(t, wParam, lParam);
return 0;
//.........这里部分代码省略.........
示例12: WndProc
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
if (message == WM_NCCREATE) {
CREATESTRUCT *cs = (void*)lParam;
SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams);
}
struct vo *vo = (void*)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
// message before WM_NCCREATE, pray to Raymond Chen that it's not important
if (!vo)
return DefWindowProcW(hWnd, message, wParam, lParam);
struct vo_w32_state *w32 = vo->w32;
int mouse_button = 0;
switch (message) {
case WM_ERASEBKGND: // no need to erase background seperately
return 1;
case WM_PAINT:
w32->event_flags |= VO_EVENT_EXPOSE;
break;
case WM_MOVE: {
POINT p = {0};
ClientToScreen(w32->window, &p);
w32->window_x = p.x;
w32->window_y = p.y;
MP_VERBOSE(vo, "move window: %d:%d\n",
w32->window_x, w32->window_y);
break;
}
case WM_SIZE: {
w32->event_flags |= VO_EVENT_RESIZE;
RECT r;
GetClientRect(w32->window, &r);
vo->dwidth = r.right;
vo->dheight = r.bottom;
MP_VERBOSE(vo, "resize window: %d:%d\n",
vo->dwidth, vo->dheight);
break;
}
case WM_SIZING:
if (vo->opts->keepaspect && !vo->opts->fullscreen &&
vo->opts->WinID < 0)
{
RECT *rc = (RECT*)lParam;
// get client area of the windows if it had the rect rc
// (subtracting the window borders)
RECT r = *rc;
subtract_window_borders(w32->window, &r);
int c_w = r.right - r.left, c_h = r.bottom - r.top;
float aspect = w32->o_dwidth / (float) MPMAX(w32->o_dheight, 1);
int d_w = c_h * aspect - c_w;
int d_h = c_w / aspect - c_h;
int d_corners[4] = { d_w, d_h, -d_w, -d_h };
int corners[4] = { rc->left, rc->top, rc->right, rc->bottom };
int corner = get_resize_border(wParam);
if (corner >= 0)
corners[corner] -= d_corners[corner];
*rc = (RECT) { corners[0], corners[1], corners[2], corners[3] };
return TRUE;
}
break;
case WM_CLOSE:
mp_input_put_key(vo->input_ctx, MP_KEY_CLOSE_WIN);
break;
case WM_SYSCOMMAND:
switch (wParam) {
case SC_SCREENSAVE:
case SC_MONITORPOWER:
if (w32->disable_screensaver) {
MP_VERBOSE(vo, "win32: killing screensaver\n");
return 0;
}
break;
}
break;
case WM_KEYDOWN:
case WM_SYSKEYDOWN: {
int mpkey = lookup_keymap_table(vk_map, wParam);
if (mpkey)
mp_input_put_key(vo->input_ctx, mpkey | mod_state(vo));
if (wParam == VK_F10)
return 0;
break;
}
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) && mp_input_use_alt_gr(vo->input_ctx))
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))
//.........这里部分代码省略.........
示例13: mainWindowProc
//.........这里部分代码省略.........
break;
case ID_EDIT_SELECTROW:
trackView->selectRow(trackView->getEditRow());
break;
case ID_FILE_REMOTEEXPORT:
document.sendSaveCommand();
break;
case ID_RECENTFILES_FILE1:
case ID_RECENTFILES_FILE2:
case ID_RECENTFILES_FILE3:
case ID_RECENTFILES_FILE4:
case ID_RECENTFILES_FILE5:
{
int index = LOWORD(wParam) - ID_RECENTFILES_FILE1;
std::wstring fileName;
if (mruFileList.getEntry(index, fileName))
{
loadDocument(fileName);
}
}
break;
case ID_FILE_EXIT:
attemptQuit();
break;
case ID_EDIT_UNDO: SendMessage(trackViewWin, WM_UNDO, 0, 0); break;
case ID_EDIT_REDO: SendMessage(trackViewWin, WM_REDO, 0, 0); break;
case ID_EDIT_COPY: SendMessage(trackViewWin, WM_COPY, 0, 0); break;
case ID_EDIT_CUT: SendMessage(trackViewWin, WM_CUT, 0, 0); break;
case ID_EDIT_PASTE: SendMessage(trackViewWin, WM_PASTE, 0, 0); break;
case ID_EDIT_SETROWS:
{
int rows = int(trackView->getRows());
INT_PTR result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SETROWS), hwnd, (DLGPROC)setRowsDialogProc, (LPARAM)&rows);
if (FAILED(result))
error("unable to create dialog box");
}
break;
case ID_EDIT_BIAS:
{
int initialBias = 0;
INT_PTR result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_BIASSELECTION), hwnd, (DLGPROC)biasSelectionDialogProc, (LPARAM)&initialBias);
if (FAILED(result))
error("unable to create dialog box");
}
break;
}
break;
case WM_ROWCHANGED:
{
char temp[256];
snprintf(temp, 256, "%d", lParam );
SendMessage(statusBarWin, SB_SETTEXT, 1, (LPARAM)temp);
}
break;
case WM_TRACKCHANGED:
{
char temp[256];
snprintf(temp, 256, "%d", lParam);
SendMessage(statusBarWin, SB_SETTEXT, 2, (LPARAM)temp);
}
break;
case WM_CURRVALDIRTY:
{
char temp[256];
if (document.num_tracks > 0) {
const sync_track *t = document.tracks[document.getTrackIndexFromPos(trackView->getEditTrack())];
int row = trackView->getEditRow();
int idx = key_idx_floor(t, row);
snprintf(temp, 256, "%f", sync_get_val(t, row));
const char *str = "---";
if (idx >= 0) {
switch (t->keys[idx].type) {
case KEY_STEP: str = "step"; break;
case KEY_LINEAR: str = "linear"; break;
case KEY_SMOOTH: str = "smooth"; break;
case KEY_RAMP: str = "ramp"; break;
}
}
SendMessage(statusBarWin, SB_SETTEXT, 4, (LPARAM)str);
} else
snprintf(temp, 256, "---");
SendMessage(statusBarWin, SB_SETTEXT, 3, (LPARAM)temp);
}
break;
default:
return DefWindowProcW(hwnd, msg, wParam, lParam);
}
return 0;
}
示例14: WndProc
LRESULT CALLBACK WndProc( HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch (uMsg)
{
case WM_ACTIVATE:
{
Active=(!HIWORD(wParam));
return 0;
}
case WM_SYSCOMMAND:
{
switch (wParam)
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
return 0;
}
break;
}
case WM_CLOSE:
{
Done = true;
return 0;
}
case WM_KEYDOWN:
{
Keys[wParam] = true;
return 0;
}
case WM_KEYUP:
{
Keys[wParam] = false;
if (wParam==VK_SNAPSHOT)
{
ScreenSave();
return DefWindowProcW(hWnd,uMsg,wParam,lParam);
}
return 0;
}
#ifdef MINIMALTWEAKER
case WM_MOUSEMOVE:
{
POINT ap;
GetCursorPos(&ap);
ScreenToClient(hWnd,&ap);
mx=ap.x;
my=ap.y;
return 0;
}
case WM_LBUTTONDOWN:
{
LeftButton=true;
POINT ap;
GetCursorPos(&ap);
LeftShift=(wParam & MK_SHIFT)==0;
LeftCtrl=(wParam & MK_CONTROL)==0;
ScreenToClient(hWnd,&ap);
lx=ap.x;
ly=ap.y;
return 0;
}
case WM_LBUTTONUP:
{
LeftButton=false;
LeftButtonReleased=true;
return 0;
}
case WM_RBUTTONDOWN:
{
RightButton=true;
POINT ap;
GetCursorPos(&ap);
RightShift=(wParam & MK_SHIFT)==0;
RightCtrl=(wParam & MK_CONTROL)==0;
ScreenToClient(hWnd,&ap);
rx=ap.x;
ry=ap.y;
return 0;
}
case WM_RBUTTONUP:
{
RightButton=false;
RightButtonReleased=true;
return 0;
}
case WM_MBUTTONDOWN:
{
MiddleButton=true;
POINT ap;
//.........这里部分代码省略.........
示例15: VDDualDefWindowProcW32
LRESULT VDDualDefWindowProcW32(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
return IsWindowUnicode(hwnd) ? DefWindowProcW(hwnd, msg, wParam, lParam) : DefWindowProcA(hwnd, msg, wParam, lParam);
}