Как создать дочернее окно?
Язык: С/С++
Дочерние окна
-
ЛОХ
There is no such thing as a parent/child window. Each thread can have only one window. If you need several windows, start several threads.
In WinAPI (C/C++), you create a child window using CreateWindow or CreateWindowEx with the WS_CHILD style and pass the parent window handle as hWndParent.
HWND hChild = CreateWindowEx(
0, // Extended styles
TEXT("BUTTON"), // Class name (e.g., a button)
TEXT("Child"), // Window title
WS_CHILD | WS_VISIBLE,
10, 10, 100, 30, // Position and size
hParent, // Parent window handle
NULL, // Menu or control ID
hInstance, // Application instance
NULL // Additional data
);
Key points:
Use WS_CHILD and WS_VISIBLE.
Provide the parent window handle in the hParent parameter.
The child window will be clipped to the parent and move with it.
Who is online
Users browsing this forum: No registered users and 1 guest