当前位置: 首页>>代码示例>>C++>>正文


C++ GetWindowLongPtrW函数代码示例

本文整理汇总了C++中GetWindowLongPtrW函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowLongPtrW函数的具体用法?C++ GetWindowLongPtrW怎么用?C++ GetWindowLongPtrW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetWindowLongPtrW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PxTabProc

static LRESULT CALLBACK
PxTabProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	PxTabObject* self = (PxTabObject*)GetWindowLongPtrW(hwnd, GWLP_USERDATA);

	switch (msg)
	{
	case OCM_NOTIFY:
	{
		switch (((LPNMHDR)lParam)->code)
		{
		case TCN_SELCHANGING:
			return FALSE;

		case TCN_SELCHANGE:
		{
			int iIndex = TabCtrl_GetCurSel(self->hWin);
			PxTabPage_GotSelected(PyList_GetItem(self->pyPages, iIndex));
			break;
		}
		}

	}
	}
	return CallWindowProcW(self->fnOldWinProcedure, hwnd, msg, wParam, lParam);
}
开发者ID:thomasfuhringer,项目名称:pylax,代码行数:26,代码来源:TabObject.c

示例2: draw_joystick_buttons

static void draw_joystick_buttons(HWND hwnd, struct JoystickData* data)
{
    int i;
    int row = 0, col = 0;
    WCHAR button_label[3];
    HINSTANCE hinst = (HINSTANCE) GetWindowLongPtrW(hwnd, GWLP_HINSTANCE);
    static WCHAR button_class[] = {'B','u','t','t','o','n','\0'};

    for (i = 0; i < TEST_MAX_BUTTONS; i++)
    {
        RECT r;

        if ((i % TEST_BUTTON_COL_MAX) == 0 && i != 0)
        {
            row += 1;
            col = 0;
        }

        r.left = (TEST_BUTTON_X + TEST_NEXT_BUTTON_X*col);
        r.top = (TEST_BUTTON_Y + TEST_NEXT_BUTTON_Y*row);
        r.right = r.left + TEST_BUTTON_SIZE_X;
        r.bottom = r.top + TEST_BUTTON_SIZE_Y;
        MapDialogRect(hwnd, &r);

        button_number_to_wchar(i + 1, button_label);

        data->graphics.buttons[i] = CreateWindowW(button_class, button_label, WS_CHILD,
            r.left, r.top, r.right - r.left, r.bottom - r.top,
            hwnd, NULL, NULL, hinst);

        col += 1;
    }
}
开发者ID:Barrell,项目名称:wine,代码行数:33,代码来源:main.c

示例3: draw_joystick_axes

static void draw_joystick_axes(HWND hwnd, struct JoystickData* data)
{
    int i;
    HINSTANCE hinst = (HINSTANCE) GetWindowLongPtrW(hwnd, GWLP_HINSTANCE);
    static const WCHAR button_class[] = {'B','u','t','t','o','n','\0'};
    static const WCHAR axes_names[TEST_MAX_AXES][7] = { {'X',',','Y','\0'}, {'R','x',',','R','y','\0'},
                                                        {'Z',',','R','z','\0'}, {'P','O','V','\0'} };
    static const DWORD axes_idc[TEST_MAX_AXES] = { IDC_TESTGROUPXY, IDC_TESTGROUPRXRY,
                                                   IDC_TESTGROUPZRZ, IDC_TESTGROUPPOV };

    for (i = 0; i < TEST_MAX_AXES; i++)
    {
        RECT r;
        /* Set axis box name */
        SetWindowTextW(GetDlgItem(hwnd, axes_idc[i]), axes_names[i]);

        r.left = (TEST_AXIS_X + TEST_NEXT_AXIS_X*i);
        r.top = TEST_AXIS_Y;
        r.right = r.left + TEST_AXIS_SIZE_X;
        r.bottom = r.top + TEST_AXIS_SIZE_Y;
        MapDialogRect(hwnd, &r);

        data->graphics.axes[i] = CreateWindowW( button_class, NULL, WS_CHILD | WS_VISIBLE,
            r.left, r.top, r.right - r.left, r.bottom - r.top,
            hwnd, NULL, NULL, hinst);
    }
}
开发者ID:Barrell,项目名称:wine,代码行数:27,代码来源:main.c

示例4: clutter_win32_get_stage_from_window

/**
 * clutter_win32_get_stage_from_window:
 * @hwnd: a window handle
 *
 * Gets the stage for a particular window.
 *
 * Return value: The stage or NULL if a stage does not exist for the
 * window.
 *
 * Since: 0.8
 */
ClutterStage *
clutter_win32_get_stage_from_window (HWND hwnd)
{
  /* Check whether the window handle is an instance of the stage
     window class */
  if ((ATOM) GetClassLongPtrW (hwnd, GCW_ATOM)
      == clutter_stage_win32_get_window_class ())
    /* If it is there should be a pointer to the stage in the window
       extra data */
    return CLUTTER_STAGE_WIN32 (GetWindowLongPtrW (hwnd, 0))->wrapper;
  else
    {
      /* Otherwise it might be a foreign window so we should check the
	 stage list */
      ClutterStageManager *stage_manager;
      const GSList        *stages, *l;

      stage_manager = clutter_stage_manager_get_default ();
      stages = clutter_stage_manager_peek_stages (stage_manager);

      for (l = stages; l != NULL; l = l->next)
	{
	  ClutterStage *stage = l->data;
	  ClutterStageWindow *impl;

	  impl = _clutter_stage_get_window (stage);
	  g_assert (CLUTTER_IS_STAGE_WIN32 (impl));

	  if (CLUTTER_STAGE_WIN32 (impl)->hwnd == hwnd)
	    return stage;
	}
    }

  return NULL;
}
开发者ID:ChrisCummins,项目名称:clutter,代码行数:46,代码来源:clutter-stage-win32.c

示例5: ACLBoxSubclassProc

static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    IAutoCompleteImpl *This = (IAutoCompleteImpl *)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
    WCHAR *msg;
    int sel, len;

    switch (uMsg) {
	case WM_MOUSEMOVE:
	    sel = SendMessageW(hwnd, LB_ITEMFROMPOINT, 0, lParam);
	    SendMessageW(hwnd, LB_SETCURSEL, (WPARAM)sel, (LPARAM)0);
	    break;
	case WM_LBUTTONDOWN:
	    sel = SendMessageW(hwnd, LB_GETCURSEL, 0, 0);
	    if (sel < 0)
		break;
	    len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, 0);
	    msg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len+1)*sizeof(WCHAR));
	    SendMessageW(hwnd, LB_GETTEXT, sel, (LPARAM)msg);
	    SendMessageW(This->hwndEdit, WM_SETTEXT, 0, (LPARAM)msg);
	    SendMessageW(This->hwndEdit, EM_SETSEL, 0, lstrlenW(msg));
	    ShowWindow(hwnd, SW_HIDE);
	    HeapFree(GetProcessHeap(), 0, msg);
	    break;
	default:
	    return CallWindowProcW(This->wpOrigLBoxProc, hwnd, uMsg, wParam, lParam);
    }
    return 0;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:28,代码来源:autocomplete.c

示例6: OB_Paint

static void OB_Paint( HWND hwnd, HDC hDC, UINT action )
{
    LONG state = get_button_state( hwnd );
    DRAWITEMSTRUCT dis;
    LONG_PTR id = GetWindowLongPtrW( hwnd, GWLP_ID );
    HWND parent;
    HFONT hFont, hPrevFont = 0;
    HRGN hrgn;

    dis.CtlType    = ODT_BUTTON;
    dis.CtlID      = id;
    dis.itemID     = 0;
    dis.itemAction = action;
    dis.itemState  = ((state & BST_FOCUS) ? ODS_FOCUS : 0) |
                     ((state & BST_PUSHED) ? ODS_SELECTED : 0) |
                     (IsWindowEnabled(hwnd) ? 0: ODS_DISABLED);
    dis.hwndItem   = hwnd;
    dis.hDC        = hDC;
    dis.itemData   = 0;
    GetClientRect( hwnd, &dis.rcItem );

    if ((hFont = get_button_font( hwnd ))) hPrevFont = SelectObject( hDC, hFont );
    parent = GetParent(hwnd);
    if (!parent) parent = hwnd;
    SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd );

    hrgn = set_control_clipping( hDC, &dis.rcItem );

    SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
    if (hPrevFont) SelectObject(hDC, hPrevFont);
    SelectClipRgn( hDC, hrgn );
    if (hrgn) DeleteObject( hrgn );
}
开发者ID:hejin,项目名称:wine,代码行数:33,代码来源:button.c

示例7: DefWndNCLButtonDblClk

LRESULT
DefWndNCLButtonDblClk(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
  ULONG Style;

  Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
  switch(wParam)
  {
    case HTCAPTION:
    {
      /* Maximize/Restore the window */
      if((Style & WS_CAPTION) == WS_CAPTION && (Style & WS_MAXIMIZEBOX))
      {
        SendMessageW(hWnd, WM_SYSCOMMAND, ((Style & (WS_MINIMIZE | WS_MAXIMIZE)) ? SC_RESTORE : SC_MAXIMIZE), 0);
      }
      break;
    }
    case HTSYSMENU:
    {
      HMENU hSysMenu = GetSystemMenu(hWnd, FALSE);
      UINT state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
                  
      /* If the close item of the sysmenu is disabled or not present do nothing */
      if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
          break;

      SendMessageW(hWnd, WM_SYSCOMMAND, SC_CLOSE, lParam);
      break;
    }
    default:
      return DefWndNCLButtonDown(hWnd, wParam, lParam);
  }
  return(0);
}
开发者ID:RPG-7,项目名称:reactos,代码行数:34,代码来源:nonclient.c

示例8: Help_OnSize

static LRESULT Help_OnSize(HWND hWnd)
{
    HHInfo *pHHInfo = (HHInfo *)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
    DWORD dwSize;
    RECT rc;

    if (!pHHInfo)
        return 0;

    NP_GetNavigationRect(pHHInfo, &rc);
    SetWindowPos(pHHInfo->WinType.hwndNavigation, HWND_TOP, 0, 0,
                 rc.right, rc.bottom, SWP_NOMOVE);

    SB_GetSizeBarRect(pHHInfo, &rc);
    SetWindowPos(pHHInfo->hwndSizeBar, HWND_TOP, rc.left, rc.top,
                 rc.right, rc.bottom, SWP_SHOWWINDOW);

    HP_GetHTMLRect(pHHInfo, &rc);
    SetWindowPos(pHHInfo->WinType.hwndHTML, HWND_TOP, rc.left, rc.top,
                 rc.right, rc.bottom, SWP_SHOWWINDOW);

    /* Resize browser window taking the frame size into account */
    dwSize = GetSystemMetrics(SM_CXFRAME);
    ResizeWebBrowser(pHHInfo, rc.right - dwSize, rc.bottom - dwSize);

    return 0;
}
开发者ID:mikekap,项目名称:wine,代码行数:27,代码来源:help.c

示例9: WinPosActivateOtherWindow

/*******************************************************************
 *         WINPOS_ActivateOtherWindow
 *
 *  Activates window other than pWnd.
 */
void
WINAPI
WinPosActivateOtherWindow(HWND hwnd)
{
    HWND hwndTo, fg;

    if ((GetWindowLongPtrW( hwnd, GWL_STYLE ) & WS_POPUP) && (hwndTo = GetWindow( hwnd, GW_OWNER )))
    {
        hwndTo = GetAncestor( hwndTo, GA_ROOT );
        if (can_activate_window( hwndTo )) goto done;
    }

    hwndTo = hwnd;
    for (;;)
    {
        if (!(hwndTo = GetWindow( hwndTo, GW_HWNDNEXT ))) break;
        if (can_activate_window( hwndTo )) break;
    }

 done:
    fg = GetForegroundWindow();
    TRACE("win = %p fg = %p\n", hwndTo, fg);
    if (!fg || (hwnd == fg))
    {
        if (SetForegroundWindow( hwndTo )) return;
    }
    if (!SetActiveWindow( hwndTo )) SetActiveWindow(0);
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:33,代码来源:winpos.c

示例10: dlgProc

  static INT_PTR CALLBACK dlgProc(HWND i_hwnd, UINT i_message,
				  WPARAM i_wParam, LPARAM i_lParam)
  {
    DialogPassphrase *This =
      reinterpret_cast<DialogPassphrase *>(
	GetWindowLongPtrW(i_hwnd, GWLP_USERDATA));
    if (!This)
      switch (i_message)
      {
	case WM_INITDIALOG:
	  This = reinterpret_cast<DialogPassphrase *>(i_lParam);
	  SetWindowLongPtrW(i_hwnd, GWLP_USERDATA, i_lParam);
	  This->initialize(i_hwnd);
	  return This->wmInitDialog(reinterpret_cast<HWND>(i_wParam));
      }
    else
      switch (i_message)
      {
	case WM_CLOSE:
	  return This->wmClose();
	case WM_COMMAND:
	  return This->wmCommand(HIWORD(i_wParam), LOWORD(i_wParam),
				 reinterpret_cast<HWND>(i_lParam));
      }
    return FALSE;
  }
开发者ID:ganaware,项目名称:win-ssh-agent,代码行数:26,代码来源:askpass.cpp

示例11: wined3d_unregister_window

void wined3d_unregister_window(HWND window)
{
    unsigned int i;

    wined3d_mutex_lock();
    for (i = 0; i < wndproc_table.count; ++i)
    {
        if (wndproc_table.entries[i].window == window)
        {
            struct wined3d_wndproc *entry = &wndproc_table.entries[i];
            struct wined3d_wndproc *last = &wndproc_table.entries[--wndproc_table.count];

            if (entry->unicode)
            {
                if (GetWindowLongPtrW(window, GWLP_WNDPROC) == (LONG_PTR)wined3d_wndproc)
                    SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)entry->proc);
            }
            else
            {
                if (GetWindowLongPtrA(window, GWLP_WNDPROC) == (LONG_PTR)wined3d_wndproc)
                    SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)entry->proc);
            }
            if (entry != last) *entry = *last;
            wined3d_mutex_unlock();

            return;
        }
    }
    wined3d_mutex_unlock();

    ERR("Window %p is not registered with wined3d.\n", window);
}
开发者ID:r6144,项目名称:wine,代码行数:32,代码来源:wined3d_main.c

示例12: BotCfg_OnCommand

BOOL BotCfg_OnCommand( HWND hDlg, WPARAM wParam, LPARAM lParam )
{
    UNREFERENCED_PARAMETER(lParam);
    BotCfgDlgSt *st = (BotCfgDlgSt *)GetWindowLongPtrW( hDlg, GWLP_USERDATA );
    int ctrlID = LOWORD(wParam);
    switch( ctrlID )
    {
    case IDCANCEL:
        EndDialog( hDlg, IDCANCEL );
        break;
    case IDOK:
        BotCfg_OnOK( hDlg, st );
        break;
    case IDC_APPLY:
        BotCfg_OnApply( hDlg, st );
        break;
    case IDC_LOAD:
        BotCfg_OnLoad( hDlg, st );
        break;
    case IDC_SAVE:
        BotCfg_OnSave( hDlg, st );
        break;
    default:
        return FALSE;
        break; // call default handler
    }
    return TRUE;
}
开发者ID:minlexx,项目名称:l2-unlegits,代码行数:28,代码来源:BotCfgDlg.cpp

示例13: draw_joystick_buttons

static void draw_joystick_buttons(HWND hwnd, struct JoystickData* data)
{
    int i;
    int row = 0, col = 0;
    WCHAR button_label[3];
    HINSTANCE hinst = (HINSTANCE) GetWindowLongPtrW(hwnd, GWLP_HINSTANCE);
    static WCHAR button_class[] = {'B','u','t','t','o','n','\0'};

    for (i = 0; i < TEST_MAX_BUTTONS; i++)
    {
        if ((i % TEST_BUTTON_COL_MAX) == 0 && i != 0)
        {
            row += 1;
            col = 0;
        }

        button_number_to_wchar(i + 1, button_label);

        data->buttons[i] = CreateWindowW(button_class, button_label, WS_CHILD,
            TEST_BUTTON_X + TEST_NEXT_BUTTON_X*col, TEST_BUTTON_Y + TEST_NEXT_BUTTON_Y*row,
            TEST_BUTTON_SIZE_X, TEST_BUTTON_SIZE_Y,
            hwnd, NULL, NULL, hinst);

        col += 1;
    }
}
开发者ID:MortenRoenne,项目名称:wine,代码行数:26,代码来源:main.c

示例14: SYSLINK_SendParentNotify

/***********************************************************************
 *           SYSLINK_SendParentNotify
 * Sends a WM_NOTIFY message to the parent window.
 */
static LRESULT SYSLINK_SendParentNotify (const SYSLINK_INFO *infoPtr, UINT code, const DOC_ITEM *Link, int iLink)
{
    NMLINK nml;

    nml.hdr.hwndFrom = infoPtr->Self;
    nml.hdr.idFrom = GetWindowLongPtrW(infoPtr->Self, GWLP_ID);
    nml.hdr.code = code;

    nml.item.mask = 0;
    nml.item.iLink = iLink;
    nml.item.state = 0;
    nml.item.stateMask = 0;
    if(Link->u.Link.szID)
    {
        lstrcpyW(nml.item.szID, Link->u.Link.szID);
    }
    else
    {
        nml.item.szID[0] = 0;
    }
    if(Link->u.Link.szUrl)
    {
        lstrcpyW(nml.item.szUrl, Link->u.Link.szUrl);
    }
    else
    {
        nml.item.szUrl[0] = 0;
    }

    return SendMessageW(infoPtr->Notify, WM_NOTIFY, nml.hdr.idFrom, (LPARAM)&nml);
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:35,代码来源:syslink.c

示例15: ShellAboutW

/*************************************************************************
 * ShellAboutW                [SHELL32.289]
 */
BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
                         HICON hIcon )
{
    ABOUT_INFO info;
    HRSRC hRes;
    DLGTEMPLATE *DlgTemplate;
    BOOL bRet;

    TRACE("\n");

    // DialogBoxIndirectParamW will be called with the hInstance of the calling application, so we have to preload the dialog template
    hRes = FindResourceW(shell32_hInstance, MAKEINTRESOURCEW(IDD_ABOUT), (LPWSTR)RT_DIALOG);
    if(!hRes)
        return FALSE;

    DlgTemplate = (DLGTEMPLATE *)LoadResource(shell32_hInstance, hRes);
    if(!DlgTemplate)
        return FALSE;

    info.szApp        = szApp;
    info.szOtherStuff = szOtherStuff;
    info.hIcon        = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );

    bRet = DialogBoxIndirectParamW((HINSTANCE)GetWindowLongPtrW( hWnd, GWLP_HINSTANCE ),
                                   DlgTemplate, hWnd, AboutDlgProc, (LPARAM)&info );
    return bRet;
}
开发者ID:GYGit,项目名称:reactos,代码行数:30,代码来源:shell32_main.c


注:本文中的GetWindowLongPtrW函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。