Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

LowRad

Dialog, Classes, not using MFC

This topic is 6531 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I would like to known if it''s possible to declare a class for a DialogBox. I want to have, all initialisation code, DialogProc, and all of the controls, options of this dialogbox in this class. How i do it ?! Something like : class ConfigDialog { public: ConfigDialog (); //Where i want to call the Dialog, show it !! ~ConfigDialog (); //Kill the class //Some in/out, to retrieve value from the DialogBoxes private: DialogProc; // Control the behavior of the dialog // Some bool, and value of the Control in the DialogBox } This is the way i would like it to look like !! But i dunno if it''s possible ?! And, i''m not using MFC !! Thanks, LowRad

Share this post


Link to post
Share on other sites
Advertisement
May I ask why you want to create a class?
I think in the end, you''ll be overriding the DialogProc, and you still have the same, plus an extra class...why do you wanno do that?

But if you really want to make it OO, you can The above looks good.
Best to look out with the DialogProc. This one won''t mix easily with OO.

Share this post


Link to post
Share on other sites
OK,


So can you tell me how can i work with a DialogBox, with all those buttons on it, special button, special effects on the DialogBox !!


PLz tell me it''s will help me.

And Dont forget, i dont want to include MFC in my 3D Engine !!! (i let you think of the why of this !!)

Happy Coding ...

LowRad

Share this post


Link to post
Share on other sites
    
//---------------------------------------------------------------------------

BOOL CALLBACK DlgProcAbout(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{ case WM_INITDIALOG:
{
return TRUE;
}
case WM_COMMAND:
switch(LOWORD(wParam)) //HIWORD(wParam)==BN_CLICKED
{ case IDOK:
case IDCANCEL:
EndDialog(hDlg, 0);
return TRUE;
}
break;
}
return FALSE;
}
//---------------------------------------------------------------------------



case WM_COMMAND:
switch(LOWORD(wParam))
{ case ID_HELP_ABOUT:
DialogBox((HINSTANCE)GetWindowLong(hWnd,GWL_HINSTANCE), MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC)DlgProcAbout);
return 0;
}


Make sure you''ve created a dialog resource and named it IDD_ABOUT.

You can these functions to change controls in DialogBoxes:
- GetDlgCtrlID()
- Set/GetDlgItemInt();
- Set/GetDlgItemText();
- CheckDlgButton();
- ...etc...etc...

Get yourself a copy of Win32 help files and lookup "Dialog Boxes".

Share this post


Link to post
Share on other sites
Weird, I just gave this information to a guy who probably didn''t want it.
Anyway, you can use Dialog Templates to create a dialog box on the fly, set all the controls the way you want them at run time, whatever. It''s sort of a pain. However, you''re still going to need a dialog proc to run it as listed in one of the above posts. If it''s just the appearance of the box you want to control, that will do it - else I''m not sure what you''re looking for.
I just went and checked - dlgtemplate is what I''m talking about - ''dialog template'' is used a little differently. The help for it is in the platform sdk. If you don''t have that you can probably find it on Microsoft''s site.

information is the illusion of knowledge

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!