|
|
Perfect! It worked great, but I realized that it would better fit my needs to use PostMessage, and now it doesn't work. So what's the difference between the way they are called then, they look awfully similar to me.
Thanks
John
|
|
|
|
|
PostMessage() puts the message in the windows message queue and then returns, no processing of the message is performed before the window's message pump gets to run. With SendMessage() you "forces" the imidiate processing of the message so the message is processed *before* SendMessage() returns. SendMessage() isn't usually a good idea since you can get weird recursive effects if you arn't careful. The most common problem people seem to have with PostMessage() is that they are passing pointers to stack-allocated objects which goes out of scope (are destroyed) before the window procedure gets hold of the pointer... As always, mind your allocations.
|
|
|
|
|
Is there a speed penalty for using standard RTTI?
Just curious.
Steve
|
|
|
|
|
What do you mean by 'using standard RTTI'? Just turning on the compiler option or actually calling dynamic_cast?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
When using a IntelliMouse in a Visual c++ application how do you make the middle wheel
act like the other two mouse buttons ? When I am in a window
with a scrollbar if I click the middle wheel it goes into autoscroll mode. I want
to override this feature and make the middle mouse wheel act like the other two
mouse buttons so I can have it perform a different operation.
|
|
|
|
|
G'day Dawn.
You do this by overriding WM_MBUTTONDOWN/WM_MBUTTONUP
The class wizard does not give you these messages, but you can copy the code in your header and cpp file ( don't forget the code at the top of the .cpp ) and change the L or R to an M.
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 am assigning CString, long and Int variables to ODBC recordset variables. When I try to update the database, the CStrings are updated, however, the Longs and the Ints are not. Has anyone else had this problem? If so, can you help?
Thank you.
Louise
|
|
|
|
|
This has been driving me nuts for two days - anyone know how to do it?
The first way I thought of doing it was getting the select text position - this works if text is selected - but not if no text is selected
Cheers,
Peter
|
|
|
|
|
Maybe you can use GetCaretPos().
/Per
|
|
|
|
|
LOL
Didn't think it would be a base class CWnd function.
Thanks!
Cheers,
Peter
|
|
|
|
|
Hi,
I'm trying to implement a drag drop within my MFC, MDI based app.
I have a CTreeView derived view, and I've implemented drag drop with it. I want the user to be able to drag treeview items and drop them on another window in my application.
I haven't implemented everything yet, but I'm taking it step by step. Here's what I've done
1. Handled the TreeView notification TVN_BEGINDRAG. Used the TreeCtrl to create a drag image list, done a BeginDrag and a DragEnter, set a member pointer to this window (m_p_wndDragSrc) in my main frame, and then SetCapture() in the main frame, my CMDIFrame derived window...
2. The CMDIFrame window handles WM_MOUSEMOVE to update the imagelist/pointer location.
That much all works fine.
What I want to happen is that when a drag starts, if the cursor is moved over a different child window in the main frame, that window should be brought to the front.
I've tryed code like this in the CMainFrame::OnMouseMove function:
CWnd *p_wndUnderPoint=ChildWindowFromPoint(point);if (p_wndUnderPoint && (p_wndUnderPoint != this)) p_wndUnderPoint->SetFocus();
Unfortunately, this doesn't do anything. I've tryed all sorts of possible CWnd:: functions, like SetFOcus, BringWindowToTop and so on. But none of them have the desired effect.
Can anyone give me some pointers? (pun. bad one. sorry)
|
|
|
|
|
After I press down the left button ,I don't know what can I do to make My Window get the Mouse events,Unless I release the button.
datablader
|
|
|
|
|
Hi,
With the version of IE5.0. We get the IHTMLElement "FRAME" as the active element after calling get_activeElement() function from top document even if the active element is a control or something other than the frame itself.
Does anyone know how to get this active element?
Oguzhan...
|
|
|
|
|
I have an ActiveX control type:Microsoft Web Browser and i want to
disable copy can anybody help me ?
|
|
|
|
|
Hi,
can anyone help, I'm trying to add help to a property sheet (just the plain button to side of the OK/Cancel buttons) and I've done the following:
(in prop-sheet constructor)
m_psh.dwFlags |= (PSH_NOAPPLYNOW | PSH_HASHELP);
(in prop-page OnInitDlg (tried both before and after call to base class))
m_psp.dwFlags |= PSP_HASHELP;
Added a handler for the ID_HELP called OnHelp in the prop-page class.
My problem is, the button is *always* disabled... is there something else I have to do? the help seems quite bad in this area!
Regards,
Ray
|
|
|
|
|
You should handle WM_HELPINFO (not ID_HELP) in the property page class.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I was indeed using ID_HELP, but can not use WM_HELPINFO since it doesn't seem to be defined. I tried, for completeness, WM_HELP but I'm still in the "disabled" situation.
Any other ideas?
Regards,
Ray
|
|
|
|
|
can not use WM_HELPINFO since it doesn't seem to be defined.
What do you mean? Are you getting a compiler error?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
That seemed to be the case, but I've now used the ClassWizard to put in a handler ( which was done as ON_WM_HELPINFO() rather than an ON_COMMAND(WM_HELPINFO,OnHelp) as I'd added by hand. )
It still, however, is not enabled when I run the application. Do I need any enabler handlers?
Regards,
Ray
|
|
|
|
|
|
Thanks Tomasz,
whilst I'm sure I'm doing more than I need to do, the following seemed to get things working for me.
1) setting the psp flags within the constructor (not OnInitDialog)
2) adding the WM_HELP handler (called WM_HELPINFO from ClassWizard)
3) adding an ON_BTN_CLICKED handler for ID_HELP.
Seems more work than I thought, but works a charm.
Thanks for your input.
Regards,
Ray
|
|
|
|
|
Hi,
Can anyone point me in the right direction of creating an app with an embedded word document.
I don't know where to start.
Cheers
Rich
|
|
|
|
|
Hello!!
I am writing a TAPI program in which there are two appliations.One for the server and one for the client.
When I am dialing from the client it reaches the server and then the server calls lineAccept(). The lineAccept also succeeds. It then goes to LINE_REPLY of teh server and it gives error there i.e the dwParm2 value is negative... The dwParam1 paramater(dwrequestID) of the lineCallBackFunc is same as the return value of the lineAccept().
The error is LINEERR_OPERATIONUNAVAIL which means:
The operation is not available, such as for the given device or specified line.
We have no idea as to why this error is occuring..
Please help..
Sandeep
|
|
|
|
|
Hi!
I am a newbie, and trying to to some very simple VisualC++ stuff. I have a bit of a newbie question regarding updating of a windows client area when the window has been, for instance, covered by another window or minimized/restored.
I am putting pixels on the client area via the windows dc using the CDC::SetPixel(...). When all pixels are put, I would think they are stored somewhere for Windows to automatically redraw the client area when needed. Am I wrong?
Or must I create my own place for the pixels (like a CBitmap?) and try to re-display the bitmap in a OnPaint message handler (or another propriate handler)? Or what need I do?
I am not using the Doc/View architecture (if that would have taken care of this for me), only a simple CFrameWnd derived window.
Would be very grateful for any input!
|
|
|
|