Thread: confused about adding controls to main window

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    113

    Talking confused about adding controls to main window

    hello,
    i'm trying to learn the win32 api with a tutorial, we made a lot of exercises with dialogBoxes to learn the windows controls(buttons,editBox,etc),. the typical application is:

    an empty main window with a menu where you click it and displays a dialog box with some controls, this dialog box and its controls is made in a .rc file.
    ok i cant find a way to "add" some controls to the "main" application window without the use of dialog's, you can add controls to the main window only created at runtime??
    thanks for any help or ligth where i should look for this kind of sample how to add buttons, edit boxes etc to a "main window" that has not dialog boxes

    in other words i need a simple window with a button in it and when you click that button something happens, i know how to create the window, etc but cant figure out how to add that button

    thanks for any help, and please excuse my poor english
    Last edited by terracota; 11-23-2004 at 02:35 PM.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Just use CreateWindowEx to create any additional controls as and when you need them.

    You might find it useful to read up on windows and controls.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    113
    so, you cant add a button created in a resource file .rc to the main window ? you just can add it or create it with the CreateWindowEx()?

    thanks for reply

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Not dynamically. One workaround is to make the controls initially invisible in the resource script (no WS_VISIBLE style) and then make them visible with ShowWindow when you need to.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    113
    thanks thats exactly im looking for

    thanks for help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  2. Memory leaks problem in C -- Help please
    By Amely in forum C Programming
    Replies: 14
    Last Post: 05-21-2008, 11:16 AM
  3. creating a child window
    By rakan in forum Windows Programming
    Replies: 2
    Last Post: 01-23-2007, 03:22 PM
  4. dont want to use all params
    By stallion in forum Windows Programming
    Replies: 2
    Last Post: 02-18-2003, 08:10 AM
  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