Thread: Whats' wrong with this windows Macro?

  1. #1
    Registered User
    Join Date
    Jan 2002

    Whats' wrong with this windows Macro?

    Please help me solve the following:

    /*Now create the button.*/

    hwndButton = CreateWindow (
    "button", /*Builtin button class.*/
    "Click Here",

    hwnd, /*Parent is this window.*/

    (HMENU) 1, /*Control ID:1 */

    ((LPCREATESTRUCT) lParam)-> hInstance,


    return 0;


    I get the error message: Macro 'Create WindowA' used with
    only 10 args.

    How do I resolve this?

    Thank you,


  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    MSDN lists 11 params, but when I the autohelp lists the params as I type out the function it only lists 10 (int nHeight is missing). I normally use CreateWindowEx so I'm not too familiar with CreateWindow.

    This is what's listed in the MSDN library:

    HWND CreateWindow(
    LPCTSTR lpClassName, // pointer to registered class name
    LPCTSTR lpWindowName, // pointer to window name
    DWORD dwStyle, // window style
    int x, // horizontal position of window
    int y, // vertical position of window
    int nWidth, // window width
    int nHeight, // window height
    HWND hWndParent, // handle to parent or owner window
    HMENU hMenu, // handle to menu or child-window identifier
    HANDLE hInstance, // handle to application instance
    LPVOID lpParam // pointer to window-creation data

    I just check the msdn site and they list the same thing (as my msdn library). Weird?
    Last edited by jdinger; 03-20-2002 at 09:40 PM.

  3. #3
    train spotter
    Join Date
    Aug 2001
    near a computer
    (HMENU) 1, /*Control ID:1 */

    Could be a confilict with some other ctrl.

    I would use
    #define IDD_MYDIALOG 10001

    Check your resource.h for conflicts.

    ((LPCREATESTRUCT) lParam)-> hInstance,

    AFAIK this struct is only passed on WM_CREATE. So this code is in response to a window being created? (or you are keeping a static to the pointer to the struct ie may not be valid pointer)

    In my opinion you should keep the HINSTANCE as a global. Or at least a local to the winmain source file. I think this is the problem.

    or look here for a couple of ways to get the HINSTANCE
    Last edited by novacain; 03-20-2002 at 11:22 PM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Registered User
    Join Date
    Jan 2002


    Thanks to both of you.
    I will take some time
    to study your suggestions.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Network Programming in C for Windows
    By m.mixon in forum C Programming
    Replies: 7
    Last Post: 06-19-2006, 08:27 PM
  2. LoadFromFile() causes Windows 98 to freeze?
    By MidnightlyCoder in forum Windows Programming
    Replies: 8
    Last Post: 03-17-2006, 02:23 PM
  3. Program works on Windows XP and 2000, not on 98 or ME
    By MidnightlyCoder in forum C++ Programming
    Replies: 7
    Last Post: 03-10-2006, 03:36 PM
  4. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  5. Windows Memory Allocation :: C++
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 11-03-2002, 12:13 PM