I was working to windows library, I'm new to it, but I'm gettin an error that I googled enough and I don't know what's going on.
Here is my code:
LRESULT CALLBACK WbWindow::st_wind_callback(HWND hWnd, UINT Message, WPARAM wParam, LPARAM
lParam)
{
// Code for the callback static function
return 0;
}
WbWMResult WbWindow::Create()
{
// Put in the class values for our window
class_window_instance.cbSize = sizeof(WNDCLASSEX);
class_window_instance.lpfnWndProc=WbWindow::st_wind_callback;
class_window_instance.lpszClassName = window_name;
class_window_instance.style = NULL;
class_window_instance.cbClsExtra = 0;
class_window_instance.cbWndExtra = 0;
class_window_instance.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
class_window_instance.hCursor = LoadCursor(NULL, IDC_ARROW);
class_window_instance.hIcon = LoadIcon(NULL, IDI_APPLICATION);
class_window_instance.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
class_window_instance.hInstance = main_instance;
class_window_instance.lpszMenuName = NULL;
if(!RegisterClassEx(&class_window_instance)){
MessageBox(0,"There was an error registering the window-classname.","Critical Error!",MB_ICONSTOP | MB_OK);
return WBE_CLASSREG;
}
window_instance = CreateWindowEx(WS_EX_STATICEDGE,window_name,window_title,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,window_width,window_height,NULL,NULL,main_instance,NULL);
if(window_instance == NULL){
MessageBox(0,"There was an error creating a window.","Critical Error!",MB_ICONSTOP | MB_OK);
return WBE_WINCREATION;
}
created = WbTrue;
return WB_SUCCESS;
}
The error that I get, it's an error from the debugger: Unhandled exception, it says that it's a problem with a bad pointer at .lpszMenuName, but that works in may examples, I don't know why.
What's going on and how can I fix it?
Thanks
lpszClassName
and lpWindowName
are defined as LPCSTR -- do window_name and window_title have valid string values? where are they defined?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.