Hi,

Here is the ( .rc) file .And i know that the pushbutton is not correct .

MENU_ID MENU 
BEGIN      
POPUP  "&File"
             {
             MENUITEM  "E&xit", EXIT_ID
             }
         
    
POPUP "&Help"
                       {
                       MENUITEM  "H&elp About", HELP_ID
                       }
                       BEGIN
                       PUSHBUTTON "1",ID_1,30,30,10,10
                       END
                       
END

so i want to make a pushbutton in window
What i need to write in ( .rc) file to have a correct Pushbutton?
I do not want a dialog box or anything similarly.
Thank you for your effort of reading.

Recommended Answers

All 10 Replies

From what I see, you are trying to create the pushbutton inside a menu. Is that what you are trying to do? If so, I don't think you can do that.

In any case, there is nothing wrong with the pushbutton line.

I writing a WIN32 API and i can't create Pushbutton with that code above.

I am trying to make a copy of Calculator in XP.
So i need push buttons in my parent window and not in my menu .I typed that above just for experiment .

The code you posted won't (and can't) work. You need to put buttons on another window -- normally on dialog box but they can also be put on standard windows or toolbars. Here is a thread that may help you.

Here is the minimal code for a dialog box with a single push button. When experimenting it is always best to experiment with the least possible code.

#include <windows.h>
#define ID_1 4001

IDD_DIALOG1 DIALOGEX 0, 0, 206, 126
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION |
    WS_SYSMENU
CAPTION "calc"
FONT 8, "MS Sans Serif"
BEGIN
	PUSHBUTTON "1",ID_1,30,30,10,10
END

Add the menus after getting a window with a single button, or a windows without any buttons to execute.

That is not helping me WolfPack because i want to make a button in the main window.
But thank you for trying .

Thank you all for your effort i got it .
I need to create window like this.

first in the in the hwnd i need to add

HWND hwnd,button;

and then i create a window

button = CreateWindow(
           "BUTTON", /* this makes a "button" */
           "Class Options", /* this is the text which will appear in the button */
           WS_VISIBLE | WS_CHILD,
           5, /* these four lines are the position and dimensions of the button */
           60,
           105,
           20,
           hWnd, /* this is the buttons parent window */
           NULL, 
           NULL,
           NULL);

I put these three NULL because i do not know what mean

(HMENU)IDB_CLASS_OPTIONS, /* these next two lines pretty much tell windows what to do when the button is pressed */
(HINSTANCE)GetWindowLong(insert, GWL_HINSTANCE),

>>I put these three NULL because i do not know what mean
Try looking it up in MSDN and it will tell you what each of them mean.

Yes it helps a little bit (It is really heavy to learn from MSDN for me), but any other information would be very useful .
And by the way i have to put another
control called EditText /* ( .rc) */ in the main Window.
Thank you for your effort.

>>It is really heavy to learn from MSDN for me
You're not alone, most programmers have that same feeling. That's why there are so many books on it. Just search amazon.com for win32 api books or read this thread. Yes books aren't cheap but if you are serious about programming then they are indespensible.

For me it is not reach for right now . :(
Then i am looking for free books(last my option is MSDN).

Thank you for your effort of reading and replying.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.