Help Center

AfxCWindowPtrfunction

Returns a pointer to the **CWindow** class given the handle of the main window or the CREATESTRUCT structure associated with it.

WindowsfunctionCWindow.incdocumented

Syntax

FUNCTION AfxCWindowPtr (BYVAL hwnd AS HWND) AS CWindow PTR
FUNCTION AfxCWindowPtr (BYVAL lParam AS LPARAM) AS CWindow PTR
FUNCTION AfxCWindowPtr (BYVAL pCreateStruct AS CREATESTRUCT PTR) AS CWindow PTR

Parameters

NameDescription
hwndHandle of the main window created with the Create method of the CWindow class.
lParamValue passed by Windows to the WM_CREATE message.
pCreateStructPointer to the CREATESTRUCT structure used by Windows during the window creation and passed to the window procedure as the lParam parameter of the WM_CREATE message.

Return value

A pointer to the CWindow class or NULL.

Description

Returns a pointer to the CWindow class given the handle of the main window or the CREATESTRUCT structure associated with it. To retrieve it from the handle of any of its child windows or controls, use AfxCWindowOwnerPtr.

Examples

DIM pWindow AS CWindow PTR = AfxCWindowPtr(hwnd)

DIM pWindow AS CWindow PTR = AfxCWindowPtr(lParam)

Reference

  • Include file CWindow.inc
  • Defined in AfxNova/CWindow.inc:2577
  • Documented in Windows/Windows GUI/CWindow Class.md
  • Topic: CWindow Class