|
I tried, but it didn't help. Maybe I didn't do it right. Anyway, what I did was in the event handler function, I had the following code:
c_MyDialog.SetParent((HWND)*AfxGetMainWnd());
c_MyDialog.DoModal();
Note: AfxMessageBox() doesn't function either.
|
|
|
|
|
Properysheet is not your mainwindow... so passing that is not rite...
try putting "this" in place of AfxGetMainWnd()
God is Real, unless declared Integer.
|
|
|
|
|
In my program, the pushbutton I want to use to bring a modal dialog box is on the property page not on the property sheet, "this" will be a pointer to the propertypage not the property sheet. I know I can do this->GetParent() which will return a pointer to the propertysheet, but there is another problem. When I do the following:
MySubWindow.SetParent(this->GetParent());
MySubWindow.doModal();
I get an access violation writing location 0x00434cc4 at MySubWindow.SetParent().
What is the right way of specifying the parent window of MySubWindow class?
|
|
|
|
|
kimiko wrote:
MySubWindow.SetParent(this->GetParent());
MySubWindow.doModal();
yes this will not work, as the window has not been created yet when you called SetParent so its giveing the exception.
pass the parent to the modal dialog box in the constructor.
God is Real, unless declared Integer.
|
|
|
|
|
I realized that later and tried what you suggested but still the parent window was not set to CMySheet. Here is that I did,
In MyPage.h:
protected CMySubWindow * pMySubwindow;
In MyPage::OnInitDialgo():
pMySubWindow = new CMySubWindow(this->GetParent());
(I still get the access violation writing location 0x00434cc4 in my output window after this line of code is executed, and there were two of this message. access violation for writing to 0x00434cc4 and 0x0000010)
In MyPage::OnBnClickedButton1():
pMySubWindow->DoModal();
What did I do wrong?
|
|
|
|
|
kimiko wrote:
pMySubWindow = new CMySubWindow(this->GetParent());
is this line executed after call to the baseclass OnInitDialog() ???
that line will raise an exception because window for "this" has not been created yet,thats what i could image from the error you are getting.
God is Real, unless declared Integer.
|
|
|
|
|
Yes. The line is executed after CPropertyPage::OnInitDialog().
|
|
|
|
|
You said that you get those messages in the output window. But is the application working as expected ???
Those message could be from the debug libraries, I ignore them most of the time.
God is Real, unless declared Integer.
|
|
|
|
|
Hi,
One can use "select * from tab" query to get table names in Oracle, but how can we get table names in MS Access.
|
|
|
|
|
Chauhan Chirag wrote:
how can we get table names in MS Access
There are probably several ways. One way using DAO is:
Open the database
Get the table count
Loop through all of the tables
CDaoTableDefInfo info;
db.GetTableDefInfo(i, info);
info.m_strName = Tablename
Close the database
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
Hello,
I dove into Windows programming about 6 months ago. So far I have only been working with Win32, but I am ready to give MFC a try. For now, I just want to do simple things like the general hello sample. For example, I am looking to create a simple GUI interface that would launch another application with some command line parameters at the press of a button. Also, maybe have a cool bitmap as well.
Can anyone point me to some good samples? Also, are there any must have books in MFC?
Thank You
|
|
|
|
|
Iceberg76 wrote:
For example, I am looking to create a simple GUI interface that would launch another application with some command line parameters at the press of a button
Look for CreateProcess() and ShellExecute() . These two functions are not related to MFC, however.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thanks,
Just one more question...
How do I create an empty project for a MFC application. For example if I use Visual C++ 7.0 to use the MFC wizard, I don't see an empty project option. The general hello world app looks much more simple, but what do I do if I want to start from scratch and make my own general hello world? I start out with way more files using the Wiz.
Thanks
|
|
|
|
|
I'm not sure of the project types that v7 offers, but with v6, you can create a console application that supports MFC. The resulting project contains two .cpp and two .h files. That's about as small as it gets. With a dialog-based project, you'll get three of each, plus a res folder.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Clickety[^]
God is Real, unless declared Integer.
|
|
|
|
|
Thanks,
Nice online samples!
Just one more question...
How do I create an empty project for a MFC application. For example if I use Visual C++ 7.0 to use the MFC wizard, I don't see an empty project option. The general hello world app looks much more simple, but what do I do if I want to start from scratch and make my own general hello world? I start out with way more files using the Wiz.
Thanks
|
|
|
|
|
File|New -> project tab -> MFC Application icon
then, follow the instructor...
TOXCCT >>> GEII power
|
|
|
|
|
Oh, sorry!
I found the properties tab to enable a normal empty win32 into an MFC application.
|
|
|
|
|
The problem is that, quite simply, you can create a Win32 app that links to MFC, which you may decide to do in order to get to CString or something, but an MFC GUI application really needs all those classes that the wizard is creating for you. The simplest thing is a dialog based app, which does not use Doc/View.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Is there any way to use the standard Windows OEM icons in a Dialog Template resource?
I'm using VC++6.0. When I add an Icon to a dialog, the dialog editor wants a path name to .ico file. I'd want to use the built in IDI_EXCLAMATION here (it's an alert dialog), rather than supply my own .ico file.
You can load this icon by doing ::LoadIcon(0, IDI_EXCLAMATION), but there doesn't seem to be anyway to do this with the resource editor.
|
|
|
|
|
Why do you need that icon resource in the resource editor? Wherever it is that you are going to display that icon, just call LoadIcon() as you have indicated.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi guys
Somebody can recommend me a good commercial Graphics Library in C++ useful to reduce problems about run out GDI graphics in W98.
My app has a lot of graphics and in w98 I run out them.
The comercial graphical Libraries reduce this problem?
There is some in the market that do a lot of things?
Best Regards
Doc
|
|
|
|
|
Are you saying that GDI+ is not an option?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I'm not programming in .net , is this a problem?
Best Regards
Doc
|
|
|
|
|
First of all, you can use GDI+ without using .NET, you can use it in C++ so long as you are using VC++7, or you have a recent SDK installed.
Secondly, if you're running out of graphics resources, no library will help you. The problem is almost certainly that you're leaking resources in your code, and the best a library can do is automatically handle ( and then clean up ) the errors that you have been making. That is to say, it may solve the problem, but it would be better for you to work out what is causing it instead.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|