CreateControl

PowerBuilder Native Interface

IPBX_VisualObject interface:

CreateControl method

Description

Creates a window control and returns its handle to the PowerBuilder VM.

Syntax

CreateControl(DWORD dwExStyle, LPCTSTR lpWindowName, DWORD dwStyle,   int x,  int y, int nWidth,  int nHeight,  HWND hWndParent,   HINSTANCE hInstance)

Argument

Description

dwExStyle

The extended window style

lpWindowName

The window name

dwStyle

The window style

x

The horizontal position of the window

y

The vertical position of the window

nWidth

The window's width

nHeight

The window's height

hWndParent

The handle of the parent or owner window

hInstance

The handle of the application instance

Return Values

HWND.

Examples

This is part of a visual extension example available on the Sybase Web site:

LPCTSTR CVisualExt::GetWindowClassName()
{
   return s_className;
}

HWND CVisualExt::CreateControl
(
   DWORD dwExStyle, // extended window style
   LPCTSTR lpWindowName, // window name
   DWORD dwStyle, // window style
   int x, // horizontal position of window
   int y, // vertical position of window
   int nWidth, // window width
   int nHeight, // window height
   HWND hWndParent, // handle to parent or owner window
   HINSTANCE hInstance // handle to application instance
)
{
   d_hwnd = CreateWindowEx(dwExStyle, s_className,
      lpWindowName, dwStyle, x, y, nWidth, nHeight,
      hWndParent, NULL, hInstance, NULL);

   ::SetWindowLong(d_hwnd, GWL_USERDATA, (LONG)this);

   return d_hwnd;
}

Usage

The window must be registered before you call CreateControl.

See Also