Thread: How to place controls on a window

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    21

    How to place controls on a window

    I am developing a notepad package using windows API.

    To acheive that I need to place windows common controls on a window but not on a dialog box

    Can any body suggest me a solution for placing windows common controls on a window

    bye
    vamshi

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    No problem. But I must warn you, you can't make the controls in your resource file. Just use the CreateWindow() function.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    use the

    WS_CHILD style

    in the

    CreateWindowEx()

    cast the

    HMENU

    param to an int ID number

    (HMENU)IDC_MYCHILDCTRL,

    I like to define them

    #define IDC_MYCHILDCTRL 40001

    the

    hWndParent

    defines the callback (wndproc) to which the controls messages will be sent.

    Remember to

    InitCommonControlsEx()

    if using the more complex controls

    You will have to code for different window sizes / resizes ect
    "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
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>But I must warn you, you can't make the controls in your resource file<<

    You can if you use the CONTROL resource definition statement but you still need to use InitCommonControlsEx to load in comctl32.dll.

    Nice avatar, BTW, master5001.

  5. #5
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Thanks Ken. As far as using CONTROL's I would say that it is no less work using CreateWindow() or CreateWindowEx(). But that is just a matter of preference I suppose

  6. #6
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    My preference would be for CreateWindowEx, too.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Adding colour & bmps to a Win 32 Window??
    By carey_sizer in forum Windows Programming
    Replies: 4
    Last Post: 09-04-2004, 05:55 PM
  2. make window stay in one place
    By space_ in forum Windows Programming
    Replies: 1
    Last Post: 07-12-2004, 02:07 PM
  3. Changing Text/Background colours for window controls ...
    By Shag in forum Windows Programming
    Replies: 1
    Last Post: 11-16-2002, 11:57 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  5. Diff between window controls and dialog controls
    By Garfield in forum Windows Programming
    Replies: 13
    Last Post: 01-18-2002, 05:49 AM