本文整理匯總了C++中DefSubclassProc函數的典型用法代碼示例。如果您正苦於以下問題:C++ DefSubclassProc函數的具體用法?C++ DefSubclassProc怎麽用?C++ DefSubclassProc使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DefSubclassProc函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: DefSubclassProc
LRESULT Control::ControlProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam,
UINT_PTR subClassId, DWORD_PTR dataReference)
{
Pointer ptr;
MessageMap msgMap;
if (!ProcessMessages)
{
MSG msg;
msg.hwnd = hwnd;
msg.message = message;
msg.wParam = wParam;
msg.lParam = lParam;
QueuedMessages.push_back(msg);
return DefSubclassProc(hwnd, message, wParam, lParam);
}
map<HWND, MessageMap>::iterator iterGlobal = GlobalMessageMap.find(hwnd);
if (iterGlobal == GlobalMessageMap.end())
return DefSubclassProc(hwnd, message, wParam, lParam);
msgMap = iterGlobal->second;
MessageMap::iterator iter = msgMap.find(message);
if (iter == msgMap.end())
return DefSubclassProc(hwnd, message, wParam, lParam);
ptr = iter->second;
return (ptr.Window->*ptr.Function)(wParam, lParam);
}
示例2: EditProc
static LRESULT CALLBACK
EditProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) {
EditCtrl *w = (EditCtrl *)dwRefData;
CrashIf(w->hwnd != (HWND)lp);
if (w->preFilter) {
bool discard = false;
auto res = w->preFilter(hwnd, msg, wp, lp, discard);
if (discard) {
return res;
}
}
if (WM_NCDESTROY == msg) {
RemoveWindowSubclass(GetParent(w->hwnd), EditParentProc, 0);
RemoveWindowSubclass(w->hwnd, EditProc, 0);
return DefSubclassProc(hwnd, msg, wp, lp);
}
// Node: this is sent during creation, which is too early for us (we didn't
// subclass the window yet)
// currently, we force it with SetWindowPos(... SMP_FRAMECHANGED)
if (WM_NCCALCSIZE == msg) {
NCCALCSIZE_PARAMS *p = (NCCALCSIZE_PARAMS *)lp;
RECT orig = p->rgrc[0];
LRESULT res = DefSubclassProc(hwnd, msg, wp, lp);
RECT curr = p->rgrc[0];
w->ncDx = RectDx(orig) - RectDx(curr);
w->ncDy = RectDy(orig) - RectDy(curr);
return res;
}
return DefSubclassProc(hwnd, msg, wp, lp);
}
示例3: TreeProc
static LRESULT CALLBACK TreeProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) {
UNUSED(uIdSubclass);
TreeCtrl* w = (TreeCtrl*)dwRefData;
CrashIf(w->hwnd != (HWND)hwnd);
if (w->preFilter) {
bool discard = false;
auto res = w->preFilter(hwnd, msg, wp, lp, discard);
if (discard) {
return res;
}
}
if (WM_ERASEBKGND == msg) {
return FALSE;
}
if (WM_KEYDOWN == msg) {
if (HandleKey(hwnd, wp)) {
return 0;
}
}
if (WM_NCDESTROY == msg) {
Unsubclass(w);
return DefSubclassProc(hwnd, msg, wp, lp);
}
return DefSubclassProc(hwnd, msg, wp, lp);
}
示例4: switch
LRESULT AeroControlBase::ProgressbarWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_ENABLE:
case WM_STYLECHANGED:
{
LRESULT res = DefSubclassProc(hWnd, uMsg, wParam, lParam);
InvalidateRgn(hWnd, NULL, FALSE);
return res;
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
RECT rc;
GetWindowRect(hWnd, &rc);
MapWindowPoints(NULL, hWnd, (LPPOINT)&rc, 2);
if (hdc)
{
PaintControl(hWnd, hdc, &ps.rcPaint, false);
BP_PAINTPARAMS params = { sizeof(BP_PAINTPARAMS) };
params.dwFlags = 0L;
HDC hdcPaint = NULL;
HPAINTBUFFER hBufferedPaint = BeginBufferedPaint(hdc, &rc, BPBF_TOPDOWNDIB, ¶ms, &hdcPaint);
if (hdcPaint)
{
COLORREF cr = RGB(0x00, 0x00, 0x00);
SetPixel(hdcPaint, 0, 0, cr);
SetPixel(hdcPaint, 0, RECTHEIGHT(rc) - 1, cr);
SetPixel(hdcPaint, RECTWIDTH(rc) - 1, 0, cr);
SetPixel(hdcPaint, RECTWIDTH(rc) - 1, RECTHEIGHT(rc) - 1, cr);
EndBufferedPaint(hBufferedPaint, TRUE);
}
}
EndPaint(hWnd, &ps);
return 0;
}
break;
case WM_NCDESTROY:
case WM_DESTROY:
RemoveWindowSubclass(hWnd, SubclassProc, Static);
subclassedControls.erase(hWnd);
break;
}
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
示例5: FrameSubclass
static LRESULT CALLBACK FrameSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR, DWORD_PTR dwRefData)
{
HWND hwndTransfer = (HWND) dwRefData;
switch (uMsg)
{
case WM_MOVE:
{
LPCALC lpCalc = (LPCALC) GetWindowLongPtr(hwndTransfer, GWLP_USERDATA);
RECT wr;
GetWindowRect(hwnd, &wr);
DWORD dwSendWidth = (wr.right - wr.left) * 9 / 10;
DWORD dwSendHeight = 90; //10 * HIWORD(GetDialogBaseUnits());
LPSENDINFO lpsi = g_SendInfo[lpCalc];
RECT rcLcd = { 0 };
if (lpsi != NULL) {
GetWindowRect(lpsi->hwndParent, &rcLcd);
}
SetWindowPos(hwndTransfer, NULL,
wr.left + ((wr.right - wr.left) - dwSendWidth) / 2,
rcLcd.top + (rcLcd.bottom - rcLcd.top - dwSendHeight) / 2,
dwSendWidth, dwSendHeight,
SWP_NOSIZE | SWP_NOZORDER);
break;
}
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
示例6: editSubProc
// the real list view intercepts these keys to control editing
static LRESULT CALLBACK editSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIDSubclass, DWORD_PTR dwRefData)
{
uiTable *t = (uiTable *) dwRefData;
HRESULT hr;
switch (uMsg) {
case WM_KEYDOWN:
switch (wParam) {
// TODO handle VK_TAB and VK_SHIFT+VK_TAB
case VK_RETURN:
hr = uiprivTableFinishEditingText(t);
if (hr != S_OK) {
// TODO
}
return 0; // yes, the real list view just returns here
case VK_ESCAPE:
hr = uiprivTableAbortEditingText(t);
if (hr != S_OK) {
// TODO
}
return 0;
}
break;
// the real list view also forces these flags
case WM_GETDLGCODE:
return DLGC_HASSETSEL | DLGC_WANTALLKEYS;
case WM_NCDESTROY:
if (RemoveWindowSubclass(hwnd, editSubProc, uIDSubclass) == FALSE)
logLastError(L"RemoveWindowSubclass()");
// fall through
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
示例7: groupSubProc
static LRESULT CALLBACK groupSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
uiGroup *g = uiGroup(dwRefData);
WINDOWPOS *wp = (WINDOWPOS *) lParam;
MINMAXINFO *mmi = (MINMAXINFO *) lParam;
int minwid, minht;
LRESULT lResult;
if (handleParentMessages(hwnd, uMsg, wParam, lParam, &lResult) != FALSE)
return lResult;
switch (uMsg) {
case WM_WINDOWPOSCHANGED:
if ((wp->flags & SWP_NOSIZE) != 0)
break;
groupRelayout(g);
return 0;
case WM_GETMINMAXINFO:
lResult = DefWindowProcW(hwnd, uMsg, wParam, lParam);
uiWindowsControlMinimumSize(uiWindowsControl(g), &minwid, &minht);
mmi->ptMinTrackSize.x = minwid;
mmi->ptMinTrackSize.y = minht;
return lResult;
case WM_NCDESTROY:
if (RemoveWindowSubclass(hwnd, groupSubProc, uIdSubclass) == FALSE)
logLastError(L"error removing groupbox subclass");
break;
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
示例8: switch
LRESULT CALLBACK Explorerplusplus::EditSubclass(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg)
{
case WM_KEYDOWN:
switch(wParam)
{
case VK_RETURN:
OnAddressBarGo();
return 0;
break;
}
break;
case WM_SETFOCUS:
UpdateMainToolbar();
break;
case WM_MOUSEWHEEL:
if(OnMouseWheel(MOUSEWHEEL_SOURCE_OTHER,wParam,lParam))
{
return 0;
}
break;
}
return DefSubclassProc(hwnd,msg,wParam,lParam);
}
示例9: switch
LRESULT CALLBACK Explorerplusplus::EditSubclass(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg)
{
case WM_KEYDOWN:
switch(wParam)
{
case VK_RETURN:
SendMessage(m_hContainer,CBN_KEYDOWN,VK_RETURN,0);
return 0;
break;
}
break;
case WM_SETFOCUS:
HandleToolbarItemStates();
break;
case WM_MOUSEWHEEL:
if(OnMouseWheel(MOUSEWHEEL_SOURCE_OTHER,wParam,lParam))
{
return 0;
}
break;
}
return DefSubclassProc(hwnd,msg,wParam,lParam);
}
示例10: switch
LRESULT CALLBACK CBookmarksToolbar::BookmarksToolbarParentProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch(uMsg)
{
case WM_COMMAND:
if(LOWORD(wParam) >= m_uIDStart &&
LOWORD(wParam) <= m_uIDEnd)
{
/* TODO: Map the id back to a GUID, and
then open the bookmark/show a dropdown
list. */
return 0;
}
break;
case WM_NOTIFY:
if(reinterpret_cast<LPNMHDR>(lParam)->hwndFrom == m_hToolbar)
{
switch(reinterpret_cast<LPNMHDR>(lParam)->code)
{
case TBN_GETINFOTIP:
{
//NMTBGETINFOTIP *pnmtbgit = reinterpret_cast<NMTBGETINFOTIP *>(lParam);
/* TODO: Build an infotip for the bookmark. */
//return 0;
}
break;
}
}
break;
}
return DefSubclassProc(hwnd,uMsg,wParam,lParam);
}
示例11: UPDOWN_Buddy_SubclassProc
/***********************************************************************
* UPDOWN_Buddy_SubclassProc used to handle messages sent to the buddy
* control.
*/
static LRESULT CALLBACK
UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
UINT_PTR uId, DWORD_PTR ref_data)
{
UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr((HWND)ref_data);
TRACE("hwnd=%p, uMsg=%04x, wParam=%08lx, lParam=%08lx\n",
hwnd, uMsg, wParam, lParam);
switch(uMsg)
{
case WM_KEYDOWN:
UPDOWN_KeyPressed(infoPtr, (int)wParam);
if ((wParam == VK_UP) || (wParam == VK_DOWN)) return 0;
break;
case WM_MOUSEWHEEL:
UPDOWN_MouseWheel(infoPtr, (int)wParam);
break;
default:
break;
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
示例12: COMCTL32_SubclassProc
/***********************************************************************
* COMCTL32_SubclassProc (internal)
*
* Window procedure for all subclassed windows.
* Saves the current subclassing stack position to support nested messages
*/
static LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LPSUBCLASS_INFO stack;
LPSUBCLASSPROCS proc;
LRESULT ret;
TRACE ("(%p, 0x%08x, 0x%08lx, 0x%08lx)\n", hWnd, uMsg, wParam, lParam);
stack = GetPropW (hWnd, COMCTL32_wSubclass);
if (!stack) {
ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd);
return 0;
}
/* Save our old stackpos to properly handle nested messages */
proc = stack->stackpos;
stack->stackpos = stack->SubclassProcs;
stack->running++;
ret = DefSubclassProc(hWnd, uMsg, wParam, lParam);
stack->running--;
stack->stackpos = proc;
if (!stack->SubclassProcs && !stack->running) {
TRACE("Last Subclass removed, cleaning up\n");
/* clean up our heap and reset the original window procedure */
if (IsWindowUnicode (hWnd))
SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
else
SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
Free (stack);
RemovePropW( hWnd, COMCTL32_wSubclass );
}
return ret;
}
示例13: opacitySliderSubProc
static LRESULT CALLBACK opacitySliderSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
ID2D1RenderTarget *rt;
struct colorDialog *c;
D2D1_POINT_2F *pos;
D2D1_SIZE_F *size;
c = (struct colorDialog *) dwRefData;
switch (uMsg) {
case msgD2DScratchPaint:
rt = (ID2D1RenderTarget *) lParam;
drawOpacitySlider(c, rt);
return 0;
case msgD2DScratchLButtonDown:
pos = (D2D1_POINT_2F *) wParam;
size = (D2D1_SIZE_F *) lParam;
c->a = 1 - (pos->x / size->width);
updateDialog(c, NULL);
return 0;
case WM_NCDESTROY:
if (RemoveWindowSubclass(hwnd, opacitySliderSubProc, uIdSubclass) == FALSE)
logLastError(L"error removing color dialog opacity slider subclass");
break;
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
示例14: CoCreateInstance
LRESULT CALLBACK Explorerplusplus::MainWndTaskbarThumbnailProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
if(uMsg == m_uTaskbarButtonCreatedMessage)
{
if(m_pTaskbarList != NULL)
{
m_pTaskbarList->Release();
}
CoCreateInstance(CLSID_TaskbarList,NULL,CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&m_pTaskbarList));
m_pTaskbarList->HrInit();
m_bTaskbarInitialised = TRUE;
/* Add each of the jump list tasks. */
SetupJumplistTasks();
/* Register each of the tabs. */
for(auto itr = m_TabProxyList.begin();itr != m_TabProxyList.end();itr++)
{
BOOL bActive = (itr->iTabId == m_iObjectIndex);
RegisterTab(itr->hProxy,EMPTY_STRING,bActive);
HandleTabText(itr->iTabId);
SetTabIcon(itr->iTabId);
}
RemoveWindowSubclass(hwnd,MainWndProcStub,0);
return 0;
}
return DefSubclassProc(hwnd,uMsg,wParam,lParam);
}
示例15: FilterListProcedure
LRESULT CALLBACK
FilterListProcedure(
IN HWND hWnd,
IN UINT uMsg,
IN WPARAM wp,
IN LPARAM lp,
IN UINT_PTR uIdSubclass,
IN DWORD_PTR dwRefData
)
{
BOOLEAN Handled;
switch (uMsg) {
case WM_KEYDOWN:
if ((ULONG)wp == VK_DELETE) {
Handled = FilterListOnDelete(hWnd, uMsg, wp, lp);
if (Handled) {
return TRUE;
}
}
}
return DefSubclassProc(hWnd, uMsg, wp, lp);
}