Results 1 to 7 of 7

Thread: Controls ?

  1. #1

    Thread Starter
    Lively Member slx47's Avatar
    Join Date
    Apr 2002
    Location
    US
    Posts
    127

    Controls ?

    I am not using Microsofts comipiler.

    How would i add a command button in a win32 app in code ?

  2. #2
    Frenzied Member Technocrat's Avatar
    Join Date
    Jan 2000
    Location
    I live in the 1s and 0s of everyones data streams
    Posts
    1,024
    PHP Code:
    btn_hWnd CreateWindow("Button"CaptionBS_PUSHBUTTON WS_CHILDXYWidthHeightWindow_hWndHMENU_IDhInstNULL);
    ShowWindow(btn_hWnd,SW_NORMAL); 
    MSVS 6, .NET & .NET 2003 Pro
    I HATE MSDN with .NET & .NET 2003!!!

    Check out my sites:
    http://www.filthyhands.com
    http://www.techno-coding.com


  3. #3

    Thread Starter
    Lively Member slx47's Avatar
    Join Date
    Apr 2002
    Location
    US
    Posts
    127

    umm...

    can someone break it down a little more ?

  4. #4
    Frenzied Member Technocrat's Avatar
    Join Date
    Jan 2000
    Location
    I live in the 1s and 0s of everyones data streams
    Posts
    1,024
    ok...

    Originally posted by Technocrat
    PHP Code:
    btn_hWnd CreateWindow("Button"CaptionBS_PUSHBUTTON WS_CHILDXYWidthHeightWindow_hWndHMENU_IDhInstNULL);
    btn_hWnd is the hWnd VAR to hold the Button
    CreateWindow is the 
    function we use to make the button
    "Button" is the name of the class we are going to use
    Caption is a VAR I used to hold the buttons caption.  You could use something like "Quit"
    BS_PUSHBUTTON WS_CHILD are the flags I used.  You can look up more flags in MSDN [url]http://msdn.microsoft.com[/url]
    Y are ints that tell what X Y positions on the window you want.  In this case I used VARSyou could have just used 10,10
    Width 
    Height I think explain themselves.  I used VARsyou could have just used something like 50,50
    Window_hWnd is the handle to the window you want the button to be displayed on
    .  You could have used a global VAR for the window here
    HMENU_ID is an ID 
    #er you want to give the button.  You can use NULL
    hInst is a VAR I used to hold the Instance to the window
    NULL is 
    for creation data.  I have yet to use itso I think NULL would be the best option.

    This function shows the button on the window.
    ShowWindow(btn_hWnd,SW_NORMAL); 
    MSVS 6, .NET & .NET 2003 Pro
    I HATE MSDN with .NET & .NET 2003!!!

    Check out my sites:
    http://www.filthyhands.com
    http://www.techno-coding.com


  5. #5

    Thread Starter
    Lively Member slx47's Avatar
    Join Date
    Apr 2002
    Location
    US
    Posts
    127
    do it use windows.h library or a different one because I cant get it to work ?

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    It only uses windows.h, and it's not a library but rather a header file.

    Try adding the style WS_VISIBLE and not calling ShowWindow.

    Does it compile at all?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    I have attached an example project that creates a simple button. It's not quite finished when it comes to "CreateButtonType" function but it just goes to show you the basics of how to create a button.
    It's written in VC++ .NET because I don't have VC++ 6 installed right now.
    Baaaaaaaaah

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width