Click here to Skip to main content
15,914,109 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDirectory Date/Time Pin
Atlence18-Jul-04 4:04
Atlence18-Jul-04 4:04 
GeneralRe: Directory Date/Time Pin
Toni7818-Jul-04 7:32
Toni7818-Jul-04 7:32 
GeneralRe: Directory Date/Time Pin
Atlence18-Jul-04 14:19
Atlence18-Jul-04 14:19 
GeneralRe: Directory Date/Time Pin
Atlence2-Apr-05 12:55
Atlence2-Apr-05 12:55 
GeneralRe: Directory Date/Time Pin
Toni7829-Apr-05 13:30
Toni7829-Apr-05 13:30 
GeneralRe: Directory Date/Time Pin
Toni789-May-05 6:42
Toni789-May-05 6:42 
GeneralDialog Problem Pin
Kunal Shetye18-Jul-04 2:44
Kunal Shetye18-Jul-04 2:44 
GeneralRe: Dialog Problem Pin
Alexander Wiseman18-Jul-04 3:22
Alexander Wiseman18-Jul-04 3:22 
Hello!

The general code for displaying a dialog is as follows: you need to declare a variable whose type is the dialog you want to display. You then need to call the DoModal() function of the dialog. This is assuming that when you clicked 'New Form' in VC++ 6.0 that you left the base class as 'CDialog'. To check your base class open up the .h file of your dialog box (e.g. Dlg2.h) and look at the declaration for the dialog. It should look something like this:

<br />
class CDlg2: public CDialog<br />


If you see 'CDialog' then your dialog's base class is 'CDialog' and you can follow my instructions above. Here is a code sample of what you wanted to do:

<br />
void CDlg1::OnBT1()  //this is the message handler for when the user clicks BT1<br />
{<br />
     //Create a new variable of type CDlg2:<br />
     CDlg2 myDialog;<br />
<br />
     //Show the dialog:<br />
     myDialog.DoModal();<br />
<br />
     //The above function (DoModal) will only return when the user has exited the Dlg2<br />
}<br />
<br />
void CDlg1::OnBT2()  //this is the message handler for when the user clicks BT2<br />
{<br />
     //Create a new variable of type CDlg2:<br />
     CDlg2 myDialog;<br />
<br />
     //Show the dialog:<br />
     myDialog.DoModal();<br />
<br />
     //The above function (DoModal) will only return when the user has exited the Dlg2<br />
}<br />


Hope that helps! If you don't know anything about message handlers or just want to know how to add one, please ask. In the meantime you could take a look at http://www.codeproject.com/dialog/#Beginners[^] for some great articles on getting started with Dialogs.


Sincerely,
Alexander Wiseman

Est melior esse quam videri
It is better to be than to seem
GeneralRe: Dialog Problem Pin
Kunal Shetye18-Jul-04 8:27
Kunal Shetye18-Jul-04 8:27 
GeneralRe: Dialog Problem Pin
Bob Stanneveld18-Jul-04 3:24
Bob Stanneveld18-Jul-04 3:24 
QuestionDevice Contexts usage? Pin
0v3rloader17-Jul-04 23:02
0v3rloader17-Jul-04 23:02 
AnswerRe: Device Contexts usage? Pin
Jörgen Sigvardsson18-Jul-04 0:07
Jörgen Sigvardsson18-Jul-04 0:07 
GeneralRe: Device Contexts usage? Pin
0v3rloader18-Jul-04 0:27
0v3rloader18-Jul-04 0:27 
GeneralRe: Device Contexts usage? Pin
Jörgen Sigvardsson18-Jul-04 0:35
Jörgen Sigvardsson18-Jul-04 0:35 
Generaldata mining Pin
Yulianto.17-Jul-04 22:23
Yulianto.17-Jul-04 22:23 
GeneralShellExecute Question Pin
otrcomm17-Jul-04 21:42
otrcomm17-Jul-04 21:42 
GeneralRe: ShellExecute Question Pin
vcplusplus18-Jul-04 2:26
vcplusplus18-Jul-04 2:26 
GeneralRe: ShellExecute Question Pin
User 665818-Jul-04 7:53
User 665818-Jul-04 7:53 
GeneralRe: ShellExecute Question Pin
otrcomm18-Jul-04 8:32
otrcomm18-Jul-04 8:32 
GeneralSlider Pin
smack_2k217-Jul-04 21:34
smack_2k217-Jul-04 21:34 
Generalhooking text from another app Pin
swiftrhett17-Jul-04 20:54
swiftrhett17-Jul-04 20:54 
GeneralRe: hooking text from another app Pin
Alexander Wiseman18-Jul-04 3:26
Alexander Wiseman18-Jul-04 3:26 
GeneralRe: hooking text from another app Pin
swiftrhett18-Jul-04 22:20
swiftrhett18-Jul-04 22:20 
GeneralRe: hooking text from another app Pin
Alexander Wiseman19-Jul-04 16:21
Alexander Wiseman19-Jul-04 16:21 
GeneralWM_GETTEXT will not work across process boundaries Pin
bikram singh18-Jul-04 3:42
bikram singh18-Jul-04 3:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.