Thread: A pop up window with controls, unknown control IDs

  1. #1
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257

    A pop up window with controls, unknown control IDs

    Hi,

    I'm using MS VC++ 6.0.
    I've been following a tutorial to create a pop up window with 3 buttons: Open, Cancel and Connect. In the resource file I'm trying to define these controls but I keep getting an error:
    Code:
    SelectBafFile DIALOG 0, 0, 300, 200 
    
    CAPTION "BAF File Selection" 
    
    STYLE DS_MODALFRAME | WS_VISIBLE | WS_CAPTION | WS_SYSMENU 
    
    { 
    
    // Controls for the dialog will go here 
    
    	DEFPUSHBUTTON "Cancel", IDCANCEL,174,35,50,14,WS_VISIBLE | WS_CHILD | WS_TABSTOP
    
    	PUSHBUTTON "Open" ,IDB_OPEN,174,18,50,14,WS_VISIBLE | WS_CHILD | WS_TABSTOP
    	PUSHBUTTON "Connect" ,IDB_CONNECT, 174, 52, 50, 14, WS_VISIBLE | WS_CHILD | WS_TABSTOP
    
    }
      AND THE ERROR:
    Code:
    error RC2104 : undefined keyword or key name: IDB_OPEN
    Error executing rc.exe.
    If I use IDOK or IDCANCEL it is fine, otherwise it gives an error. what did I forget to add?
    Thanks.
    Everything is relative...

  2. #2
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257
    I simply had to add thi sin the resource.h for the project:
    Code:
    #define IDB_CONNECT						1013
    #define	IDB_OPEN						1014
    #define	IDB_CANCEL						1015
    that did it. I'm just not sure where the 1013-1015 will come into play.
    Everything is relative...

  3. #3
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    If you are manually creating all of your resources/controls, it won't make a difference. The values just need to be unique identifiers. IDYES and IDNO worked because they are defined in the MFC headers. If you manually add controls to a MSVC-generated resource file things can get a little messy, but there really isn't much more to it than you've discovered.

  4. #4
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257
    That's what I thoughtt too.

    Thanks for acknowledgement.

    AS.
    Everything is relative...

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>I'm just not sure where the 1013-1015 will come into play.

    Each controls/dialog or window has an int ID number that distingushes it. When the OPEN button is pressed your app generates a message (a BN_CLICKED = Button Notification Clicked).
    This message is sent to the parents (owners) function for processing messages (callback).
    The callback must then decide which button was pressed and so what it must do.

    There are two ways of telling which button was pressed, the buttons HWND or its ID. The HWND will change each time the app is run but the ID remains constant.

    Programmers understand case IDB_OPEN:
    the code understands case 1014:
    "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

  6. #6
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257
    That makes a lot of sense thanks.

    AS.
    Everything is relative...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  2. Adding buttons, edit boxes, etc to the window
    By rainmanddw in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2006, 03:07 PM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  4. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  5. Edit controls not sending messages to parent window
    By EMiller in forum Windows Programming
    Replies: 5
    Last Post: 11-13-2001, 11:03 PM