|
hi...i have a question..
i am using SDI Doc/View arch.
now i dialog that comes up before anything else appears on the screen..
now if the user presses cancel on this dialog..the open file dialog should apprear...
this open dialog is the same on that MFC already gives uswhen we create the SDI proj using AppWizard..
now how can i make this happen???
somethin like making the File->Open menu click through the codes??so that it will open up the Open File Dialog???
i dont really know what am i supposed to do...
hope you can help...
tks a lot...
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
In the app have you placed your dialog and calls before the call to the sdi mainframe?
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
huh???
i dont get it....
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
What don't you get?
In the App like CMyProjectApp
Did you place the dialog there or in the Frame?
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
HUH?????????
what dialog?????
there is no dialog......
the question is can i CALL the dilog that comes up when we click : File->Open from the menu that is already given in SDI app by MFC...
that very same open dialog which is made by MFC AppWiard and put inSDI app's menu...
can i call it from my program WITHOUT actually clicking : File->Open
can i call the menu itself from my program without clicking it??
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
Sure you can!
First allow me to say it is a good question, I just did not understand what you wanted. Most of the guys on this site are pro's and have been programming for years, so we sort of understand what we are talking about, and use the ART of the language itself to communicate. This can lead to problems.
Now:
If you look at your IDR_MAINFRAME-> FILE OPEN property you will see the resource ID -> ID_FILE_OPEN right?
Just for fun let's go to the toolbar and create a new button
and select the properties for the new button ID_FILE_OPEN
compile the project and run it.
see the new button calls File open right?
So how does it do it is your question and can I make the call directly, right?
Yes you can
In the app under initistance
enter this at the bottom ject before retrun TRUE;
OpenMyFile();
Now in the app create a new member function
void CMyCoolApp::OpenMyFile()
Enter this code inside your new function.
{
OnFileOpen();
}
It should look like this now.
void CMyCoolApp::OpenMyFile()
{
OnFileOpen();
}
There you go!
Best Wishes and Happy Holiday's,
ez_way
I received your private message and here is a response to it!
HUH?????????
what dialog?????
there is no dialog......
>> The file open box is a dialog!
the question is can i CALL the dilog that comes up when we click : File->Open from the menu that is already given in SDI app by MFC...
>> Yes I told you how above!
that very same open dialog which is made by MFC AppWiard and put inSDI app's menu...
>> I understand
can i call it from my program WITHOUT actually clicking : File->Open
can i call the menu itself from my program without clicking it??
>> Yes!
|
|
|
|
|
How I click the button and then it will open the program @ file. Example: Window Explorer, Microsoft Work....
|
|
|
|
|
Best Friend wrote:
button
What button? Your button, my button, everyone's button?
Best Friend wrote:
program @ file
What's program @ file? Is this a new computer term I've yet to grasp?
---
Your question is not quite coherent, my Best Friend, but are you by any chance
talking about using the ::ShellExecute() API to launch the windows program associated with the given filename?
If so then your question has been answered.
I Dream of Absolute Zero
|
|
|
|
|
Hi guys,
I have just learned how to create a dialog-based application with mutiple child dialogs. So far it works fine, however, in Debug window, I always received memory leak warning upon the app exit :
Detected memory leaks!
Dumping objects ->
childdlg.cpp ........
I am just wondering what could cause this?
Basically, say, I have a parent dialog class, say CMyDlg and a child dialog class called CChildDlg. The child class was included on the top of MyDlg.cpp file
#include <ChildDlg.h>
CChildDlg *vChildDlg;
I embedded the child dialog into parent by putting the following codes in OnInitDialog() of the parent's cpp file, MyDlg.cpp.
vChildDlg = CChildDlg();
vChildDlg->Create(IDD_CHILD_DIALOG, this);
vChildDlg->SetWindowPos(this, 20, 20, 50, 50);
vChildDlg->ShowWindow(SW_SHOW);
That looks pretty straight forward. But why on the app's exit, it causes memory leak? Is there something I need to do perhaps in the parent and child class' destructor?
Thanks
|
|
|
|
|
the line
vChildDlg = CChildDlg();
creates an instance of CChildDlg.
You need to delete this instance of vChildDlg when the app exits.
|
|
|
|
|
Thank you guys.
I realise I originally placed "delete vChildDlg" in the parent's destructor, which however, was never called. Because the program exit with exit() associated to the exit button in the child dialog.
|
|
|
|
|
Don't you use new without delete ?
"Gods die, when their believers are gone." --from Sandman by Neil Gaiman
|
|
|
|
|
hi,
i want to know how to get the message after window has been shown. i have checked out with OnShowWindow, WindowPosChanged ... seems that all can report me the Window is about to be shown. that's not ok... as i want to do sth after the window already being seen by the user.
any help?
thanks,
jim
|
|
|
|
|
OnDestroy()
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
hi..
void CEditorView::OnInitialUpdate()<br />
{<br />
CScrollView::OnInitialUpdate();<br />
<br />
SetScrollSizes(MM_LOENGLISH, CSize(2020, 1020));<br />
}<br />
in the above code..i wanna know when i set the mapping mode to MM_LOENGLISH, the param that i supply...are they depicted in mapping mode as i entered??or are they changed to mapping mode params and then entered??
for eg..above is the mapping mode taken in, is it exacly 2020 and 1020 in MM_LOENGLISH???
or is it converted to LOENGLISH and the value has changed to LOENGLISH and is no longer 2020 by 1020???
i gues its a more of my understanding prob...can someone pls help???tks....
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
hi...i am facing a small prob..
void CEditorView::OnDraw(CDC* pDC)<br />
{<br />
CEditorDoc* pDoc = GetDocument();<br />
ASSERT_VALID(pDoc);<br />
<br />
pDC->SetMapMode(MM_LOENGLISH);<br />
<br />
CPoint pos;<br />
pos.x = pDoc->GetGridWidth()*100;<br />
pos.y = pDoc->GetGridHeight();<br />
pDC->DPtoLP(&pos);<br />
<br />
CRect rect(10, -10, 2000, -1000);<br />
pDC->Rectangle(rect);
when i do this
CRect rect(10, -10, pos.x, pos.y);
the rectangle that is drawn isboundless...i.e no mater how long i put the scroll bars..i still cant see the end of therect..wherea as if i do this
CRect rect(10, -10, 2000, 1000);
i can see the rectangle...
why is that???why cant i see the rect when iuse the first method??
tks for any help...
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
Hi, all
I want to make wrapper member function
like this,
class A
{
int Xsprintf (char * pszDest,const char * pszFormat, ...)
{
// this might not right, but I want like this...
sprintf( pszDest, pszFormat, ... );
}
};
How do I can this?
thanks!
|
|
|
|
|
Only way to avoid using va-arg, is to avoid variable number of arguments.
If you have some specific setups, you could say
XSprintf(char * output, char * format, int I1, int I2){
sprintf(output, format, I1, I2);
}
and
XSprintf(char * output, char * format, int I1, int I2, int I3){
sprintf(output, format, I1, I2, I3);
}
but this is not very flexible. For every kind of argument, you need new Xsprintf definition. May be good enough, tho.
|
|
|
|
|
Create an ovcerload for sprintf in your project.
In stdio.h sprintf has only one prototype so
int CYourAppSDI::sprintf(CString str)
{
}
would work or
int CYourAppSDI::sprintf(int nVar)
{
}
would work or
int CYourAppSDI::sprintf(CString str,int nVar)
{
}
would work right?
Now their are some good replacements for sprintf on this site and others.
So all you have to do is write or copy the code inside your overload.
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
This was talked about (unsuccessfully) here.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Review your design constraints. By excluding the use of va_arg, you are making the problem very hard if not impossible (excluding the use of hacks and kludges).
Don't shoot yourself in the foot by using silly design constraints.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi All,
Does anyone know why I would get a first chance exception occur when I try to get the current Username in a COM object I have? the error message is as follows:
First-chance exception in app.exe (SECUR32.DLL): 0xC0000005: Access Violation.
The program 'C:\app.exe' has exited with code 0 (0x0).
when all I am trying to do is
LPTSTR username;
DWORD cchBuff = 1024;
BOOL result = GetUserName(username, &cchBuff);
thanks for your help
cheers
Bryce
|
|
|
|
|
|
Hi Michael,
Thanks, you are indeed correct.
below is what is needed to be done:
<br />
LPTSTR username;<br />
DWORD cchBuff = 1024;<br />
TCHAR tchBuffer[1024]; <br />
<br />
username = tchBuffer;
BOOL result = GetUserName(username, &cchBuff);<br />
cheers
Bryce
|
|
|
|
|
#define MAX_LEN 255
CString str;
char ch[MAX_LEN];
DWORD dwNameSize = MAX_LEN;
GetUserName(ch, &dwNameSize);
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|