|
i will make this more practical to imagine by telling u what program it is.
It is supposed to be a multithreaded echo server, i mean, its supposed to accept any incoming connection request AND (the special bit) when 1 client sends something to the server, the server needs to send this back exactly as it came to ALL (i repeat ALL) connected clients.
hope this helps?
Thanks for the help
Kuniva
|
|
|
|
|
The top half of the long value in the window message (from memory) contains the
FD_ flags for the event(s) that trigger the message.
In general, however, I use AsyncSelect like this:
- I make a winsock call.
- If the call returns the WOULDBLOCK result I wait for AsyncSelect to send a message.
- I make the same call again. This time I should get a real result (should I get a WOULDBLOCK I'll wait again).
When I get these messages I generally just look for an error code , or a FD_CLOSE. Otherwise I check the status by making the winsock calls.
So, for example, you do a listen. You call accept and it will normally give you a WOULDBLOCK (if it doesn't it means a call is already waiting and you can take it).
Then you wait for a message from asynselect to tell you there's a connection waiting.
Then you make that accept call again and it gives you the new socket.
The only exception to this pattern is the connect call which you only make once. In the case of the connect call once your FD_CONNECT comes back you're connected. You don't make the connect call again (an annoying inconsistency to my mind).
|
|
|
|
|
I've been trying to get tooltip hints working as the mouse passes over a TreeCtrl. I've created an OnToolTip handler, which does indeed get called when you settle the mouse on a tree item.
What I can't figure is how to translate what's passed to the handler into a HTREEITEM or similar so I can find the co-responding tree item and, hence, build suitable text.
I've got control IDs and a window handle available but I can't see how to translate either.
I've been using a CMapPtrToPtr to map the HTREEITEM to the relevant data object though, on further study, it probably makes more sense to point the item data field at the object.
|
|
|
|
|
|
I think that's the message I handle (don't have the code with me here). Certainly the routine I put in get's called when I'd expect it to, I just don't know how to make sense of the parameters.
|
|
|
|
|
You should have pointer to NMTVGETINFOTIP structure, which is full of relevant information.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Yup, I think that's the structure (this would be a lot easier if I had the code here). The structure I get contains a window handle and a what is probably a controll id. But what I need to access the data and supply the text is the HTREEITEM handle, which just doesn't seem to be arround. Nor can I find anything in CTreeCtrl that seems intended to look it up.
|
|
|
|
|
Yup, I think that's the structure (this would be a lot easier if I had the code here). The structure I get contains a window handle and a what is probably a controll id.
You're probably talking about NMHDR - it contains a handle and an id. You can cast the pointer to *NMTVGETINFOTIP to get more info - assuming that you're really handling TVN_GETINFOTIP.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks, that's probably it. I may well be looking at too generic a message too. I'll give it a go tonight.
|
|
|
|
|
Hi,
I have come accross a memory leak in my project ...
could anyone suggest any memmory leak testing utility which will help me pinpoint the source of the leak
regards
|
|
|
|
|
BoundsChecker from Numega is great. You can get a 15-days evaluation copy their website...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
BoundsChecker does work wonders, but the object dump should do a pretty good job of telling you where your leak might be. Sometimes, if you're lucky, if you click on the object name or the memory address the debugger spits out right below "Detected memory leaks -->" it will put you in the right area of the source. If it doesn't, then you'll have to do a little fishing on your own or consider NuMega products.
Bill
http://www.ratebeer.com
|
|
|
|
|
Actually, if you really want to track down these memory leaks without forking out for BoundsChecker, there is a really good debugging trick described in Knowledge Base Article Q151585 which described the _crtBreakAlloc variable (You can search for Q151585 or "Use _crtBreakAlloc to Debug a Memory Allocation" in MSDN)
Basically, when you get an object dump with numbers next to it, you start your program in the debugger, set _crtBreakAlloc to that number, then run your program. The debugger will break when the memory is allocated that you have forgotten to free. Very very handy.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Hi all,
Q1.
I can convert LPSTR to LPWSTR:
USES_CONVERSION;
LPWSTR lp1 = A2W(szString);
Is any other way to convert LPSTR to LPWSTR ???
Q2.
What is difference between E_FAIL and S_FALSE ???
Thanks for helps ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
something like:
wchar_t* AmA2W(const char *s)
{
int clen = strlen(s);
wchar_t *w = (wchar_t*)calloc(clen + 1, sizeof(wchar_t));
MultiByteToWideChar(CP_ACP, 0, s, clen, w, clen);
return w;
}
Just remember to manually free the returned string.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi Molin,
About, fifth parameter in MultiByteToWideChar ...
If i put -1 instead w, then what will happen ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I guess the function will fail. The fifth parameter is a wide-character buffer...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
|
|
sytem environment:vc6 sp6,win2000 sp2
WINDOWINFO wi;
::GetWindowInfo(m_hWnd,&wi);
error:
C2065: 'WINDOWINFO' : undeclared identifier
C2146: syntax error : missing ';' before dentifier 'wi'
C2065: 'wi' : undeclared identifier
C2039: 'GetWindowInfo' : is not a member of '`global namespace''
C2065: 'GetWindowInfo' : undeclared identifier
|
|
|
|
|
You need to install the platform SDK to use this function, according to the MSDN.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
|
Thanks, All OK!
|
|
|
|
|
I have a plot which uses some line routines of the device context. Lines may be drawn (in some scale) from one point outside the visible area to another. When I draw in my window it automatically clips all lines outside certain client area. When I use the same drawing routine in printing, lines are cut only in the borders of the paper.
For this clipping SelectClipRgn may be used. However, it works improperly in preview mode.
Does anybody know the way to fix clipping?
Andrei the Adroit
|
|
|
|
|
Dear Sirs,
I wish to create a grid within an application that has a variable name on the left hand side and a value on the right that can be edited. Are there any ActiveX controls that I can use for this?
Regards
|
|
|
|