I'm using the MFC sockets mechanism for TCP\IP communication (CSocket, Srialization ability etc.) in a Process that spawns some threads.
It works fine until I deliver the socket pointer to one of the threads created by this process so that it can use it to send messages through this socket too - the application then fails, and if I understand correctly it is since the only thread allowed to use this socket is the one created it (in my case the main process).
I'm looking for an elegant solution to this limitation (I can go around the problem in several ways but it might affect the complexity and run-time of the program).
That bug appears only when linking statically, and is probably not the cause of the problem.
For a solution on using a CSocket object in a thread different from the thread that created it, see "How to pass a socket connection between threads in an MFC application in Visual C++" at http://support.microsoft.com/kb/175668[^]. Basically, you need surround the thread hand-off with calls to CAsyncSocket::Detach() and CAsyncSocket::Attach().
i am using CListCtrl in Icon-mode. I am setting the item positions manually with ListView_SetItemPosition32().
I am having a strange bug, y-positions between 0xf000 and 0xffff are not set properly !
Is this a known bug or am i doing something wrong ?
Did you install the CRT and MFC source code? If so, you can step into the MFC implementation code (so long as you're working with a Debug build) and find what Win32 call is failing. That might give you some more information.
Only thing I can think of, apart maybe from finding some sample code, to see if there's anything you're missing?
As always, you are correct!
BITMAP and BITMAPINFO are definitely different!
Here is my wrong code
m_lpBmpInfo = (BITMAPINFO *)( new char[m_vfs]);
((LPBITMAPINFOHEADER)m_lpBmpInfo)-&gt;biSize = sizeof BITMAPINFOHEADER;
// document bitmap header pointer initialization - do only once in the class
pDocument-&gt;m_lpBi = (BITMAP *)( new char[m_vfs]);
((LPBITMAPINFOHEADER)pDocument-&gt;m_lpBi)-&gt;biSize = sizeof BITMAPINFOHEADER;
As always - the de-reference symbol is shown as -&gt; should be "->"
Now I need to figure out what data is missing from BITMAP. Should be easy.