Problem with CreateWindowEx() for Listboxes

This is a discussion on Problem with CreateWindowEx() for Listboxes within the Windows Programming forums, part of the Platform Specific Boards category; I am trying to make a list box, Code: HWND hwndListBox; hwndListBox = CreateWindowEx(0, "LISTBOX", "", LBS_STANDARD | WS_VISIBLE, 5, ...

  1. #1
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552

    Problem with CreateWindowEx() for Listboxes

    I am trying to make a list box,

    Code:
          HWND hwndListBox;
          hwndListBox = CreateWindowEx(0, "LISTBOX", "", LBS_STANDARD |
            WS_VISIBLE, 5, 5, 30, 50, hwnd, (HMENU)IDC_LISTBOX, 
            GetModuleHandle(NULL), NULL);
    and MSVC++ keeps throwing up errors at me.

    error C2143: syntax error : missing ')' before ';'
    error C2660: 'CreateWindowExA' : function does not take 10 parameters
    error C2143: syntax error : missing ';' before ','
    error C2059: syntax error : ')'

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,786
    Do you have resource.h included?

  3. #3
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753
    this is probably not the problem, but in your program do you have the createwindowex function taking up 3 lines? if so, put it into 1.

    the reason i say is this:

    1) It says you are giving it 10 parameters, and the first two lines contain 10 parameters, the last two are on the third line

    2) You are missing a ';' before the ',' and those other two errors similar could seem true if you think like a "confused compiler"

    believe me, i've seen REALLY strange things happen while using MSVC++ 6, who knows maybe it'll make a difference maybe not

  4. #4
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753
    oh and just to help support my odd theory, i compiled this and got the exact same errors you did:
    Code:
    HWND hwndListBox;
          hwndListBox = CreateWindowEx(0, "LISTBOX", "", LBS_STANDARD |
            WS_VISIBLE, 5, 5, 30, 50, hWnd, (HMENU)IDR_MYMENU;, 
            GetModuleHandle(NULL), NULL);
    C:\Documents and Settings\john\Desktop\LeeGames\Pong\main.cpp(87) : error C2143: syntax error : missing ')' before ';'
    C:\Documents and Settings\john\Desktop\LeeGames\Pong\main.cpp(87) : error C2660: 'CreateWindowExA' : function does not take 10 parameters
    C:\Documents and Settings\john\Desktop\LeeGames\Pong\main.cpp(87) : error C2143: syntax error : missing ';' before ','
    C:\Documents and Settings\john\Desktop\LeeGames\Pong\main.cpp(88) : error C2059: syntax error : ')'

    this leads me to believe that your compiler thinks you are ending the function at the end of the second line, notice that semicolon in the chunk i compiled?
    Last edited by Leeman_s; 01-05-2003 at 12:20 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 05:24 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 04:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21