|
Hi, I just made a program and I put a button in the dialog and called it IDAbout I need to get it so that when this button is clicked it open up another Dialog that I have made called IDD_ABOUTBOX. Can any body please help me write a code for the button so that it opens up the about box?
I am using MFC Dialog based project.
Thanks in advance.
|
|
|
|
|
Have you created a class for the IDD_ABOUTBOX dialog?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Ok, have you used ClassWizard to create a handler function for the clicking of the button?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yes I have. Ijust dont know the script to put into:
void CMizfarsProgramstringtestingDlg::OnAbout()
{
// I need the code to put here to get it to open IDD_ABOUTBOX
}
To link it to the About Box.
Thanks
|
|
|
|
|
Construct an instance of the second dialog and call its DoModal() method.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
can you dum it down a bit please. I am only starting out with programming so i dont know much. Please can you explain it as if you were explaining to layman.
|
|
|
|
|
Buyer1 wrote:
can you dum it down a bit please.
I much prefer the phrase "less experienced."
Not knowing what name you gave your dialog class, I can only give you an approximation.
void CMizfarsProgramstringtestingDlg::OnAbout()
{
CMyOtherDlg dlg;
dlg.DoModal();
}
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
First i am sorry about that phrase.
Secondly:
I tried what you told me, but i keep getting this error when i compile:
midl : command line error MIDL1001 : cannot open input file Program.
I dont know what it means.
I put this code in:
CAboutDlg dlg;
dlg.DoModal();
|
|
|
|
|
Buyer1 wrote:
Secondly:
I tried what you told me, but i keep getting this error when i compile:
midl : command line error MIDL1001 : cannot open input file Program.
Are you doing something with COM? Using AppWizard, what type of application did you opt for, and what other options did you select?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Wait that was something else.
Sorry about that.
I got it working how you told me.
Thank you so very much!!!
|
|
|
|
|
Hi Community,
I want to extend the detail view of the explorer shell to handle video summary information for mp4 files in the summary tab of the advanced property page under XP on an NTFS file system.
This behavior is already included for mp3 and avi files, although mp3 and avi aren't compounded documents. So therefor, I must implement the IPropertySetStorage interface. What do I have to do to implement that interface? Is there an example somewhere?
It is important to me, that the metadata is not stored in an additional NTFS
stream, but inside the mp4 file itself. So I have to handle this by my
own shell extension code. But how, where, when ...
Thanks in advanced,
David
|
|
|
|
|
I have added a define in my Visual Studio .Net configuration. However my #ifdef's do not see the define. Anyone knows how this can be?
|
|
|
|
|
Hi,
I have a CDateTimeCtrl which I am growing in size when the focus is set and shrinking back to its normal size when focus is killed.
at the moment the only way I can get the control to lose focus is to set the focus onto another control.
Ideally when the user clicks anywhere outside of the control the focus should be lost and the CDateTimeCtrl shrink back to its normal size, but I can't see how to capture a mouse click on a CDateTimeCtrl.
The ComboBox control obvioulsy does something similar but can I do it with my CDateTimeCtrl?
Many Thanks
|
|
|
|
|
you could handle the WM_KILLFOCUS message for your control.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
error C2079: 'm_RealTime' uses undefined class 'CRealTime'
What is this error?
CRealTime is a modless dialog I use from a diffrent dialog and I have not seen this error before. It have work OK but now it happens is there anyone that now what it is?
|
|
|
|
|
if CRealTime is declared in the calling class's header file, you'll need to make a forward class declaration so that the compiler knows that it's a class when it compiles the header. Here's an example:
class CRealTime;
class CCallingClass : public CSomeClass
{
CRealTime m_RealTime;
};
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
My articles[^]
bdiamond
|
|
|
|
|
I am trying to do some data validation on a dialog application and present the user with a message box when the user tries to input invalid data. The test work but when it gets to the point that it is supposed to display a message box, the dialog application greys out as if it no longer has the focus, but no message box is shown and the application hangs. At this point, I have to do the control alt delete to get it to close. Help! Oh this is with Visual C++.net.
Thanks for any help!
Chris
|
|
|
|
|
when should it get called? How do you do it? How and when do you the validating?
this will help all the ones trying the answer your answer .
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
The validation is occurring when a user pushes a button on the dialog. The validation is on an edit control. See below.
int Pos;
int NumChars;
BOOL RtnVal=TRUE;
CString strEditText;
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
pEdit->GetWindowText(strEditText);
NumChars = strEditText.GetLength();
for(Pos = 0; Pos < NumChars; Pos ++)
{
if(!isdigit(strEditText[Pos])&&(strEditText[Pos]!='-')&&(strEditText[Pos]!='.')
{
RtnVal = FALSE;
}
}
if(RtnVal==FALSE)
{
MessageBox("One or more of the values you typed are not numeric!", "Error", MB_ICONERROR | MB_OK);
}
Hopefully this will help you help me!
Thanks for any help!
Chris
|
|
|
|
|
First it looks as though your missing a ')' at the end of your if statement.
Programmer_Chris wrote:
if(!isdigit(strEditText[Pos])&&(strEditText[Pos]!='-')&&(strEditText[Pos]!='.')
Second why don;t you do this
Programmer_Chris wrote:
if(!isdigit(strEditText[Pos])&&(strEditText[Pos]!='-')&&(strEditText[Pos]!='.'))
{
MessageBox("One or more of the values you typed are not numeric!", "Error", MB_ICONERROR | MB_OK);
}
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Programmer_Chris wrote:
MessageBox("One or more of the values you typed are not numeric!", "Error", MB_ICONERROR | MB_OK);
Is the message box actually displayed? Unless you are using ATL, or you have your own flavor of MessageBox() , shouldn't there be four parameters with the first one being the handle to the owner window?
While not related to the problem, I would suggest terminating the for loop once an invalid character is found.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
I have placed a Check Box on 1st property page.
The propertysheet containing this property page is on the form view of my MDI MFC Appwizaerd
Application.
I have placed a push button on form view of the application.
In its(push buton's) member function, named OnPress, I want to fetch the value of the checkbox
of that propertypage.
ID of Check Box is IDC_CHECK_SUBFOLDER
If I place the code as follows in OnPress member function, I get an access violation error when
I run it.
(((CButton *)GetDlgItem(IDC_CHECK_SUBFOLDER))->GetCheck() == 1);
Please Help me to fetch the value.
Drushti
|
|
|
|
|
missnazar wrote:
(((CButton *)GetDlgItem(IDC_CHECK_SUBFOLDER))->GetCheck() == 1);
It's never a good idea to use hard-coded values like this. Compare against BST_CHECKED instead. That's not the cause of the access violation, however.
Rather than lump all that into one convoluted statement that makes debugging rather difficult, how about breaking it up into something like:
CButton *pButton = (CButton *) GetDlgItem(IDC_CHECK_SUBFOLDER);
if (NULL != pButton)
{
if (pButton->GetCheck() == BST_CHECKED)
;
} Now you can get a better idea as to where it's failing.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
DavidCrow wrote:
Rather than lump all that into one convoluted statement that makes debugging rather difficult, how about breaking it up into something like:
Once the problem is fixed, would you put the code back to a single line? Whilst it is not as 'nice' to read I imagine it would execute quicker, not that the difference in speed will amount to much anyway. I just wondered what other people thought - more convulated, easier to read/maintain code, or 'many commands nested on one line'.
Cheers
Angel
***********************************************************
The sooner you fall behind, the longer you have to catch up
|
|
|
|