New to C++. 1 or 2 Q's
OK, Been programming in BASIC, VB, Clipper, Dbase, 6809E asembler, 8088 assembler since 79 and through the years tried to get going on C++. I always seem to get stuck getting a handle on what libraries I need to include to get even the most basic things going.
Well, guess what.. I can draw stupid little circles and stuff, do drop down menus and dialog boxes, but do you think I can get a handle on the mouse so I can track it's position at any given moment? Noooo way.
I've got my message handler all set up and ready for the WM_MOUSEMOVE message but havn't got the foggiest where to get the pointer location from.
Once I get it, I'm just gonna spit it back out next to the mouse pointer for a simple excersize. My simple windows program only carries the window.h library.
Not looking for masses of code here, just enough to get me over this hump.
x = LOWORD (lParam) ;
y = HIWORD (lParam);
P.S. Goto this site. It has a bunch of books in it. Under the C/C++ section, there is an older version of Programming Windows by Petzold. You will learn a great deal from reading that book.
When processing your WN_MOUSEMOVE message you need to check the LPARAM passed to your WndProc callback. The least significant 2 bytes specific the horizontal posistion and the most significant 2 bytes specifiy the vertical. You can use the pre-defined HIWORD and LOWORD macros to separate the co-ords if neccessary, or GET_X_LPARAM and GET_Y_LPARAM macros to be extra portable.
Well you both added great info that helped me past that hurtle. so I threw this together.
The TextOut line actually lives in my WM_PAINT message handler not in my WM_MOUSEMOVE. However, "Test" only seems to print in the upper left corner and then that's it.
Now, the reason I'm not trying to print convertedX or convertedY was because I actually did try and it didn't work so I was doing the old "baby steps" thing.
I tried reming out ValidateRect with no change in effect, so I'm stumped. There's only 200 pages left in my 980 page book and I've read EVERY page. I'd expect to be doing better then this..:(
My only guess is that there is some kind of redraw not happening or being inhibited.
Hey golfinguy.. Thanks for the book recommendation and the site. I checked out the book you suggested and it looks like it's got a tone a fantastic info.
There's also windows programming forum at this site, might find more answers there.