|
Thank you
---
PAGE FAULT: Please insert "Swap File Disk 2" in drive and press any key to continue
|
|
|
|
|
Hi to anyone,
I've a some problems on using ReadFile and WriteFile API functions.
I'm usinge these API on a function that will merge multiple files into one file.
The problem is that any nul(0x00) character will be converted (after WriteFile() call) to sp(0x20).
I've used a 'BYTE buf[4096]' buffer to load into datas and also changed this buffer to an 'LPVOID lpbuf' dinamicaly allocated with (HeapAlloc() function), but never changed.
Can anyone tell me my these conversions?
What I'm doing so wrong?
thank you in advance.
"Take time to think, it is the source of power"
|
|
|
|
|
I believe you have to open the FILE stream as binary.(if you are not all ready doing that) That way everything is treated as raw binary data.
erik
|
|
|
|
|
Correct, but I opens all files with CreateFile(...) API call.
How can I specify binary mode instead of text mode?
Thank you in advance
"Take time to think, it is the source of power"
|
|
|
|
|
Excuse me, but I've solved my problem.
I was causing the conversion with my code.
Thanks for your time
max
"Take time to think, it is the source of power"
|
|
|
|
|
This is a question relating to Windows CE 3.0
What I would like to know,is there a way to get rid of the OK and Close buttons that get put on the title bar of a Property sheet.
Any help would be apprectiated.
|
|
|
|
|
Can anyone help me with this. I am trying to compile a Debug multithreaded DLL and I keep getting the following errors. I am really stuck so if anyone has encountered these errors before and can point me in the right direction I would greatly appreciate it.
nafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
Debug/if_boxcube.dll : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
if_boxcube.dll - 6 error(s), 0 warning(s)
Thanks, In Advance
Stacie
"Imagination Is More Important Than Knowledge" ~Albert Einstein
|
|
|
|
|
Did you manage to fix this? I'm having the same problem.
James Spibey
I love the word naked, it's brilliant isn't it, 'naked'. When I was a kid I used to write the word naked on a bit of paper hundreds of times and rub my face in it - Jeff, Coupling, BBC2
|
|
|
|
|
Hello, the codegurus around the world.;)
I wrote the code to eject the cd from my application.
First time, I use mciSendString () to do this, and this works fine.
But, QA pointed out that this code didn't work on Windows 95 and NT without installing
MCI.
So, I use DeviceIoControl function since I found some sample code for Windows 9x and NT.
However, since I'm lazy , I omitted the code to check if the other application
uses CD or lock and unlock CD.
Without these codes, my code works fine on Windows OS including Windows XP.
But, I'm curious that we need these kind of codes - check if the application uses CD or lock or unlock CD.
(In fact, the time of executing my code rarely faces these kinds of situation, so I omitted these.)
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
How to add control on the CProperty Page .
|
|
|
|
|
Add a new resource. (Insert->Resource->Dialog->Property Page)
Create the property page as you would any standard dialog.
When you create a class for the new resource, make sure you derive from CPropertyPage. That's it.
|
|
|
|
|
Not for the faint hearted. I recently changed the way my project was designed and parts of it stopped working, I tracked this down to a media com object being created in my worker thread and not the thread where my *mainframe* window resides.
Question?
If I'm in a worker thread is there anyway to create a com object under the context of another thread i.e the thread where my mainframe resides, I'm sure I've done this before, but have'nt touched COM for 6months.
Thanks In Advance
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
Does the com object work in a worker thread (does it have a window or need a message pump)? You may need to create it in your main thread or a user-interface thread instead.
If you create a com object from the worker thread, then it cannot be called from other threads directly because the com implemenation uses windows messages to call objects in other threads.
|
|
|
|
|
Here goes, hope this is clean
[CMainframe]
|
+-W A S----> OnTimer
| new ATLMediaPlayerWrapperWnd *This Worked*
|
+ N O W----> ActionThread (Responsible for creating objects etc)
| new ATLMediaPlayerWrapperWnd *This Doesn't play but screen a single frame*
if I put DoEvents( PeekMessage etc) in the while (1) loop is works fine.
Ideally I *dont* the DoEvents code, the the object needs to be create in the ActionThread code.
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
if I put DoEvents( PeekMessage etc) in the while (1) loop is works fine.
That means you DO need to have a message pump for the object to work. Why not change the ActionThread to a user interface thread derived from CWinThread so that you don't need to DoEvents explicitly.
|
|
|
|
|
Owwww noooo, can't do that. Need especially CWinThread (horrid) need to keep the object in a worker thread. I think I have a solution see other postings on this thread.
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
"Owwww noooo, can't do that. Need especially CWinThread (horrid) need to keep the object in a worker thread. I think I have a solution see other postings on this thread."
Good for you. Comeback when it doesn't work.
|
|
|
|
|
Got it working, do you won't a copy for reference
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
No, thanks. But you did move the creation of your com object to the main thread which has a message pump, right?
Otherwise, you need to write an article to explain how it is working.
|
|
|
|
|
You can create the object and then marshal it to the other thread via CoMarshalInterThreadInterfaceInStream.
|
|
|
|
|
I know where your coming I reckon this should do the trick?
CMyActionThread::CreateObject()
{
SendMessage(m_hWnd, WM_CREATE_OBJECT, 0, 0);
//
Now get the marshedPointer!
}
LRESULT CMainFrame::OnMyCreateObjectMessage(WPARAM wParam, LPARAM lParam)
{
// Create the object
// Marshal the object
return 0;
}
and it's coming back now, in essential com, there's helper functions, WritePtrToGlobalVariable and ReadPtrFromGlobalVariable
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
I have create DBGrid controls at run time and want to catch event corresponding each instance but find no way.
so if someone know about it plz tell me
|
|
|
|
|
I tried to create a cobject derived class:
CObject*t=(CObject*)RUNTIME_CLASS(CHScrollTitle)->CreateObject();
and then i tried to free it with:
delete t; or CHScrollTitle::operator delete(t);
but the delete operator failes in debug-mode with an assert-notice. (something with pHead->nBlockUse==nblockuse)
does anybody know how to free a with CreateObject(or CArchive::ReadObject()) created object?
\
TIA B.Bruggeman
|
|
|
|
|
This problem isn't probably related to CRuntimeClass::CreateObject - seems that you've corrupted the heap somehow.
BTW: calling CRuntimeClass::CreateObject makes absolutely no sense when you know the exact type of object - in your case, it's CHScrollTitle. You can just write
t = new CHScrollTitle;
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I also thought it was a memoryleak/overwrite but i wrote a simple test program and than already it assert's about the debug-memory-tracing-variable m_nBockUse,
but when i use new/delete it doesn't assert..
i have different kind of classes in a list and i want to serialize them using Write/ReadObject, so i can't use an ordinary new/delete operator. but when i tested this it asserts in the (debug) operator delete, so i tested it with the lines i posted before, but it still asserted..
so do you have other suggestions?
btw in the file afxmem.cpp are many operator delete which (in debugmode) either call _free_dbg(p, _CLIENT_BLOCK); or _free_dbg(p, _NORMAL_BLOCK);, so probably the wrong deconstructor is called.. but how do I fix this?
TIA. B.Bruggeman
|
|
|
|