Hello,
I am trying to make a simple control, by creating a child window. I have already created another window successfully, who's handle is "h_parent". (My application instance is "h_instance".) I have then tried to create the child window, using the code below, but it does not work. The program freezes for a few seconds at the CreateWindowEx function, and then gives me an unhandled exception from the file <xutility>. Any ideas what I am doing wrong? Thanks.
Code:
HWND CreateControl(HWND h_parent, HINSTANCE h_instance)
{
DWORD extended_window_style = 0;
LPCSTR window_class_name = "my_control";
LPCSTR window_name = "";
DWORD window_style = WS_CHILD | WS_VISIBLE;
int x = 0;
int y = 0;
int width = 100;
int height = 100;
HWND parent_window_handle = h_parent;
HMENU menu_handle = NULL;
HINSTANCE app_instance_handle = h_instance;
LPVOID window_creation_data = NULL;
HWND h_control = CreateWindowEx(extended_window_style, window_class_name, window_name, window_style, x, y, width, height, parent_window_handle, menu_handle, app_instance_handle, window_creation_data);
return h_control;
}