|
|
Hey. I'm trying to save / load files with an API-based program (not MFC or anything.) I've always used <fstream.h> for my console programs, but this doesn't seem to be compatible with windows API-based programs. ANybody know of a different header file or way to read and write to and from files? Thanks - Dave
|
|
|
|
|
oops...it got cut out in the last post because I had something in brackets...where I say "I always used for console" its supposed to be "I always used fstream.h for console-based programs"....yeah...
|
|
|
|
|
Use CreateFile, WriteFile and CloseHandle
Nish
a small sample goes below :-
HANDLE b=CreateFile(fpath,GENERIC_WRITE,0,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_HIDDEN,NULL);
sprintf(outbuff,"Hello World\r\n");
WriteFile(b,outbuff,strlen(outbuff),&count,0);
CloseHandle(b);
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
I see...what would &count be in this place? And what is the command for reading from a file...I'm guessing ReadFile().
|
|
|
|
|
put this before the code
DWORD count
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Hello everyone,
I hope someone can help me! Recall that DoDataExchange is defined like this:
void CMyDlg::DoDataExchange(CDataExchange* pDX)
In my program, pDX is always garbage! For every single dialog in the program, every time it's called! This did not happen on my home computer but now I'm trying to run my application on a different computer and this is happening.
Any ideas? Naturally it leads to chaos, once the DDX routines start being called.
If anyone can help, I will be very grateful.
best regards,
Stephen Wilson
|
|
|
|
|
I have the good old problem of mixing ressource of DLL and main application.
Does anyone has a simple solution other than playing all the time with AfxGetRessource, AfxSetRessource, etc...
Jonathan de Halleux, Belgium.
|
|
|
|
|
Create a class where in constructor You will set new resource handler, and in destructor You will set the old one. You may want to override DoModal method (in case of dialogs of course). You may also include resource dll in CDynLinkLibrary - create "fully MFC" library. In such case, MFC will search for resource itself.
|
|
|
|
|
Thanks for the tip.
What about modeless dialogs ?
Jonathan de Halleux, Belgium.
|
|
|
|
|
Hi
This is a serious bug, could not find whether it has been discussed before.
Try this:
#include <stdio.h>
void main(void)
{
printf("\t\t\b\b\b");
}
Be warned it will restart your windows 2000 or XP machine.
Does anyone know why?
it's sure quicker than any other windows reset procedure that i've seen
cheers
Optic
|
|
|
|
|
There has been a couple of threads about it in here...
It's a known bug, and AFAIK there's also a hot-fix for it...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Does Service Pack 2 fix this problem?
I hope so
|
|
|
|
|
SP2 does not fix the program.
But if you crash you system running the program, who's fault is that.
The bug is stupid, but really can't do much to you.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
But if you crash you system running the program, who's fault is that.
The fault is clearly Microsofts. No user-mode program (not excercising Administrator rights) should obviously be allowed to take down the whole system, especially not in this uncontrolled way.
|
|
|
|
|
Hi, This is very confusing to me. I am getting a run time error while running my debug version of the program, please take a look at the message and see if you understand it and explain it to me in plainer english. Thank you.
<br />
Debug Error!<br />
File: i386\chkesp.c<br />
Line: 42<br />
<br />
The value of ESP was not properly saved across a function call. This is usually result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.<br />
|
|
|
|
|
|
Anyone know how to create an in-memory HTML document and then launch it into a browser? I'm currently doing it by filling a CString and then writing it to disk in temp/report.html, then launching report.html by using ShellExecute... I'd like to avoid the whole "writing to a temp file" part, and somehow feed the CString that contains HTML data directly in the registered application for HTML files.
Is this possible within a VC++ program?
Thanks in advance...
-jfaulken
When sushi is outlawed only outlaws will have sushi.
|
|
|
|
|
Hello,
Here's some code which does this...
void CMyHtmlView::SomeConvenientFunction()
{
LPDISPATCH iDispatch = GetHtmlDocument();
if(iDispatch) {
IHTMLDocument2* iDoc2;
iDispatch->QueryInterface(IID_IHTMLDocument2, (void**)&iDoc2);
if(iDoc2) {
HRESULT hr;
IHTMLElement* pBodyElement;
hr = iDoc2->get_body(&pBodyElement);
if(hr == S_OK) {
CString strHtml;
strHtml = "YOUR HTML GOES HERE!";
BSTR html = strHtml.AllocSysString();
CString strBeforeEnd = "BeforeEnd";
BSTR beforeEnd = strBeforeEnd.AllocSysString();
pBodyElement->insertAdjacentHTML(beforeEnd, html);
}
iDoc2->Release();
}
iDispatch->Release();
}
}
best,
Stephen Wilson
|
|
|
|
|
By the way, my post assumes that you have a CHTMLView. I doubt that it's possible to pass a CString to IE, probably you do need to create a file if you want an external application to show it. But if you want to show HTML from memory within your program, then this is the way to do it.
|
|
|
|
|
Hi experts
I wrote an application that "sits" in systray and popups a menu using "TrackPopupMenu".
The problem is that when select a different window while the menu is open it still remains at top and I must close it by selecting one option from the menu.
Is this a bug or did I forget to do something?
bye
|
|
|
|
|
|
http://www.codeproject.com/shell/systemtray.asp
it gives a solution to this problem.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
MSFlexGrid seems to be crashing my program when I run it. This seems to happen on machines that I do not have Microsoft VC++ installed nor Visual Basic. Is this something that can be easily fixed by grabbing a dll or is this a little more involved such as registering the control with the host machine? Can Install Shield register the control if this is necessary?
Thanks!
"Why are we hiding from the police, Daddy?"
"We use VI, son. They use Emacs."
|
|
|
|
|
Hey...how would I get rid of the blue bar at the top that has a caption? I have this to create the window...
WndSplash = CreateWindow (SplashClass, NULL, NULL,150, 150, 500, 250, NULL, NULL, hInstance, NULL);
Obviously, I didn't add any parameters that put a caption or any maximize or minimize buttons at the top, but when loaded, I still get a blue bar at the top of the window. How would I get rid of this? Thanks - Dave
|
|
|
|