Click to See Complete Forum and Search --> : CreateWindowEx - no result


Ali Imran
March 4th, 2008, 03:29 PM
Hello gurus.


Problem:

function CreateWindowEx does not create statusbar window, where everything is fine. I am using Visual Studio 8. See following code please:

HWND hwnd = CreateWindowEx(
0,
STATUSCLASSNAME,(TCHAR*)NULL,
WS_VISIBLE | WS_CHILD | SBARS_SIZEGRIP,
0,0,0,0,
parenthwnd, //it is valid
(HMENU)unique_ID, //1005
GetModuleHandle(NULL),
NULL
);

Where:

1. I have initialized Common Controls using ICC_BAR_CLASSES, so it is not issue
2. parenthwnd is valid window handle


Question:

1. Why there is no window created ? where hwnd is NULL as result of this function.
2. I am compiling it as UNICODE application, can this be issue?
3. You have any other suggestion using which I can make it work ?


Waiting for the kind reply. It is really strange how statusbar is not being created.



regards

Martin O
March 4th, 2008, 05:00 PM
This is from the MSDN docs for CreateWindowEx:


If the function succeeds, the return value is a handle to the new window.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

This function typically fails for one of the following reasons:

- an invalid parameter value
- the system class was registered by a different module
- The WH_CBT hook is installed and returns a failure code
- if one of the controls in the dialog template is not registered, or its window window procedure fails WM_CREATE or WM_NCCREATE

Ali Imran
March 4th, 2008, 05:05 PM
Resolved.

Actaully am polishing my library to port it to MSVC and instance of parent class passed did not have valid handle, and it was destroyed before being assigned as parent window.

Thanks for your input.