|
-
Apr 29th, 2002, 01:46 PM
#1
Thread Starter
Lively Member
Controls ?
I am not using Microsofts comipiler.
How would i add a command button in a win32 app in code ?
-
Apr 29th, 2002, 02:45 PM
#2
Frenzied Member
PHP Code:
btn_hWnd = CreateWindow("Button", Caption, BS_PUSHBUTTON | WS_CHILD, X, Y, Width, Height, Window_hWnd, HMENU_ID, hInst, NULL);
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

-
Apr 29th, 2002, 05:45 PM
#3
Thread Starter
Lively Member
umm...
can someone break it down a little more ?
-
Apr 29th, 2002, 06:52 PM
#4
Frenzied Member
ok...
Originally posted by Technocrat
PHP Code:
btn_hWnd = CreateWindow("Button", Caption, BS_PUSHBUTTON | WS_CHILD, X, Y, Width, Height, Window_hWnd, HMENU_ID, hInst, NULL);
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]
X & Y are ints that tell what X & Y positions on the window you want. In this case I used VARS, you could have just used 10,10
Width & Height I think explain themselves. I used VARs, you 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 it, so 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

-
Apr 29th, 2002, 08:29 PM
#5
Thread Starter
Lively Member
do it use windows.h library or a different one because I cant get it to work ?
-
Apr 30th, 2002, 05:33 AM
#6
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.
-
May 2nd, 2002, 12:33 PM
#7
PowerPoster
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|