|
I tried to use the following and got error!! which says can't convert CDoc* to CWnd*
CFileDialog fileDlg(FALSE,"xml", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "XML Files(*.xml)|*.xml||", this );
fileDlg.m_ofn.lpstrTitle = "Save As";
|
|
|
|
|
Instead of this use either NULL or AfxGetMainWnd()
John
|
|
|
|
|
We have some runtime errors and DevSudio
trys to find dbgheap.c. It isn't on my
machine, or anybody elses here either.
Where can we get dbgheap.c and the
other runtime debug files?
|
|
|
|
|
It's part of the C run-time library source.
This is not installed by default with Visual C++ 6. If installed, it is in \Program Files\Microsoft Visual Studio\VC98\CRT\SRC. If not installed, just re-run the installer and install the C run-time source as an additional component.
For Visual C++ 7.x, it's in \Program Files\Microsoft Visual Studio .NET\Vc7\crt\src or \Program Files\Microsoft Visual Studio .NET 2003\Vc7\crt\src, depending which version you have installed. I can't remember if it's installed as part of the default setup or if you have to drill into the install options to select it.
Brad
|
|
|
|
|
Hi, I am trying to get a few parameters in an output file.
i have included fsteam.h, and iostream.h
my code is:
ofstream out("output.txt");
CMyDoc* pDoc = GetDocument();
out<<"12454 ";
out<<pdoc->X_Position<<"\n";
out<<"y: ";
out<<pdoc->Y_Position<<"\n";
out<<"z: ";
out<<pdoc->Z_Position<<"\n";
the code makes the output file, but its always empty,,
any siggestions?
Ehsan Behboudi
|
|
|
|
|
1) When is the file empty? Do you check while your program is running or afterwards?
2) Make sure you have out.close(); after you finish. This is to make sure everything is output on the file.
Hosam Aly Mahmoud
|
|
|
|
|
First, the contents may be output to some file else if you use relative path like that, you better use absolute path to make sure the destination file is exactly which you expected. So type this instead:
ofstream out("C:\\output.txt"); .
Second, you need to exam the stream first to make sure the destination file is ready to be written, so add this line right after you open it:
ASSERT(out != NULL);
Third, always close a opened file as soon as you are done with it, add this line at the end:
out.close();
I have a strong feeling that your problem was caused by the first issue, you probably will find "output.txt" in your "My Document" folder, lol.
|
|
|
|
|
trying to pass a Hyperlink, part of msword9.h
function prototype:
BOOL WriteHyperlinkToExcel(CString sFileName, Hyperlink hyp);
error:
error C2061: syntax error : identifier 'Hyperlink'
i can create and use a Hyperlink inside a function without errors:
BOOL CHyperlinkApp::WriteHyperlinkToExcel(CString sFileName)
{
Hyperlink hyp;
CString strTemp = hyp.GetAddress();
return TRUE;
}
any thoughts?
<signature>
Josef Wainz
Software Developer
|
|
|
|
|
Is msword9.h included in your .cpp file rather than the .h file?
Jason Henderson "I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it."
- Jack Handey
|
|
|
|
|
in my .cpp file.
<signature>
Josef Wainz
Software Developer
|
|
|
|
|
Your function prototype is in the .h file so if you want to declare Hyperlink as a parameter in a prototype, you will have to include msword9.h there instead of in the .cpp file.
The compiler doesn't know where to look for Hyperlink.
Jason Henderson "I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it."
- Jack Handey
|
|
|
|
|
that fixed it. so when passing parameters from special libraries, include the .h file in the function prototype .h file.
thanks,
<signature>
Josef Wainz
Software Developer
|
|
|
|
|
Recently, I downloaded a sample program from the internet which after compiling it, received a "0 error; 0 warning" result. When I ran the program, it produced a screen (something like a menu) with several options from which to choose. As soon as I selected one of the options (it didn't matter which one), the screen disappeared.
Checking Windows Explorer to see the ".exe" file for the program, I noticed there weren't anything. NOTHING!! There were no ".pch", ".ncb", or ".obj" files (etc.). NOTHING!!
Was there something the author of the program turned off to suppressed the creation of those files, and why did it execute nonetheless (producing the menu screen)?
Is there something I can turn back on to get those files created?
Thanks for any pointer.
William
Fortes in fide et opere!
|
|
|
|
|
WREY wrote:
Was there something the author of the program turned off to suppressed the creation of those files...
They were created, but possibly in a different location. Do another compile and then search for the EXE. Or you could inspect the .DSP file to see if another target folder was specified.
|
|
|
|
|
Thanks for replying.
Your suggestion about searching for another location where the files may possibly be at, turned out to be a very good tip, because doing so revealed the place where the ".exe" file (along with the others) were located.
Having found the ".exe" file, I once more clicked on it and true to form it produced the menu screen. This time however, it didn't wait for a selection to be made before disappearing, it did so automatically the very next second after it came up.
It's like the author did not intend for the person to use the application, but only see the menu.
Thanks again for the good tip you gave.
William
Fortes in fide et opere!
|
|
|
|
|
How can I deselect an Item in a Tree Control
How can I deselect an Item in a Tree Control from the program?
|
|
|
|
|
|
How can i realize a Browse button in Visual C++ 6.00? That is i can't select files only directory.
----
I can change a world, but God don't give me a source.
|
|
|
|
|
Start with SHBrowseForFolder() .
|
|
|
|
|
Hi,
Still working on the program that sends messages over the internet.
The problem that I am facing now is inserting a delay. I need to insert a delay between sending numbers when i read from a file. The file just contains a bunch of numbers, each on their own line. I need to just put some delay that the user will set in another dialog box.
Any ideas on how this is possible? Please help if you have any information.
Thanks for your help.
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
Use a Sleep() before opening the file.
John
|
|
|
|
|
Hi John,
I need to have the delay while reading the file. I need to read a few numbers from the file, then delay for some amount of time (which is determined by the user in another dialog box) and then read some more.
Can someone tell me if this is possible? if so, can someone lead me in the right direction. sample code maybe?
thanks for the help.
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
NewHSKid wrote:
Can someone tell me if this is possible?
It should be pretty easy to do. Is there a chance that the delay will be long > a few seconds? The reason why I ask is it is very easy to add a Sleep(). In the simple case during the Sleep() the window will not be updated at all. If the user trys to minimize or move the window it will appear hung. If this is a problem then we will have to go about it in another way. The other question is how are you openining the file (CFile, ifstream CreateFile() ...)? There are so many functions to use.
John
|
|
|
|
|
John,
Sorry for not giving you the information you need to help me. I have been trying to do this in between doing my HW.
Well I have an app done in MFC, with a lot of dialog boxes. I connect to the server and have to send these numbers to the server. The numbers are all different basic math calculations. Any how I write the numbers to a file, each one having its own line. My program is supposed to send all the numbers to the server, but here is the problem. The user can choose to add a delay in sending the information. So it should send one number, then delay for a short time, then send the next then delay for the same amount of time.
The time is going to be no more than 1 second, and more like to be in the range of 0.1 - 1.0 seconds. Is this possible? I know it really short of a time, but that is what i was told.
I open the file as:
CStdioFile f;
f.Open(Filename, CFile::modeNoTruncate | CFile::modeWrite);
f.WriteString(temp);
f.Close();
MANY MANY thanks.... I really appreciate this. I need to get this app done soon.
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
I assume you know how to connect and send data to the server 1 number at at time. Convert the user delay value into milliseconds. Then before your Send() function call Sleep(userTime).
Here is a link that talks about the accuracy of sleep:
http://www.codeproject.com/system/sleepstudy.asp[^]
I hope this answer is not too simplistic. I get the idea you want more but I am not sure what.
John
|
|
|
|