|
You're comparing an HWND with a C++ object pointer, which obviously aren't the same creatures. Do something like:
if ( (HWND)lParam == slider->m_hWnd )
--Mike--
http://home.inreach.com/mdunn/
This posting is provided "as was" with no warranties, guarantees, lotteries, or any of those little bags of peanuts you get on planes. You assume all risk for crossing the street without holding mommy's hand. © 2001 Mike's Classy Software. Member FDIC. If rash develops, discontinue use.
your with and
|
|
|
|
|
Thanks, that did the trick.
Cheers,
Clint
|
|
|
|
|
Just for my own info, does that mean that dereferencing the slider * wouldn't result in a HWND ? I'm writing my own control classes at the moment and all have operator HWND defined, I'm surprised at the possibility that the M$ classes don't do the same thing ?
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.
|
|
|
|
|
When we dereference the pointer all we get is the pointer to the object it self - not the m_hWnd that it contains. You could get the hWnd when you call the create function ie.
CTrackbarCtrl *tb;
HWND hwnd;
hwnd = tb->Create(...);
but that means you would have to carry around two variables when the hwnd is already being carried around in the class provided by WTL.
Cheers,
Clint
|
|
|
|
|
So WTL doesn't offer operator HWND on these items, nor does it have a m_hWnd variable ? I find that highly unlikely.
I've just had a look at the WTL source, and they do indeed keep the HWND as a variable called m_hWnd, so that is what you need.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Hey Guys
When i try and use this function
CertGetNameString()
i get a undeclared identifier message when i compile yet msdn says this is defined in wincrypt.h which i have included has anyone got any ideas
peter
|
|
|
|
|
As this function requires Windows 98/ME, I'd say for sure to get access to it you'll need to install the Platform SDK.
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.
|
|
|
|
|
A co-worker and I were having a discussion about what sync object to use for a particular case. The senerio is as follows:
Read an item from a list
Write data to a device, using a sperate thread
Wait for write to complete
Repeat until list is complete
He designed the above to use a semaphore where I pointed out that an event would be more appropriate in this case. His arguement was that there was no difference in the how the two were created, used, etc. He could not seem to handle the statement "why have two objects to do the same thing".
Could anyone comment on the overhead, resource usage, etc. of the two objects.
|
|
|
|
|
I've a control that is used to update real-time stock quotes. The control uses the CMemDC class to draw to avoid the flickering but i still see the control flicker. Essentially, the drawing code looks like this (borrowed the technique from Chris' Grid control)
XYZControl::OnPaint()
{
CPaintDC dc(this);
if (m_bDoubleBuffer)
{
CMemDC memDC(&dc);
OnDraw(&memDC);
}
else
OnDraw(&dc);
}
XYZControl::OnDraw(CDC* pDC)
{
}
One interesting thing that i noticed while debugging was that the GetClipBox() call in MemDC contructor returns a empty rectangle. Suspecting this could mean trouble? Any thoughts on what should i check/verify?
Thanks
Chen Venkataraman
|
|
|
|
|
|
Shouldn't that be TRUE? Here's the snippet from MSDN for WM_ERASEBKGND :
<br />
An application should return nonzero in response to WM_ERASEBKGND if it processes the message and erases the background; this indicates that no further erasing is required. If the application returns zero, the window will remain marked for erasing. (Typically, this indicates that the fErase member of the PAINTSTRUCT structure will be TRUE.)<br />
Anyway, I've handled the WM_ERASEBKGND message & returned both FALSE & TRUE but it appears that it doesn't matter - the control still flickers.
Chen Venkataraman
|
|
|
|
|
Returning FALSE follows the MSDN docs - after all, you do not erase the background just by returning FALSE from the empty handler.
BTW: Use GetClipBox with a paint DC, not with a memory DC.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
The way I always did this was to draw the control to a memory DC, THEN call CPaintDC, THEN draw the control. CPaintDC causes the area to be erased, although it is reasonable to suggest that overriding OnEraseBackground to not call the parent method would solve this also.
When you overrode WM_ERASEBACKGROUND, did you still call the base method ? If so, don't if you don't want the background erased.
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.
|
|
|
|
|
Hello,
As a part of the college lab work I have to write a client and a server using MFC. The prof explained the whole stuff briefly, and I recall him having talked about threads etc. The client/server have to use the UDP protocol and be able to transfer files (even big ones).
Can someone tell me how to do this? or where I can find relevant resources? I dont know how to analyse the problem.
Thanks,
Mike
|
|
|
|
|
|
Hi, does anybody know how can I hide the main frame in a MDI app?? Tnx
|
|
|
|
|
|
|
It works for me. Are you sure you're calling ShowWindow(SW_HIDE) for main frame?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Sorry I think I made the wrong answer. It's there any way to hide the main frame, and show the child frame at the same time?
|
|
|
|
|
Because the child frame is a *child* of the main window, I believe hiding the main window will hide the child. However, if you resize the main window to 1x1 pixel and put it at -100, -100, it's very rare for the multimonitor setup to exist that will see your one pixel window. Just store the CRect the window takes up first so you can restore it.
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.
|
|
|
|
|
I'm writing Client & Server program, i'm using ADO ...
If i wanna write program on the Client computer, i must add this line to my source code ?
pRecordset->CursorLocation = adUseClient;
Is that necessery ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Yes, if you are using a access Database, but if you are using a SQL Server I saw that the bookmarks and absolute positions don't works if you dont use that parameter.
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
I got your mean about Access database ...
But i didn't understand your mean about SQL Server database, you mean if i uss SQL Server database, If i use CursorLocation or i don't use CursorLocation in my program, result is equal ?
Is it right ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have a pointer to a CButton -derived object that is assigned using GetDlgItem (though I have tried using FromHandle and FromHandlePermanent ).
Any ideas why sometimes (in a release build) the m_pCtrlSite member of CCmdTarget gets set to 1? I think it should be NULL unless it is something to do with an ActiveX control, which it isn't.
This is causing my subsequent call to EnableWindow to fail because inside the CWnd calls it checks m_pCtrlSite for NULL , which it isn't if it's 1. But trying to dereference it (as in the CWnd ) casues an obvious access violation.
Derek Lakin.
Salamander Software Ltd.
|
|
|
|