|
Try handling WM_WINDOWPOSCHANGED for your CMyView and launching the wizard the first time it gets called --this might work.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ok, this is what I have come up with in the CMyApp::InitInstance() handler:
[EDIT: typo fixed]
CMyView *pView = (CMyView*)m_pMainWnd->GetActiveWindow();
pView->DoWizard();
DoWizard() is a public member function of the view class that I defined to wrap the protected OnWizard() function.
It works, but is it safe? Is there a better way?
Jon Sagara
What about ?
Best Miniputt score: 21
Sonork ID: 100.9999 jonsagara
|
|
|
|
|
Jon Sagara wrote:
(CMyView*)AfxGetApp()->GetMainWnd();
Oh! I always thought that would return the frame window. Didn't think it returned a pointer to the view.
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Yeah, that may be a problem. Do you know how I can get a pointer to the view object from CMyApp::InitInstance()? That's all that's really holding me back. I don't want to leave my code the way it is because it seems like a big hack.
Jon Sagara
What about ?
Best Miniputt score: 21
Sonork ID: 100.9999 jonsagara
|
|
|
|
|
Jon
I don't think you should even do all this from the CWinApp derived class.
Can you try this. From your CMyView::OnInitialUpdate() post a custom message, say WM_APP+1 to your CMyView. Tehn in the handler for that message, call your function.
This technique is used to hide modal dialogs. Because in the OnInitDialog if we hide the window, it won't be effective as the window is not shown yet. So we post a message and the message handler hides the window.
I didnt try this out and am too lazy to try it out now.
6:32 AM now. I am not in an active condition as you might expect
But please could you try this out and let me know it it did work?
If it does not work, I apologize for the inconvenience caused...
Regards
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Pasted the wrong code.
CMyView *pView = (CMyView*)m_pMainWnd->GetActiveWindow();
pView->DoWizard();
Jon Sagara
What about ?
Best Miniputt score: 21
Sonork ID: 100.9999 jonsagara
|
|
|
|
|
Ah, that's better.
By the way read the other post where I have made a humble suggestion.
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Ah ha! I finally got it... *BUT* what a hack!
From CMyApp::InitInstance():
POSITION pos = pDocTemplate->GetFirstDocPosition();
CMyDoc *pDoc = (CMyDoc*)pDocTemplate->GetNextDoc(pos);
pos = pDoc->GetFirstViewPosition();
CMyView *pView = (CMyView*)pDoc->GetNextView(pos);
pView->DoWizard();
Jon Sagara
What about ?
Best Miniputt score: 21
Sonork ID: 100.9999 jonsagara
|
|
|
|
|
Hate to spoil your fun, Jon, but that's not a hack - that's MDI! I'm working on an app with (wait, I'm just counting) 10 document/view types. I wrote quite a few of those functions before creating one in my app to GetCurrentView(of type)...
Oh yeah, and your code is assuming that there's only one DocTemplate, when you've got ten, you've got another layer to loop through, and error checking... and...
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Hey,
is there an easy way to send midinotes to a soundcard using DirectX? I found a MIDI class on this site but it needs a midifile...
Anyone?
/Vamp
|
|
|
|
|
What is the best way of implementing a CFileDialog with extra buttons and radio boxes without having to build your own tree and listviews?
I was wondering..can you have a CFileDialog member variable in a simple dialog class? One problem I have is that CFileDialog can't be just instantiated and then passed parameters. The whole thing must be done right off the bat.
Anyhow, any ideas? pleas let me know!
thanks
|
|
|
|
|
|
Hi there,
I did the following:
a) I created a dialog class. I added a couple of windows controls and created member variables out of them.
b) I then modified my class to derive off CFiledialog instead. In addition, I added the DECLARE_DYNAMIC(CMyFileDialog) to the beginning of my class declaration and I added the IMPLEMENT_DYNAMIC to the beginning of my class definition.
It appeared that having a CFileDialog::OnInitDialog() would cause an error so I took it out as well.
At the end, I still get the big CFileDialog anytime I call this class and not much more.
The steps I followed sort of match what there is at :
http://msdn.microsoft.com/visualc/productinfo/previous/vc6/tips/default.asp
Any ideas what I may be doing wrong? or is this all you can get?
The only difference I see is that in my constructor I haven't included the following:
m_ofn.Flags |= OFN_ENABLETEMPLATE | OFN_PATHMUSTEXIST |
OFN_FILEMUSTEXIST | OFN_SHAREAWARE | OFN_ALLOWMULTISELECT;
m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_ABOUTBOX1);
|
|
|
|
|
Hello,
I am a newbie and I would like to know how to create folder using C++ for both Linux and Windows platforms. It's like FSO in VB.
I would appreciate anyone's help and opinion.
|
|
|
|
|
I guess some variant of mkdir , which is available in VC++, can also be used in Linux compilers.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Anonymous wrote:
I am a newbie and I would like to know how to create folder using C++ for both Linux and Windows platforms. It's like FSO in VB.
How would you use FSO/VB in Linux???
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
I am developing a web-based application and one of the functionalities is to create folder when a record is inserted into a database succesfully. This application has to be implemented in both Linux and Windows platform.
I know in VB, there is a File System Object that can do what exactly I want to do. But in C++, I do not know how to make that works. If anyone knows, please give me some hints.
Thank you,
Sandy
|
|
|
|
|
I'm afraid there is no way to do it in standard C or C++. I guess you will need to use some OS - specific commands, and guard them with #ifdef
I vote pro drink
|
|
|
|
|
Hey All,
I'd like to send a simple email usin MAPI. I tried using MAPISendMail, but I don't think I got it quite right. Can anyone point me to some sample code of how to send an email msg? Ths should be something that could be called from a batch file (ie no dialog boxes).
Thanks,
Aaron
|
|
|
|
|
There are lots of examples out there. One which seems to get good credit is PJ Naughter's CMapi v1.01 - A MAPI Implementation.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks!
I'll take a look.
|
|
|
|
|
Whenever I call my function GetWindowTitle() I get an error in MFC42D.DLL. Here's the code:
void CView::GetWindowTitle()
{
CWnd* pWindow;
pWindow = GetActiveWindow();
pWindow->GetWindowText( m_strWindowText );
}
where m_strWindowText is a CString member variable.
I use the exact same code in a different function and that works fine. Whats the problem?
-Raffi<marquee behavior="ALTERNATE" width="100">
The truth about C++
|
|
|
|
|
Is pWindow NULL?
Is this NULL?
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Raffi wrote:
The truth about C++
Not the first time the raw truth was disguised as satire to protect the author. Great "joke";)
|
|
|
|
|
Although I could see the attempt at humour, I didn't like it because all of it's premises are wrong. For something to be funny, it usually needs a grain of truth and every criticism I saw of C++ in the article was plain wrong.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|