Help with the butten!!!

Mar 22, 2011 at 12:05am
I need to know hot to make a butten in a win32 program.
Dot you have eny ideas?

thanks for replys!
Last edited on Mar 22, 2011 at 12:40am
Mar 22, 2011 at 12:12am
I've got this idea where we would selectively breed dogs with the smallest legs, then the ones with the smallest legs of their litter, and so on and son on over a very long period of time, and in the end we would have a sort of worm-like dog creature.
Mar 22, 2011 at 12:31am
im toking obout a buton not dogs!
Last edited on Mar 22, 2011 at 12:31am
Mar 22, 2011 at 12:34am
I love that "Reported" button.
Mar 22, 2011 at 12:38am
you know that I,m tolking About a button in a win32 program!!!
Mar 22, 2011 at 12:38am
I only just noticed it's quite a snazzy feature isn't it.

Hi ty98 I can't help but you might have more luck getting an answer for this is you post it in the Windows Programming section.
Mar 22, 2011 at 12:41am
fixed it!
what wer you tolking obout with the dogs and stuf?
Mar 22, 2011 at 12:47am
1
2
3
4
5
6
7
HWND hButton = CreateWindow ("button", "This is a button", WS_CHILD | WS_VISIBLE, 5, 5, 130, 20, hParent, (HMENU) hmControlID, GetModuleHandle (NULL), NULL);
if (!hButton)
{
MessageBox (hParent, "Button creation has failed!", "Error!", MB_OK | MB_ICONWARNING);
PostQuitMessage (0);
}
ShowWindow (hButton, SW_SHOW);


See http://www.winprog.org/tutorial/controls.html
Last edited on Mar 22, 2011 at 12:49am
Mar 22, 2011 at 1:10am
is there eny thing els that i need to do in order to get this right?
Last edited on Mar 22, 2011 at 1:18am
Mar 22, 2011 at 1:20am
ok I tryed that it dose not werk.
can you give me a project using that?
Mar 22, 2011 at 2:52am
That will work. You just need to search how it works and not just copy and paste it in and compile it.

You most likely got errors on no hParent variable, and no hmControlID variable.

hParent is a window handle to the parent window.

hmControlID will be an integer that will represent this button. If we click the button it will fill the MSG structure with:

MSG.message = WM_COMMAND
MSG.wParam = hmControlID

That way we can handle the button clicks in a WM_COMMAND case statement.

I HIGHLY suggest reading the Win32 tutorials in this thread: http://cplusplus.com/forum/beginner/38982/

It will teach you everything you will want to know about the Win32 API.
Mar 22, 2011 at 2:56am
Here's something you can copy and paste. http://zetcode.com/tutorials/winapi/controls/
Mar 22, 2011 at 3:43am
Copying and pasting example code is good because it is faster, but I don't suggest it because the bad outweighs the good; If you copy and paste it then you don't remember it as well as if you typed it out. Every time I've copy and pasted code I found myself going back and having to type it out relearning the code.

So in my opinion, I highly suggest not copying and pasting code.
Mar 22, 2011 at 7:45pm
that is what i did. I typed it but it did not werk!
Mar 22, 2011 at 8:32pm
+1 quirkyusername while unrelated to this topic, that is one of the funniest things I have ever read :P
Topic archived. No new replies allowed.