|
When i do read it (after the initial crash) its successful. I dont know if the source I posted above gives any clues...
Thanks,
ns
|
|
|
|
|
Well, I changed PostMessage to sendMessage and things worked! Apparently there was a timing issue and the code that needed to be run didnt, while the code that triggered the postmessage went on as though it had the data from the postmessage function already. This only recently became a problem, since it worked fine before. It was impossible to debug, and the only way was a lucky trial and error. I had no hope.
ANyways, now I'm not so thrilled (but can live with it) with the fact that CFileDialogs pop up out of the blue when the app starts with no background blank UI suggesting which program is spawning them. SO its not very informative, and not traditional really. ANy ideas on how I can make things so that the blank UI comes up behind the CFileDialog (like it used to when I postMessaged the CFileDialog).
This was a nightmare crash and I cant yet believe its resolved. Nothing in the debugging suggested that that was the problem. In fact the postmessage never got triggered when a breakpoint was put at it(it got there and went past). But when I ran it directly, I did get the postmessaged CFileDialog. So there was no similarity between debug mode and run mode events. However the postmessage in a simpler version of my program would trigger just fine at the right time and get things done in time for the main program to use the data and not crash.
Thanks everyone for helping, and sorry again for the ultra long post,but I wanted to put forth as much information as possible to get your input.
APpreciate the help,
ns
|
|
|
|
|
Be asured that the problem is not solved. Just hidden. I wouldnt give up now and continue the search for the problem. There is nothing like a timing problem, just things like uninitialized variables, unsynchronized resource access and most important false expectations on program behavior. Not to forget of course unchecked error conditions.
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
Thanks for the warning. In my registry code, the source I got my code from said that if I tested the 'result' of querying the key at the end of a series of queries, it would fail if any one of them failed, so I ony need to test it the final time. I dont know if thats sound programming, but thats what I read. I feel like I'm walking on eggshells now, since there are zillions of user choices that could trigger errors that I havent accounted for. Also, every time I do a 'new' I havent checked for NULL which I should do in case theres not enough memory and the pointer comes back NULL right?
I'll have to spend one day going through the code and putting in error tests whereever I can forsee they are required. Thanks for the caution. This stuff is nervewracking! Not being transparently predictable.
|
|
|
|
|
Is there any way to use GetFileSecurity API in an application that will also be used on a 9x machine? Because when you compile and run on 9x you get errors because the OS does not have that API. If so could someone show me how. Thank you.
<><><><><><><><><><><><><><>
Matthew R. Miller
mattrmiller@computersmarts.net
www.computersmarts.net
|
|
|
|
|
You should use LoadLibrary and GetProcAddress.
I'm not sure if it's possible to use delay load in your case - this technique works on per-library basis, and the function in question is located in advapi32.dll.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
I really don't know how to interpret this:
error C2598: linkage specification must be at global scope , when I click on it it takes me to this function, I will bold the text where the arrow points to. I'm lost......again.
void Create_Report(Diver_Info theDivers[])
{
ofstream OutputFile;
OutputFile.open(ReportFile, ios::out);
OutputFile << setiosflags(ios::fixed|ios::showpoint) << setprecision(2);
OutputFile << setiosflags(ios::left) << setw(6) << "Place" << setw(26) << "Name"
<< setw(8) << "Score" << endl << endl;
for(int i = 0; i < Best_Divers; i++)
{
OutputFile << setw(6) << (i + 1) << setw(26) << theDivers[i].Diver_Name
<< setw(8) << theDivers[i].Total_Score << endl;
}
OutputFile.close();
}
My header file that I am including does #include <fstream.h>. Any ideas?
Nick Parker
|
|
|
|
|
Compiler Error C2598
linkage specification must be at global scope
The linkage specifier was declared at local scope.
The following is an example of this error:
void func()
{
extern "C" int func2(); // error, linkage declared in
. // block at local scope
.
.
}
extern "C" int func( int i ); // OK
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Right, well I read that at MSDN too, however it doesn't mean anything to me. Could you explain. I am just trying to create a file stream to write an output file. What else do I need?
Nick Parker
|
|
|
|
|
if u copy paste ur function into a console application does it work? if it doesnt, u declared a function in a scope of another
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hmmm... I'm pretty sure I understand what you are saying, however after looking through this I don't see where I have done that. Maybe I need to go strech my legs.
Nick Parker
|
|
|
|
|
Make sure you are not mixing IO.
try to use <fstream>
|
|
|
|
|
if i copy your code into an empty app and add the appropriate headers (and a fake DriverInfo struct), it compiles fine.
#include "stdafx.h"
#include <iomanip.h>
#include <fstream.h>
struct Diver_Info
{
char Diver_Name[26];
int Total_Score;
};
void Create_Report(Diver_Info theDivers[])
{
int Best_Divers = 0;
ofstream OutputFile;
OutputFile.open("c:\\temp\\ofs.txt", ios::out);
OutputFile << setiosflags(ios::fixed|ios::showpoint) << setprecision(2);
OutputFile << setiosflags(ios::left) << setw(6) << "Place" << setw(26) << "Name" << setw(8) << "Score" << endl << endl;
for(int i = 0; i < Best_Divers; i++)
{
OutputFile << setw(6) << (i + 1) << setw(26) << theDivers[i].Diver_Name << setw(8) << theDivers[i].Total_Score << endl;
}
OutputFile.close();
}
int main(int argc, char* argv[])
{
Diver_Info d[2];
Create_Report(d);
printf("Hello World!\n");
return 0;
}
Aiei i ea eio aoa i e eio e aigoa
|
|
|
|
|
That does seem to surprise me, nothing seems to surprise me anymore
I am not sure what is going on, it appears to be correct, but the compiler just spits it back at me. I am sure I am doing something wrong here somewhere.
Nick Parker
|
|
|
|
|
If you leave off a ; on a class declaration you can end up with very confusing error messages
class MyClass
{
} <--- oops!
And there's very little that will pin-point the actual errors. In cases like these you just have to try changing/removing things until you can narrow down the actual error.
Todd Smith
|
|
|
|
|
Are you including the right fstream header somewhere else ? fstream.h is not standard, you should include fstream instead. The same goes for all other iostream headers such as iosfwd and so on.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Having worked in Boreland Builder for GUI the last 4 years, was forced to use VS and MFC to do a rather complicated GUI. I simply can not believe it is as painful as it seems.
The some of the GUI libs on here are very nice, but on the whole the work has to be a factor more.
Are there any benefits to using VS and MFC over an actual RAD enviroment?
|
|
|
|
|
Anonymous wrote:
Are there any benefits to using VS and MFC over an actual RAD enviroment?
MFC looks good on your resume.
-c
Aiei i ea eio aoa i e eio e aigoa
|
|
|
|
|
Hi,
Yeah, it definitely looks good on your resume and is a must-have. However, having said that I am not a big fan of MFC myself. It really bloats up the software and makes it sluggish. However, companies use it and you are left with no choice. In my personal projects, I make wrapper classes around the WIN API.
Relisoftis a good resource if you want to learn about programming for windows without the use of MFC. Even if you use MFC, it is a site worth looking at. I am not saying, do not use MFC at all. But it sure is a good learning experience, if you know your way around WIN32 API.
My 2 cents
Pankaj
Without struggle, there is no progress
|
|
|
|
|
VS and MFC aren't exactly the best RAD tools available, but I find they have more power and flexibility than Borlands offerings. It depends on what you are trying to develop. MFC is great for building large applications, but you do need to know how and why things work in it.
I love MFC, but it is starting to show its age but for nearly 10 years it has allowed me to develop lots of Windows applications quickly (if not always easily)
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
Hello, where do I get my hour/minute from the computer?
CString mydate;
mydate.Format("%d:%d", xxx );
|
|
|
|
|
Assuming you can use native Win32, see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/time_functions.asp
Not sure how MFC does things.
|
|
|
|
|
Check CTime::Format and COleDateTime::Format.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
|
one class :
CTime
usefull member function: Format
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|