|
|
Watch that line! You've got a ; (semicolon) right after. You'll be in an endless loop, and Free will never get set to FALSE :
while (TRUE == Free)
{
Free = FALSE;
}
Seems redundant, but I explicitly test for TRUE because who knows what magic numbers (#define d) mean.
-- ian
http://www.ian-space.com/
|
|
|
|
|
My dialog project include a Strmbasd.lib file,
When I build it,5 LNK2005 errors appear:
strmbasd.lib(wxutil.obj) : error LNK2005: "public: __thiscall CCritSec::CCritSec(void)" (??0CCritSec@@QAE@XZ) already defined in TestDlg.obj
In the lib file the following class was defined:
CCritSec::CCritSec() <br />
{<br />
.......<br />
}<br />
<br />
CCritSec::~CCritSec() <br />
{<br />
.......<br />
}<br />
<br />
void CCritSec::Lock() <br />
{<br />
.......<br />
}<br />
<br />
void CCritSec::Unlock() <br />
{<br />
.......<br />
}
In my project the following class was defined
class CMemStream : public CAsyncStream <br />
{<br />
public:<br />
.......<br />
void Lock()<br />
{<br />
.....<br />
}<br />
void Unlock()<br />
{<br />
......<br />
}<br />
.......<br />
<br />
};
How to solve the problem?
|
|
|
|
|
are you #include'ing the CCritSec header in the EXE? is there any implementation in that header?
-c
"[it was..] one of those evenings when you feel that not only will there definitely be a revolution, but that the Association of Manufacturers will foot the bill."
-- Umberto Eco, Foucault's Pendulum
|
|
|
|
|
I don't include the CCritSec header, the CCritSec class was defined in the lib file.
In my project defined the following class:
class CMemStream : public CAsyncStream <br />
{<br />
........<br />
void Lock()<br />
{<br />
m_csLock.Lock();<br />
}<br />
void Unlock()<br />
{<br />
m_csLock.Unlock();<br />
}<br />
<br />
private:<br />
CCritSec m_csLock;<br />
}; In another header file CAsyncStream was defined, the header file was included in my project.
class CAsyncStream<br />
{<br />
public:<br />
........<br />
virtual void Lock() = 0;<br />
virtual void Unlock() = 0;<br />
};
|
|
|
|
|
Hi,
when the explorer crashs the system tray icons are usually gone. I found out that e.g. mIRC detects this and recreates it's system tray icon (great!). How can I do this?
PS: The CSystemTray class from Chris Maunder does not handle this AFAIK (I use it).
|
|
|
|
|
The shell broadcasts a message to all top-level windows when the tray is re-created. Call RegisterWindowMessage(_T("TaskbarCreated")) to get the ID of the message.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi,
I'm new to C++/MFC.
I have an assignment to modify the Chat program from the MSDN site (Chatter and Chatsrvr) to cater for file transfer.
I need to determine between data
that is being sent over the socket as text (the messages) versus the binary
data that is to be sent over as the file. There is a void
CClientSocket::OnReceive(int nErrorCode) looks like an overrided method
from the CSocket class. So basically whenever the socket receives
something, it kicks off the OnReceive code. It
calls the ProcessPendingRead method , which then treats the
received data as a Message (text) versus a binary file.
How can I switch between data the text for the messages and the binary data for the file when I'm doing the file transfer?
Any ideas on how to make this work?
Pett
|
|
|
|
|
Hi,
for example make a new client socket that does not send/receive chat text, but instead only receives (binary) data.
You can derive a new class from your CClientSocket, so it's more clear that this class has a single purpose (downloading files). On the server side you might need to add more handshake to distinguish between incoming clients and incoming file requests (I don't know what Chatter and Chatsrvr do).
Propably you wanted to transfar text and binary data via one socket... but this might not be good if transfering bigger files. While transfaring the user couldn't chat anymore and the server can't send chat text. Creating a new socket for file transfar solves this problems.
Hope it helps, Moak
|
|
|
|
|
i've got the memory location as follow
addres1: 0x00322360
addres2: 0x0032236c
which one is greater! Thanks
|
|
|
|
|
Number 2
Regards,
Brian Dela
|
|
|
|
|
Hi there.
Im working on a project at the moment a sort of Search program if you will. However there is obviously going to be a problem with the system if the user doesnt use it for so many days, files will have been deleted / created / modified etc.
A solution would be a small program which logged files changes to a text file. Such as new files created, modified, moved, deleted etc. This file would be loaded by the main app and the database updated.
I have researched Visual Basic and found out about "hooks". However i dont believe these stretch to this kind of activity and as ill link to below the program below uses C++.
The following program does what i want i suppose, and the source code is free, but theres no explanation to much of it and i was wondering if anyone had tutorials / source code on this complex thing.
http://www.sysinternals.com/ntw2k/source/filemon.shtml
Thanks greatly.
Gavin
|
|
|
|
|
|
Thank you soo much.
The only thing is though to make that monitor every fixed hard drive i would probably have to do a recursive search through each directory, which would be a major hit on performance for something thats running the background.
Any suggestions?
(Ive posted this without looking at the code so i may be able to work it for myself.)
Thanks.
Gav
|
|
|
|
|
Forgot my password!
Ive just found out that code only works on Windows NT / 2000 and XP. Which isnt any use to me as im on Windows 98 SE.
Gutted
Thanks again for the information but if anyone has anymore information etc i would be very grateful!
Gav
|
|
|
|
|
I think you'd need to do the recursive search once. After that, you may be able to use this class[^] to add/remove directories of interest. It would be cool if you wrote a new version of Wes Jones' CDirectoryChangeWatcher class that supported recursive watches!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks again for your help.
Damn... this is going to take some coding!
Does the code you suggested work with Windows 98?
Thanks for all your input.
Any other suggestions from other people?
Gav
|
|
|
|
|
Anonymous wrote:
Does the code you suggested work with Windows 98?
Sorry, I haven't used these classes.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
hi,
I have a base class say,CEmployee and other derived classes say CManager,CDirector etc.
CEmployee is CObject derived for getting all those features from CObject.
Now,I have a list of employees (CEmployee*) in stl list<> and I serialize them.Everything is fine while storing,but while loading i cannot get the correct class and will just read CEmployee.
How to use the RTTI for serialization.
-Conan
|
|
|
|
|
|
Yah, read that but not enough info.
|
|
|
|
|
When you save the objects to disk, the first thing you should serialize is the object's signature (or RTTI information), followed by the object itself. When you read back the object from disk, use a ClassFactory pattern to construct an object of the appropriate type, then serialize (read in) the object.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
:-DSorry if i am a pain but its bit tricky at the moment.
Should I implement the class factory .If we use CObList or something,everything gets done from CArchive.But i am using stl list<> holding pointers.How to implement it?
|
|
|
|
|
Write the employee list to disk like this:
for (each employee in list) {
CString strSignature;
*pArchive << pEmployee->getSignature();
pEmployee->serialize (pArchive);
}
When you read the object from disk, do this:
CString strSignature;
strSignature << *pArchive;
CEmployee* pEmployee = EmployeeClassFactory.createObject (strSignature);
if (pEmployee == NULL) {
} else {
pEmployee->serialize (pArchive);
}
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
So this means I will have to write my own class factory.
Why can't ar>> pEmployee do the job here when a similar thing can do it for CObList in the MSDN sample DrawCli.
Thanx for answering
|
|
|
|