|
CMemFile Datafile(1024);
CArchive ar(&Datafile,CArchive::store,4096,NULL);
pDoc->Serialize (ar);
I want use these code store the data of a RichEditDoc into a memory file,but I find that these code can't work as I want it to.The DataFile return the right length of the data of RichEditDoc,but all the file data is '0'.
Don't look at me in that way!
|
|
|
|
|
Dont you have to call open on the file before attaching it to the archive?
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
the DataFile is a memory file,how can I use Open Function?
Don't look at me in that way!
|
|
|
|
|
OK, I had no experience with CMemFile before. I was comparing your code to what I have seen in the past for serialization. After having read the notes on CMemFile in MSDN it looks like what you are doing is correct. The only thing I can think of is that you may not be accessing the allocated buffer correctly, or you need to flush the archive to commit the changes to the buffer.
Just a couple of possible reasons.
You may also need to close the archive
ar.Close()
before accessing the buffer.
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
Have you confirmed that your document's Serialize() method is serializing data?
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
hey guys
how does one detect if a computer has an active internet connection? i got the ras modem stuff sorted but what about a network connection through a corporate network and such?
is there a simple way to check on the internet or not via whatever method?
help appreciated
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
BOOL CheckInternetConnection(char *strError) {
CString g_strURL = "http://www.indiatimes.com";
LPVOID pParam=NULL;
CInternetSession session;
BOOL bConnectFlag = FALSE;
CStdioFile* pFile1 = NULL;
try {
pFile1 = session.OpenURL(g_strURL, 0, INTERNET_FLAG_TRANSFER_BINARY | INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_RELOAD); // needed for Windows NT c/r authentication
if(pFile1 != NULL) {
bConnectFlag = TRUE;
delete pFile1;
} else
bConnectFlag = FALSE;
} catch(CInternetException* e) {
LogInternetException1(strError,e);
e->Delete();
bConnectFlag = FALSE;
}
return bConnectFlag;
|
|
|
|
|
thanks for the quick reply but...
wont this code force a dial-up connection if they aren't connected?
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
Have you looked into the (well documented) InternetGetConnectedState(...) and/or InternetGetConnectedStateEx(...) functions? They might be a good starting point...
Peace!
-=- James.
|
|
|
|
|
Ok I have written an MS Dos exe with visual c++ but whenever I double click the icon the MS dos screen only flashes up for a second and then disappears. What am I forgetting to do. I can get it running by typing in the path in the command line but it must be possible to do it the other way too.
Oh... also whats the story with the "Press any key to continue" thing when I try to execute from Visual c++ tool bar after compiling it.
klara
|
|
|
|
|
Basically the program is running to completion and then closing.. I presume you have it designed this way.. just put in something to pause it at the end of the program...
Klara wrote:
Oh... also whats the story with the "Press any key to continue" thing when I try to execute from Visual c++ tool bar after compiling it.
It just keeps the program on the screen so that you can see any output... basically it pauses the program after it has completed until you press any key.
<centre>
"Never tell people how to do things. Tell them what to do, and they will surprise you with their ingenuity." - General George S. Patton Jr.
|
|
|
|
|
Is that what the getch; return 0; lines would usually be used for.
|
|
|
|
|
Yes.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Hello,
I need to modify the last write date of files after it has been changed wrong. Is it possible to change this attribute on a file? how?
thanks
/Fred
|
|
|
|
|
When people normally ask this question it's because they have changed a file and don't want anybody to know... this the case?
<centre>
"Never tell people how to do things. Tell them what to do, and they will surprise you with their ingenuity." - General George S. Patton Jr.
|
|
|
|
|
The reason i ask is because im getting files via FTP, this sets the time "LastWriteTime" of the local file to the current time. In my app i need to use the lastwritetime to compare local files to files in the FTP server. Since FtpGetFile seems to always change this time for the local file, this comparsions isn't usable.
If it's possible to configure FtpGetFile to not change this time it'd be nice but as far as i know that isn't possible(correct me if im wrong).
However, the comparsion could work if i can change the date of the local file right after it has been fetched from the FTP.
|
|
|
|
|
Check CFileStatus
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
You could also check the SetFileTime(...) function, just in cause you are not using MFC...
Peace!
-=- James.
|
|
|
|
|
I want to change a modeless dialog's behavior, in order to make possible
to put it behind the parent window.
How should i change its styles?
rechi
|
|
|
|
|
If the idea is to hide it, why not just hide it (by removing it's WS_VISIBLE style)?
Peace!
-=- James.
|
|
|
|
|
The idea is not to hide it, but to keep it behind the parent.
rechi
|
|
|
|
|
Hi,
I'm using Borlands Make.exe version 3.6 to generate some programs using make files. This doesn't work in Win2k, however. It keeps babling about
"
Fatal: Command arguments too long
NMAKE : fatal error U1077: 'n:\tools\make' : return code '0x1'
"
I don't know why it does that. It only does it under Win2k. Does anyone have a good idea.
It also appeared to work on a Win2k that was upgraded from an NT, though we've only done this on one machine.
Best regards
Lars VJ
|
|
|
|
|
OK, SOMEONE HELP ME!!!! I can't get the IP button to work using Win32 Application in a dialog. Everything works fine until I add the IPButton, calander to the dialog. The program executes and complies fine but I can't see anything? I know it's the Internet Explorer 4 Common Controls but I don't think I am linking right or my service patch 5 did not work? Can someone simply test this because if it works on someone's machine I am going to reinstall. This is just pissing me off..
t
Thanks
Grant Cooper
|
|
|
|
|
I believe that you must call InitCommonControlsEx() first
Nish
One little CD gone,
Then two CDs gone,
Then 5 more gone,
For a total 7 gones,
If I was a CD R,
I'd wanna cry,
Cause I'd be just a goner,
For a nasty CD burner.
[funny how frustration wakes up the poet in me]
|
|
|
|
|
Thank You So Much It worked. You are a god!!! I can now get rid of that string crap I had. Thank you. Ummmm god, I have alot more questions.
Add: comctl32.lib to your lib
#include <commctrl.h> // add this to your header
INITCOMMONCONTROLSEX iccex = { sizeof(INITCOMMONCONTROLSEX), ICC_INTERNET_CLASSES };
// Init the common controls.
InitCommonControlsEx ( &iccex );
Grant Cooper
|
|
|
|