Defining IDs

This is a discussion on Defining IDs within the Windows Programming forums, part of the Platform Specific Boards category; I don't think this has happened to me before. I was defining a few IDs for some buttons and Edit ...

  1. #1
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532

    Defining IDs

    I don't think this has happened to me before. I was defining a few IDs for some buttons and Edit boxes I was going to use and it comes up with this error when I try to compile:
    Code:
    35 c:\windows\profiles\hpuser~1\desktop\login.cpp
     passing `int' to argument 10 of `CreateWindowExA(long unsigned int, const CHAR *, const CHAR *, long unsigned int, int, int, int, int, HWND__ *, HMENU__ *, HINSTANCE__ *, void *)' lacks a cast
    If it can't be defined as an integer what can it be defined as? The only value that works is 0, but you can't define more than one thing as the same value. This is probably a simple question. Thanks.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Try casting it to a HMENU.

    Something like

    Code:
    (HMENU) BUTTON_ID

  3. #3
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    It lets me define and apply that ID to the button, in the CreateWindowEx function, but then I wrote this code to make it does something:
    Code:
    case WM_COMMAND:
    switch(HIWORD(wParam))
    {
    case ID_BUTTON:
    //code to execute when clicked
    break;
    }
    return 0;
    It's saying the ID needs to be an integer to use the WM_COMMAND on it. Do I need to write a whole different window processing function to make it receive messages telling the window it has been clicked? Thanks for answering me, Dante Shamest.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  4. #4
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Use LOWORD(wParam), not HIWORD(wParam).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Defining const in a class
    By g4j31a5 in forum C++ Programming
    Replies: 5
    Last Post: 11-20-2006, 11:27 AM
  2. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-24-2004, 12:22 AM
  3. Defining Class memeber functions
    By silk.odyssey in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 06:50 PM
  4. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 08:26 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 04:49 AM

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