Thread: common controls

  1. #1
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002

    common controls

    for my own personal use, I'm making a header file that creates some of the more common controls such as buttons, text, etc. This is how I create one of the controls:

    HFONT hfDefault;
    HWND current;
    current=CreateWindowEx(0, "BUTTON", caption,WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,xpos, ypos, length, width, hWnd,NULL,NULL, NULL);
    hfDefault =(HFONT)GetStockObject(DEFAULT_GUI_FONT);
    SendMessage(current, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));
    but i have a few questions.

    1.)How do you delete the button off the window?
    2.)How would you go about changing the WS_VISIBLE option?
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  2. #2
    Programming is fun, mkay?
    Join Date
    Oct 2001

    Lightbulb For the WS_VISIBLE...

    To get rid of/get back the WS_VISIBLE, you use SetWindowLong(...), like this:

    SetWindowLong(hwndButton, GWL_STYLE, WS_CHILD);

    to get it back:

    SetWindowLong(hwndButton, GWL_STYLE, WS_CHILD | WS_VISIBLE);

    You will have to use UpdateWindow(hwndOwner); or something like that to update the visibility of the button when you change its style.


    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  3. #3
    train spotter
    Join Date
    Aug 2001
    near a computer
    Hide / show the button from view with ShowWindow() .
    DestroyWindow() to kill it compleatly.
    "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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Win32 Common Controls in C++, how do i make and use them?
    By C+noob in forum Windows Programming
    Replies: 6
    Last Post: 01-09-2006, 11:53 AM
  2. sizing common controls
    By Nor in forum Windows Programming
    Replies: 2
    Last Post: 07-21-2003, 02:02 PM
  3. common dialog controls
    By lambs4 in forum Windows Programming
    Replies: 2
    Last Post: 11-05-2002, 07:33 PM
  4. common controls and mouse clicks
    By bennyandthejets in forum Windows Programming
    Replies: 4
    Last Post: 09-11-2002, 03:50 AM
  5. Site on Making Common Controls like BUttons
    By knight543 in forum Windows Programming
    Replies: 3
    Last Post: 03-02-2002, 06:10 PM