|
Hi everybody,
when my doc/view app starts, the Framework does a call to OnNewDocument if no document is specified on the commandline. I would like to change this. What I'd like to do is to open a document.
For this purpose I've created a dialog similar to the dialog that pops up if you start Visual Basic (provided you use the default config). The user can choose whether to open a recently used file, browse for a file or create a new file. How do I get started with this one?
Any help is greatly appreceated.
Matthias
|
|
|
|
|
If mean you don't want the default document to load on startup, then this is the code:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
Add it in the InitInstance() of your apps class, and then make your selection dialog load and prompt user to select whatever they wanted!
"Socrates is a man. All men are mortal.
Therefore Socrates is mortal."
-- Aristotle (syllogism)
Cheers
Masoud Samimi Go!
|
|
|
|
|
I made a dialog, and turned border: None
but i want to move the dialog when holding on the dialog
like RGN generator example and the MP3 decoder: http://www.codeproject.com/dialog/skinsyse.asp
I looked over and over again but i couldt find anywhere how to do this, hope you know what i mean.
Wow i hope this task isnt that hard for a begginer MFC programmer.
Thanks
|
|
|
|
|
You need to capture the point where the user clicks over the area you want to use to move ( ie in onLButtonDown ), then compare it to the mouse position in OnLButtonUp and call SetWindowPos ( I say this instead of MoveWindow because if you pass SWP_NOSIZE you don't need to know the dimensions of your window ) using the difference. I don't recall off hand if you get a point when you click ( you should ) but if you don't use GetCursorPos to find it out.
|
|
|
|
|
Add a WM_LBUTTONDOWN handler for your dialog:
void CMyDialog::OnLButtonDown ( UINT uFlags, CPoint point )
{
CDialog::OnNcLButtonDown( HTCAPTION, point );
}
This tricks the dialog into thinking the button was clicked in the caption (even though there isn't a caption!)
--Mike--
http://home.inreach.com/mdunn/
Is history an illusion caused by the passage of time, or is time an illusion caused by the passage of history?
|
|
|
|
|
What do i need to do with the: WM_LBUTTONDOWN
I got all the code typed in, but i cant figure out what to do with the WM_LBUTTONDOWN
where do i need to put it in the code and how??
What is a handler anyway??
thanks...
|
|
|
|
|
Umm.. I think you need to step back and do some tutorials on basic MFC before attempting things more sophisticated. The Scribble tutorial is always a good start.
If you dont this already, you would know the answers to the questions you are asking.
|
|
|
|
|
i've written a program which takes a command line. now i need to write a program that can send a command line to the program i've already written.
my original program will take a command line from the 'Run' dialog on the Start menu, but not from my program. i'm currently using WinExec, which is supposedly out of date.
does anyone know how send a command line from a program as if it was sent from the run dialog box?
mrtoast
|
|
|
|
|
I think you want to look at the CreateProcess API.
|
|
|
|
|
Um. Thanks.
I tried to use CreateProcess, and came up with exactly the same problems as i did the WinExec, which is no surprise as WinExec just calls CreateProcess.
I think that the child process is inheriting the environment from the parent process. is there any way that i can actually trigger the child process independently, just as if i had run it from the command line, or the Start Menu->Run window?
I'm not quite sure whats going on but maybe
a) windows isn't letting my child process access any file it likes for some reason
or maybe
b) windows is giving my child process next to no memory
thanks for helping,
mrtoast
|
|
|
|
|
personally, i always use _spawnl and friends. i suppose they all end up calling the same thing at some point but who knows...
-c
|
|
|
|
|
Not sure exactly what you need, but one thing you can try is invoking CreateProcess with NULL as the appname, and a command line that first invokes cmd (or command) and passes it the name of the program you want to invoke.
This should get you a new console which loads its own environment vars. Use the /k switch - "command /k myprog.exe" - if you want the command window to hang around after myprog exits, or /c if you don't.
Only bother with this approach is you need to know if the OS is using cmd.exe or command.com.
|
|
|
|
|
We know there're some labels, buttons, text boxs, ...etc...
But how can we know the ids and types (it's a list view or list ctrl ?) of them.
(MSDN library tell us some of them but not all... (nothing about 'desktop' button, 'create new folder' button)
|
|
|
|
|
Look at dlgs.h to see the ids used, then it's trial and error to figure them all out.
|
|
|
|
|
Spy++ would help you figure these out. The buttons at the top right of the dialog are actually a toolbar, and thus don't have individual IDs.
|
|
|
|
|
i want to make a app where i can put a number in a edit box and save it to a file.
then load it again from the file?? sounds easy just need som help
thank you
|
|
|
|
|
why ? just one number, I'd use the registry. One number lots of different ways, use CFile or Serialisation. Plenty of examples on the site. I'd offer one, but I'm holding a baby....
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
.. I'd use the registry
Why? The registry is already filled with unnecessary crap The bigger the registry, the slower Windows. I see a lot of applications do this. The application I'm currently working on, saves as little as possible in the registry. Ofcourse, you should write something there, but try to keep it as low and small as possible.
Your second suggestion seems very good to me. Use a CFile (CArchive) combined with Serialisation sounds really good, although it's a little overkill for one value.
I think CStdioFile is a good option here, as well as writing those values in a .ini file. See GetPrivateProfileString/GetPrivateProfileInt and WritePrivateProfileString/GetPrivateProfileInt.
Goodluck!
--
Alex Marbus
|
|
|
|
|
It depends. The only reason I could think to save *one* number is in order to remember a setting, like what mode the program is in. The registry is the 'correct' place to store such information.
It *IS* overkill to serialise one value. But I am guessing a likely reason for the project being asked about is to learn how it is done, hence I tried to point out some methods that would be useful for the sake of learning and not just the example. CStdioFile is another good suggestion here.
As for an .ini file, all the entries in the MSDN state clearly that these functions remain for reverse compatibilty only. .ini files are bare to even the most inexperienced user ,and basically suck. Just my opinion.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
The only reason I could think to save *one* number is in order to remember a setting, like what mode the program is in. The registry is the 'correct' place to store such information.
You are absolutely right, remembering a setting is a correct thing to do in the registry. From what I've understood from the original message, it's 'just a value', like an age or something.
As for an .ini file, all the entries in the MSDN state clearly that these functions remain for reverse compatibilty only
Oops, you're right Must have missed that one. Thanks for pointing me to that small, single line in the MSDN library Actually too bad the MSDN library only talks about other registry-related functions in this topic, and doesn't have a link to CFile, or just a general information-page that tells a littl' something about saving to memory, file and/or registry; when to use what.
--
Alex Marbus
|
|
|
|
|
Well the thing i would like to make was, a save and a load function like the ones in a text program (Word)
I dont really know where to start, i need som tutorials on this one.
And no, i dont just want to save one number it was only an example
thank
|
|
|
|
|
Hi,
I am using Stingray Objective Grid ver 7.0 for implementing Grid features in my VC++ application. I am using CGXSpinEdit class for implementing spin control feature in the Grid. The problem is that the spin buttons of a spin control cell are visible only if that cell is the current cell (Cell that has the focus). The moment the focus moves from the spin control cell, the spin buttons disappear and re-appear when focus is brought back to the cell. Is there any way in which the spin buttons can be made always visible??
Thanks,
Unni
|
|
|
|
|
I want to intercept the OnKeyDown event. But I can't get the nChar converted to a String like: "R", or something else. Does anyone now how to handle this?
Thanks in advance.
CString Dutch = "Double Dutch";
CString C = Dutch;
|
|
|
|
|
CString str;
str.Format("%c", nChar);
Phew that was exhausting...
|
|
|
|
|
I have created a Wizard inside a dialog WS_CHILD | WS_VISIBLE | WS_TABSTOP,
and what I've found is that I cant access the other controls placed inside the dialog and outside the wizard.
Could you tell me how to avoid this?
Thank you in advance.
|
|
|
|