|
BOOL Test()
{
CFileDialog dlg(FALSE,............,NULL);
dlg.DoModal(); //
return TRUE;
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I have done that and i did some extra stuff when i click Save and when i click cancel. but after that when the function return s then it arises EXCEPTION error.
Thanku....
|
|
|
|
|
What error it shows,When returns.
Sudhir Kumar
|
|
|
|
|
hi...
" Un Handled error Exception arises...."
|
|
|
|
|
This is actually a known bug that comes about due to the size of the OPENFILENAME structure being used with MFC. You need to define _WIN32_WINNT to be 0x500 , and set the lStructSize member to to 88 (instead of 76). You might also need to use GetOpenFileName() instead of CFileDialog() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
modified on Wednesday, June 4, 2008 8:45 AM
|
|
|
|
|
For example:
open("c:\\goodssale.dat",ios::binary|ios::in|ios::out)
cann create a file in "c:\\goodssale.dat"
but how can i create the file in the folder of the program
|
|
|
|
|
gtzygtzy wrote: but how can i create the file in the folder of the program
You need to determine the programs current working folder (CWD). Have a look at GetCurrentDirectory() or _getcwd() . You might also consider GetModuleFilename(NULL, ...) .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Ohh great!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
gtzygtzy wrote: but how can i create the file in the folder of the program
Use GetModuleFileName to get full path of your program and then use PathRemoveFileSpec to get the parent folder of your program.
For e.g. if your program is in C:\Program files\Myprogram then path returned by GetModuleFileName is C:\Program files\MyProgram\YourProgram.exe and then PathRemoveFileSpec removes the file part and returns C:\Program files\MyProgram.
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
BTW, if you specified only the filename without path, "goodssale.dat", it creates file in the current working directory, and the fullpath to the executable can be obtained from the first argument of the argument vector (commandline parameter) of main function.
|
|
|
|
|
this link might help :-
http://www.visualcpp.org/?p=92[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
And for more info you can check that file is exist or no with FindFirstFile if you want to keep values of file if it's exists.
|
|
|
|
|
Ok, everytime I enter aa code with anny of the #include starters, i get 103 errors and 2 warnings, and then I look for them, and it opens a new window "tab" thingy, and otsream, or istream or math or w/e i am using comes up. It makes testing fully written programs impossible to test. Does anyone know how to fix it??
"The beauty of Grace is that it makes life not fair" Relient K, Be my Escape
|
|
|
|
|
You can get this type of error if one of your include files has a procedure/function definition statement that is missing a ;
|
|
|
|
|
can you paste the first error message please ?
also, give us a relevant piece of code so that we can see what's wrong there...
|
|
|
|
|
Just look at the display name of the OP. That must give you a clue.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
it looks like this,
<br />
int __declspec(dllimport) LSCardAtStartAPI(DvbAtApi **h, CEvent *ShtDn, CWnd *Wnd,...)<br />
and it compiles in another project on the same machine.. in fact these two projects share this file, but one of them gives me a syntax error...
(my guess: what VC++ 6.0 compiler setting am I looking for???)
|
|
|
|
|
It might help if you offered the *exact* error message.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can you post your error message.
Sudhir Kumar
|
|
|
|
|
Dude, please see before posting! you might be get flamed down in this forum, if you are not careful!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
C2061 syntax error, something about using enumerated types in function arguments but I'm not sure I fully understand it. Sorry for leaving that out.
|
|
|
|
|
And I suppose I should mention, I have 2 projects on the same machine, both of which use this file, and are MFC apps (dialog based) - only 1 gives me this error..
|
|
|
|
|
bulg wrote: but one of them gives me a syntax error...
Compiler is not able to find a declaration for class CEvent , make sure you have the necessary header files included or forward declare CEvent if you are including necessary header files in a .cpp file. As a good practice do include necessary headers(afxmt.h) in a header file.
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Nibu babu thomas wrote: As a good practice do include necessary headers(afxmt.h) in a header file.
Good Practice ???
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|