Thread: CreateDialog() failure

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Your dialog uses a listview common control but you have not loaded in commctrl.dll so your application fails.

    Before using CreateDialog:
    Code:
    INITCOMMONCONTROLSEX icx;
    icx.dwSize=sizeof(icx);
    icx.dwICC=ICC_LISTVIEW_CLASSES;
    InitCommonControlsEx(&icx);
    You must #include <commctrl.h> and link with comctl32.lib to get this to work. Read up on the InitCommonControlsEx in msdn for more information.

    Some other points: return values from messages such as WM_DESTROY, WM_CLOSE should be zero ie FALSE. Also return FALSE from WM_INITDIALOG unless you are explicitly setting the focus to a control in your dialog yourself.

    Hope that helps.

    edit: Also read up on WinMain - the third parameter should not be a TCHAR pointer, just stick with LPSTR. This is because this parameter is never a UNICODE string so if you compile with UNICODE #defined you'll probably have problems as you have written it. If you need a UNICODE command line, use the GetCommandLine api function.

    edit: editing
    Last edited by Ken Fitlike; 05-09-2003 at 03:48 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File I/O Assertion Failure in VS2008
    By clegs in forum C Programming
    Replies: 5
    Last Post: 12-25-2008, 04:47 AM
  2. Integer Emulation
    By Elysia in forum C++ Programming
    Replies: 31
    Last Post: 03-18-2008, 01:03 PM
  3. CreateWindow failure
    By TheDan in forum Windows Programming
    Replies: 6
    Last Post: 07-08-2005, 07:49 AM
  4. Am i a Failure?
    By Failure!!! in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 05-28-2003, 11:50 AM
  5. Assertion failure while creating window
    By roktsyntst in forum Windows Programming
    Replies: 0
    Last Post: 02-10-2003, 08:18 PM