CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Location
    Pakistan
    Posts
    466

    Question CreateWindowEx - no result

    Hello gurus.


    Problem:

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

    Code:
    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
    » Please 'Rate This Post' if it helped (encourage us to help you more)
    » Build GUI in minute using rad c++
    » Free IDE + GUI code generator - screenshot
    » Free WINAPI sourcecode and tutorials

  2. #2
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    Re: CreateWindowEx - no result

    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

  3. #3
    Join Date
    Nov 2004
    Location
    Pakistan
    Posts
    466

    Re: CreateWindowEx - no result

    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.
    » Please 'Rate This Post' if it helped (encourage us to help you more)
    » Build GUI in minute using rad c++
    » Free IDE + GUI code generator - screenshot
    » Free WINAPI sourcecode and tutorials

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured