Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Problem with WM_MOUSEMOVE

michael_green
Beginner
973 Views
I have a toolbar created thus:

hwndTB = CreateToolbarEx(hWnd,IOR(WS_CHILD,IOR &(WS_CLIPSIBLINGS,IOR &(TBSTYLE_TOOLTIPS,WS_BORDER))),IDR_Toolbar1,1,ghInstance, &
IDR_Toolbar1,TBbutton(1),0,0,0,16,15,20)

And on the toolbar I have an edit box created thus:

hWndCovEdit = CreateWindowEx(0,"edit"C,""C,IOR(WS_CHILD,IOR(WS_VISIBLE,WS_BORDER)), &
170,2,55,20,hwndTB,IDC_CovEdit,ghinstance,Null)

The screen displays a map, and when the user moves the mouse, the edit box displays the real-world location. In order to do this I am sending a meesage to the edit box:

iret = SendMessage(hWndCovEdit,WM_SETTEXT,0,loc(string))

Everything works fine on the first call of this routine, but I cannot get the location display to work in any subsequent call. I have debugged it to the extent I can see that the message to the edit box is being sent at the right time with the right text, but the edit box appears frozen in some way. I guess something is missing but I have no idea what. Any suggestions?

With many thanks in advance,

Mike
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
973 Views
If I may immodestly call myself competent on the subject, I've gotno idea. SendMessage(WM_SETTEXT) should succeed under any circumstances that I can think of, provided window handle is valid.
I'd suggest using Spy++ to see which messages are sent to the edit box and what's the text of the edit control.
Also, I'd recommend also WS_CLIPCHILDREN for the toolbar. If youneed to catch EN_* messages (tohandle user-typing in the edit box), you should add WS_EX_CONTROLPARENT to the toolbar as well, so that you can catch them in MainWndProc, without having to subclass the toolbar -- but I don't think it's related with your problem.
Jugoslav
0 Kudos
michael_green
Beginner
973 Views
Jugoslav,

Thankyou for your reply. I am embarassed to have to admit that the error was caused by my creating a new toolbar each time I entered the routine ...

But I learnt some things from your reply, especially about Spy++ - I had never heard of it. I have tried it, with limited success, and realise how useful it could be if I only knew how to use it properly. On-line help does not seem to be very helpful. Is there somewhere I can find out more about this?

Many thanks again,

Mike
0 Kudos
Reply