WM_MOUSEWHEEL

WM_MOUSEWHEEL

Anonymous
Not applicable
1,876 Views
15 Replies
Message 1 of 16

WM_MOUSEWHEEL

Anonymous
Not applicable
I'm hooking into the windows messaging in my ARX app, and i'm catching the
WM_MOUSEWHEEL message. If i return 'false', then AutoCAD interprets this
message as a zooming function. However, if i catch the message and return
'true', AutoCAD does not zoom, and it scrolls the current document instead.
How do i avoid doing either? I would like to catch the message, process it,
and have AutoCAD do nothing. Do i have to catch another message other than
just WM_MOUSEWHEEL? Thanks...
0 Likes
1,877 Views
15 Replies
Replies (15)
Message 2 of 16

Anonymous
Not applicable
I figured this was going to get confusing if i was responding to several
different branches in the thread here, so i decided to start fresh down
here!

Ok, here's the deal. I tried subclassing the main window, which didn't
work. However, when i subclass the document window i can get it to function
as expected. Sort of. See, the WM_MOUSEWHEEL message seems to be followed
by a bunch of WM_VSCROLL messages. Actually, sometimes it looks like
WM_VSCROLL comes BEFORE the WM_MOUSEWHEEL messages, which is confusing to me
(i'm just using acutPrintf( ) to print out info when i receive either of
those messages right now). So, if i trap BOTH the WM_MOUSEWHEEL and
WM_VSCROLL, i can get it to do what i want! However, this is clearly not a
good idea, since the user will not be able to actually scroll! I was
thinking that perhaps i could check the queue of messages somehow? (I
started windows programming less than a year ago - i'm not even sure how to
go about this...) Maybe i could ignore or remove all WM_VSCROLL messages
while there's a WM_MOUSEWHEEL message in the queue? We're so close here...

Thanks for all the help guys, and i'd appreciate any ideas you might have...



"Justavian" wrote in message
news:[email protected]...
> I'm hooking into the windows messaging in my ARX app, and i'm catching the
> WM_MOUSEWHEEL message. If i return 'false', then AutoCAD interprets this
> message as a zooming function. However, if i catch the message and return
> 'true', AutoCAD does not zoom, and it scrolls the current document
instead.
> How do i avoid doing either? I would like to catch the message, process
it,
> and have AutoCAD do nothing. Do i have to catch another message other
than
> just WM_MOUSEWHEEL? Thanks...
>
>
0 Likes
Message 3 of 16

Anonymous
Not applicable
> We're so close here...

Why don't you post your code here so we can see exactly what you're doing?
:)
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
0 Likes
Message 4 of 16

Anonymous
Not applicable
Hi!

if you want it to be ignored altogether, simply set the message to 0.

I hope this helps!
Fenton Webb
Developer Technical Services
autodesk

"Justavian" wrote in message
news:[email protected]...
> I'm hooking into the windows messaging in my ARX app, and i'm catching the
> WM_MOUSEWHEEL message. If i return 'false', then AutoCAD interprets this
> message as a zooming function. However, if i catch the message and return
> 'true', AutoCAD does not zoom, and it scrolls the current document
instead.
> How do i avoid doing either? I would like to catch the message, process
it,
> and have AutoCAD do nothing. Do i have to catch another message other
than
> just WM_MOUSEWHEEL? Thanks...
>
>
0 Likes
Message 5 of 16

Anonymous
Not applicable
Yeah, i thought that would work too, but it doesn't. I tried setting the
entire MSG pointer to NULL, i tried manipulating the WPARAM to say that the
wheel rotated 0, instead of the 120 or -120 you would normally expect. I
also started to play with the LPARAM, but at that point i figured it was
probably pointless, since it seems to be processing some other message if
the WM_MOUSEWHEEL is not processed. The only thing i seem to be able to
affect is whether AutoCAD reads the mouse wheel as a zoom, or a scroll!
Actually, if i move my mouse over to the edge of the screen, it works - the
document doesn't scroll and i can process the WM_WHEELMOUSE properly.
Anytime the mouse is on the drawing itself though - it either scrolls or
zooms depending on how i set the values mentioned above. I tried to hook
the VM_SCROLL, figuring that somehow that message was getting sent, but that
message was never called. I'm sort of at a loss here. Is there a way i can
analyze all the messages coming in?

"Fenton Webb (Autodesk)" wrote in message
news:[email protected]...
> Hi!
>
> if you want it to be ignored altogether, simply set the message to 0.
>
> I hope this helps!
> Fenton Webb
> Developer Technical Services
> autodesk
>
> "Justavian" wrote in message
> news:[email protected]...
> > I'm hooking into the windows messaging in my ARX app, and i'm catching
the
> > WM_MOUSEWHEEL message. If i return 'false', then AutoCAD interprets
this
> > message as a zooming function. However, if i catch the message and
return
> > 'true', AutoCAD does not zoom, and it scrolls the current document
> instead.
> > How do i avoid doing either? I would like to catch the message, process
> it,
> > and have AutoCAD do nothing. Do i have to catch another message other
> than
> > just WM_MOUSEWHEEL? Thanks...
> >
> >
>
>
0 Likes
Message 6 of 16

Anonymous
Not applicable
Hi again!

well, here's my code that worked...



acedRegisterFilterWinMsg (ArxWinHookFct) ;

BOOL ArxWinHookFct (MSG *pMsg)
{
// Return TRUE to destroy the message
if (pMsg->message == WM_MOUSEWHEEL)
{
// clear the message
pMsg->message = 0;
}
return (FALSE) ;
}


CHeers
Fenton Webb
Developer Technical Services
autodesk

"Justavian" wrote in message
news:[email protected]...
> Yeah, i thought that would work too, but it doesn't. I tried setting the
> entire MSG pointer to NULL, i tried manipulating the WPARAM to say that
the
> wheel rotated 0, instead of the 120 or -120 you would normally expect. I
> also started to play with the LPARAM, but at that point i figured it was
> probably pointless, since it seems to be processing some other message if
> the WM_MOUSEWHEEL is not processed. The only thing i seem to be able to
> affect is whether AutoCAD reads the mouse wheel as a zoom, or a scroll!
> Actually, if i move my mouse over to the edge of the screen, it works -
the
> document doesn't scroll and i can process the WM_WHEELMOUSE properly.
> Anytime the mouse is on the drawing itself though - it either scrolls or
> zooms depending on how i set the values mentioned above. I tried to hook
> the VM_SCROLL, figuring that somehow that message was getting sent, but
that
> message was never called. I'm sort of at a loss here. Is there a way i
can
> analyze all the messages coming in?
>
> "Fenton Webb (Autodesk)" wrote in message
> news:[email protected]...
> > Hi!
> >
> > if you want it to be ignored altogether, simply set the message to 0.
> >
> > I hope this helps!
> > Fenton Webb
> > Developer Technical Services
> > autodesk
> >
> > "Justavian" wrote in message
> > news:[email protected]...
> > > I'm hooking into the windows messaging in my ARX app, and i'm catching
> the
> > > WM_MOUSEWHEEL message. If i return 'false', then AutoCAD interprets
> this
> > > message as a zooming function. However, if i catch the message and
> return
> > > 'true', AutoCAD does not zoom, and it scrolls the current document
> > instead.
> > > How do i avoid doing either? I would like to catch the message,
process
> > it,
> > > and have AutoCAD do nothing. Do i have to catch another message other
> > than
> > > just WM_MOUSEWHEEL? Thanks...
> > >
> > >
> >
> >
>
>
0 Likes
Message 6 of 16

Anonymous
Not applicable
You need to subclass the AutoCAD main window and handle the WM_MOUSEWHEEL
message yourself without passing it on to the previous message handler.
Take a look at ChangeAcadTitle.zip on my freebies page
(<>) for example
code that subclasses the AutoCAD main window (the sample is for R14, but the
same approach works in later versions). 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
0 Likes
Message 8 of 16

Anonymous
Not applicable
For whatever reason, that doesn't work for me. Even when i set the message
to zero. I tried returning false and true, and either way it continues to
process the message. If i clear it like that, though, it does the scroll,
instead of zooming....

"Fenton Webb (Autodesk)" wrote in message
news:[email protected]...
> Hi again!
>
> well, here's my code that worked...
>
>
>
> acedRegisterFilterWinMsg (ArxWinHookFct) ;
>
> BOOL ArxWinHookFct (MSG *pMsg)
> {
> // Return TRUE to destroy the message
> if (pMsg->message == WM_MOUSEWHEEL)
> {
> // clear the message
> pMsg->message = 0;
> }
> return (FALSE) ;
> }
>
>
> CHeers
> Fenton Webb
> Developer Technical Services
> autodesk
>
> "Justavian" wrote in message
> news:[email protected]...
> > Yeah, i thought that would work too, but it doesn't. I tried setting
the
> > entire MSG pointer to NULL, i tried manipulating the WPARAM to say that
> the
> > wheel rotated 0, instead of the 120 or -120 you would normally expect.
I
> > also started to play with the LPARAM, but at that point i figured it was
> > probably pointless, since it seems to be processing some other message
if
> > the WM_MOUSEWHEEL is not processed. The only thing i seem to be able to
> > affect is whether AutoCAD reads the mouse wheel as a zoom, or a scroll!
> > Actually, if i move my mouse over to the edge of the screen, it works -
> the
> > document doesn't scroll and i can process the WM_WHEELMOUSE properly.
> > Anytime the mouse is on the drawing itself though - it either scrolls or
> > zooms depending on how i set the values mentioned above. I tried to
hook
> > the VM_SCROLL, figuring that somehow that message was getting sent, but
> that
> > message was never called. I'm sort of at a loss here. Is there a way i
> can
> > analyze all the messages coming in?
> >
> > "Fenton Webb (Autodesk)" wrote in message
> > news:[email protected]...
> > > Hi!
> > >
> > > if you want it to be ignored altogether, simply set the message to 0.
> > >
> > > I hope this helps!
> > > Fenton Webb
> > > Developer Technical Services
> > > autodesk
> > >
> > > "Justavian" wrote in message
> > > news:[email protected]...
> > > > I'm hooking into the windows messaging in my ARX app, and i'm
catching
> > the
> > > > WM_MOUSEWHEEL message. If i return 'false', then AutoCAD interprets
> > this
> > > > message as a zooming function. However, if i catch the message and
> > return
> > > > 'true', AutoCAD does not zoom, and it scrolls the current document
> > > instead.
> > > > How do i avoid doing either? I would like to catch the message,
> process
> > > it,
> > > > and have AutoCAD do nothing. Do i have to catch another message
other
> > > than
> > > > just WM_MOUSEWHEEL? Thanks...
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes
Message 8 of 16

Anonymous
Not applicable
It sounds like he needs to subclass the document window instead.
Any messages you don't want AutoCAD to handle return NULL.

Paul Kohut


"Owen Wengerd" wrote in message
news:[email protected]...
> You need to subclass the AutoCAD main window and handle the
WM_MOUSEWHEEL
> message yourself without passing it on to the previous message handler.
> Take a look at ChangeAcadTitle.zip on my freebies page
> (<>) for example
> code that subclasses the AutoCAD main window (the sample is for R14, but
the
> same approach works in later versions). 🙂
> --
> Owen Wengerd
> President, ManuSoft ==> http://www.manusoft.com
> VP Americas, CADLock, Inc. ==> http://www.cadlock.com
>
0 Likes
Message 10 of 16

Anonymous
Not applicable
FWIW, I believe this is by design in Windows so that applications written
before mice had wheels can handle the mouse wheel through their default
scroll handlers. Some mouse drivers override this behavior but that's the
general idea...

What's your goal with disabling the mouse wheel (I personally would find
that very irritating) 🙂

|
----+----------------------------------------------
| Byron Blattel
| CADwerx---Applications for AutoCAD
| Autodesk Registered Developer
| email: [email protected]
| web site: http://www.cadwerx.net
|
0 Likes
Message 11 of 16

Anonymous
Not applicable
I'm giving the user the ability to rotate objects that they've picked up. I
have various "modes" of my application that alter the default way AutoCAD
processes points. This is one of those modes - it figures out where the
user clicks, and whether it's on or inside the bounds of an object. If it
is, then it "picks it up." When the user clicks somewhere else in the
drawing, it will set it down. During the time the object is "picked up",
the user can rotate the object by moving the mouse wheel. This DOES work
right now, it's just that we have the additional movement of the screen -
either the scroll or pan.


My code is essentially just like the example provided by Owen Wengerd,
except that i'm now sublassing the document window, as was recommended:

Here are the variables i'm using:
WNDPROC g_wprocAcad = NULL; //The original AutoCAD window procedure
HWND g_hwndAcad = adsw_acadDocWnd(); //Store the AutoCAD document window

Here's my function prototype:
LRESULT CALLBACK AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM wParam,
LPARAM lParam );

Then in my entry point i register my new windows message proc:
g_wprocAcad = (WNDPROC)::SetWindowLong(
g_hwndAcad,GWL_WNDPROC,(LONG)AcadWndProcHook );


And then here's my actual function, which at this piont does essentially
nothing, except printing out that it received scroll and mouse wheel
messages:
LRESULT CALLBACK
AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
{
CString a;
a.Format("\nGot the following message: %d",iMsg);
//acutPrintf(a);

//Here we just process all the window messages that are on their
//way to the AutoCAD main window.
switch( iMsg )
{
case WM_VSCROLL:
acutPrintf("\nScroll");
return 0;

case WM_MOUSEWHEEL:
acutPrintf("\nMouse Wheel");
return 0;
}

//Now pass the message to the original window procedure
return ::CallWindowProc( g_wprocAcad, hwnd, iMsg, wParam, lParam );
}



"Byron Blattel" wrote in message news:E9E118F70A2EB35296
[email protected]...
> FWIW, I believe this is by design in Windows so that applications written
> before mice had wheels can handle the mouse wheel through their default
> scroll handlers. Some mouse drivers override this behavior but that's the
> general idea...
>
> What's your goal with disabling the mouse wheel (I personally would find
> that very irritating) 🙂
>
> |
> ----+----------------------------------------------
> | Byron Blattel
> | CADwerx---Applications for AutoCAD
> | Autodesk Registered Developer
> | email: [email protected]
> | web site: http://www.cadwerx.net
> |
>
>
>
0 Likes
Message 12 of 16

Anonymous
Not applicable
Got it.

What happens if you disable AutoCAD's scroll bars in the preferences (should
be the default IMO)?

You might also try getting the scroll bars themselves and hooking them...

|
----+----------------------------------------------
| Byron Blattel
| CADwerx---Applications for AutoCAD
| Autodesk Registered Developer
| email: [email protected]
| web site: http://www.cadwerx.net
|

"Justavian" wrote in message
news:[email protected]...
> I'm giving the user the ability to rotate objects that they've picked up.
I
> have various "modes" of my application that alter the default way AutoCAD
> processes points. This is one of those modes - it figures out where the
> user clicks, and whether it's on or inside the bounds of an object. If it
> is, then it "picks it up." When the user clicks somewhere else in the
> drawing, it will set it down. During the time the object is "picked up",
> the user can rotate the object by moving the mouse wheel. This DOES work
> right now, it's just that we have the additional movement of the screen -
> either the scroll or pan.
>
>
> My code is essentially just like the example provided by Owen Wengerd,
> except that i'm now sublassing the document window, as was recommended:
>
> Here are the variables i'm using:
> WNDPROC g_wprocAcad = NULL; //The original AutoCAD window procedure
> HWND g_hwndAcad = adsw_acadDocWnd(); //Store the AutoCAD document
window
>
> Here's my function prototype:
> LRESULT CALLBACK AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM wParam,
> LPARAM lParam );
>
> Then in my entry point i register my new windows message proc:
> g_wprocAcad = (WNDPROC)::SetWindowLong(
> g_hwndAcad,GWL_WNDPROC,(LONG)AcadWndProcHook );
>
>
> And then here's my actual function, which at this piont does essentially
> nothing, except printing out that it received scroll and mouse wheel
> messages:
> LRESULT CALLBACK
> AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
> {
> CString a;
> a.Format("\nGot the following message: %d",iMsg);
> //acutPrintf(a);
>
> //Here we just process all the window messages that are on their
> //way to the AutoCAD main window.
> switch( iMsg )
> {
> case WM_VSCROLL:
> acutPrintf("\nScroll");
> return 0;
>
> case WM_MOUSEWHEEL:
> acutPrintf("\nMouse Wheel");
> return 0;
> }
>
> //Now pass the message to the original window procedure
> return ::CallWindowProc( g_wprocAcad, hwnd, iMsg, wParam, lParam );
> }
0 Likes
Message 13 of 16

Anonymous
Not applicable
> What happens if you disable AutoCAD's scroll bars in the preferences
(should
> be the default IMO)?

Good call. How do i do that?



>
> You might also try getting the scroll bars themselves and hooking them...
>
> |
> ----+----------------------------------------------
> | Byron Blattel
> | CADwerx---Applications for AutoCAD
> | Autodesk Registered Developer
> | email: [email protected]
> | web site: http://www.cadwerx.net
> |
>
> "Justavian" wrote in message
> news:[email protected]...
> > I'm giving the user the ability to rotate objects that they've picked
up.
> I
> > have various "modes" of my application that alter the default way
AutoCAD
> > processes points. This is one of those modes - it figures out where the
> > user clicks, and whether it's on or inside the bounds of an object. If
it
> > is, then it "picks it up." When the user clicks somewhere else in the
> > drawing, it will set it down. During the time the object is "picked
up",
> > the user can rotate the object by moving the mouse wheel. This DOES
work
> > right now, it's just that we have the additional movement of the
screen -
> > either the scroll or pan.
> >
> >
> > My code is essentially just like the example provided by Owen Wengerd,
> > except that i'm now sublassing the document window, as was recommended:
> >
> > Here are the variables i'm using:
> > WNDPROC g_wprocAcad = NULL; //The original AutoCAD window procedure
> > HWND g_hwndAcad = adsw_acadDocWnd(); //Store the AutoCAD document
> window
> >
> > Here's my function prototype:
> > LRESULT CALLBACK AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM
wParam,
> > LPARAM lParam );
> >
> > Then in my entry point i register my new windows message proc:
> > g_wprocAcad = (WNDPROC)::SetWindowLong(
> > g_hwndAcad,GWL_WNDPROC,(LONG)AcadWndProcHook );
> >
> >
> > And then here's my actual function, which at this piont does essentially

> > nothing, except printing out that it received scroll and mouse wheel
> > messages:
> > LRESULT CALLBACK
> > AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
> > {
> > CString a;
> > a.Format("\nGot the following message: %d",iMsg);
> > //acutPrintf(a);
> >
> > //Here we just process all the window messages that are on their
> > //way to the AutoCAD main window.
> > switch( iMsg )
> > {
> > case WM_VSCROLL:
> > acutPrintf("\nScroll");
> > return 0;
> >
> > case WM_MOUSEWHEEL:
> > acutPrintf("\nMouse Wheel");
> > return 0;
> > }
> >
> > //Now pass the message to the original window procedure
> > return ::CallWindowProc( g_wprocAcad, hwnd, iMsg, wParam, lParam );
> > }
>
>
>
0 Likes
Message 14 of 16

Anonymous
Not applicable
I'd try it manually first. It's on the Display tab under Windows Elements.

--
|
----+----------------------------------------------
| Byron Blattel
| CADwerx---Applications for AutoCAD
| Autodesk Registered Developer
| email: [email protected]
| web site: http://www.cadwerx.net
|

"Justavian" wrote in message
news:[email protected]...
> > What happens if you disable AutoCAD's scroll bars in the preferences
> (should
> > be the default IMO)?
>
> Good call. How do i do that?
>
>
>
> >
> > You might also try getting the scroll bars themselves and hooking
them...
> >
> > |
> > ----+----------------------------------------------
> > | Byron Blattel
> > | CADwerx---Applications for AutoCAD
> > | Autodesk Registered Developer
> > | email: [email protected]
> > | web site: http://www.cadwerx.net
> > |
> >
> > "Justavian" wrote in message
> > news:[email protected]...
> > > I'm giving the user the ability to rotate objects that they've picked
> up.
> > I
> > > have various "modes" of my application that alter the default way
> AutoCAD
> > > processes points. This is one of those modes - it figures out where
the
> > > user clicks, and whether it's on or inside the bounds of an object.
If
> it
> > > is, then it "picks it up." When the user clicks somewhere else in the
> > > drawing, it will set it down. During the time the object is "picked
> up",
> > > the user can rotate the object by moving the mouse wheel. This DOES
> work
> > > right now, it's just that we have the additional movement of the
> screen -
> > > either the scroll or pan.
> > >
> > >
> > > My code is essentially just like the example provided by Owen Wengerd,
> > > except that i'm now sublassing the document window, as was
recommended:
> > >
> > > Here are the variables i'm using:
> > > WNDPROC g_wprocAcad = NULL; //The original AutoCAD window
procedure
> > > HWND g_hwndAcad = adsw_acadDocWnd(); //Store the AutoCAD document
> > window
> > >
> > > Here's my function prototype:
> > > LRESULT CALLBACK AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM
> wParam,
> > > LPARAM lParam );
> > >
> > > Then in my entry point i register my new windows message proc:
> > > g_wprocAcad = (WNDPROC)::SetWindowLong(
> > > g_hwndAcad,GWL_WNDPROC,(LONG)AcadWndProcHook );
> > >
> > >
> > > And then here's my actual function, which at this piont does
essentially
>
> > > nothing, except printing out that it received scroll and mouse wheel
> > > messages:
> > > LRESULT CALLBACK
> > > AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
> > > {
> > > CString a;
> > > a.Format("\nGot the following message: %d",iMsg);
> > > //acutPrintf(a);
> > >
> > > //Here we just process all the window messages that are on their
> > > //way to the AutoCAD main window.
> > > switch( iMsg )
> > > {
> > > case WM_VSCROLL:
> > > acutPrintf("\nScroll");
> > > return 0;
> > >
> > > case WM_MOUSEWHEEL:
> > > acutPrintf("\nMouse Wheel");
> > > return 0;
> > > }
> > >
> > > //Now pass the message to the original window procedure
> > > return ::CallWindowProc( g_wprocAcad, hwnd, iMsg, wParam, lParam );
> > > }
> >
> >
> >
>
>
0 Likes
Message 14 of 16

Anonymous
Not applicable
Based on what I've seen in other applications, the mouse
driver instructs windows to send a WM_MOUSEWHEEL message
to the window with input focus. If that window does not
handle the message, then calling DefWindowProc will cause
the message to propagate up the chain of parent windows
until one of the parent(s) handles the message. If no
window handles the message, only then does windows send
WM_VSCROLL messages.

This gives a window the ability to respond to WM_MOUSEWHEEL
messages in whatever way it wants, but also allows the mouse
to be used in place of the vertical scroll bar in windows
that do not understand mouse wheel messages. If that be the
case then ultimately, the result of the wndproc indicates if
the message was handled or not (return 0 if the message was
handled, and do not call DefWindowProc), so changing the
windows message to WM_NULL may not work.

If you subclass the window returned by acedGetAcadDwgView(),
and handle WM_MOUSEWHEEL by having your Wndproc return 0,
(and not call DefWindowProc) then you should be able to
get it to work.


"Justavian" wrote in message
news:[email protected]...
> > What happens if you disable AutoCAD's scroll bars in the preferences
> (should
> > be the default IMO)?
>
> Good call. How do i do that?
>
>
>
> >
> > You might also try getting the scroll bars themselves and hooking
them...
> >
> > |
> > ----+----------------------------------------------
> > | Byron Blattel
> > | CADwerx---Applications for AutoCAD
> > | Autodesk Registered Developer
> > | email: [email protected]
> > | web site: http://www.cadwerx.net
> > |
> >
> > "Justavian" wrote in message
> > news:[email protected]...
> > > I'm giving the user the ability to rotate objects that they've picked
> up.
> > I
> > > have various "modes" of my application that alter the default way
> AutoCAD
> > > processes points. This is one of those modes - it figures out where
the
> > > user clicks, and whether it's on or inside the bounds of an object.
If
> it
> > > is, then it "picks it up." When the user clicks somewhere else in the
> > > drawing, it will set it down. During the time the object is "picked
> up",
> > > the user can rotate the object by moving the mouse wheel. This DOES
> work
> > > right now, it's just that we have the additional movement of the
> screen -
> > > either the scroll or pan.
> > >
> > >
> > > My code is essentially just like the example provided by Owen Wengerd,
> > > except that i'm now sublassing the document window, as was
recommended:
> > >
> > > Here are the variables i'm using:
> > > WNDPROC g_wprocAcad = NULL; //The original AutoCAD window
procedure
> > > HWND g_hwndAcad = adsw_acadDocWnd(); //Store the AutoCAD document
> > window
> > >
> > > Here's my function prototype:
> > > LRESULT CALLBACK AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM
> wParam,
> > > LPARAM lParam );
> > >
> > > Then in my entry point i register my new windows message proc:
> > > g_wprocAcad = (WNDPROC)::SetWindowLong(
> > > g_hwndAcad,GWL_WNDPROC,(LONG)AcadWndProcHook );
> > >
> > >
> > > And then here's my actual function, which at this piont does
essentially
>
> > > nothing, except printing out that it received scroll and mouse wheel
> > > messages:
> > > LRESULT CALLBACK
> > > AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
> > > {
> > > CString a;
> > > a.Format("\nGot the following message: %d",iMsg);
> > > //acutPrintf(a);
> > >
> > > //Here we just process all the window messages that are on their
> > > //way to the AutoCAD main window.
> > > switch( iMsg )
> > > {
> > > case WM_VSCROLL:
> > > acutPrintf("\nScroll");
> > > return 0;
> > >
> > > case WM_MOUSEWHEEL:
> > > acutPrintf("\nMouse Wheel");
> > > return 0;
> > > }
> > >
> > > //Now pass the message to the original window procedure
> > > return ::CallWindowProc( g_wprocAcad, hwnd, iMsg, wParam, lParam );
> > > }
> >
> >
> >
>
>
0 Likes
Message 16 of 16

Anonymous
Not applicable
Thanks, that works. How can i do the same thing programaticlly?

"Byron Blattel" wrote in message
news:[email protected]...
> I'd try it manually first. It's on the Display tab under Windows
Elements.
>
> --
> |
> ----+----------------------------------------------
> | Byron Blattel
> | CADwerx---Applications for AutoCAD
> | Autodesk Registered Developer
> | email: [email protected]
> | web site: http://www.cadwerx.net
> |
>
> "Justavian" wrote in message
> news:[email protected]...
> > > What happens if you disable AutoCAD's scroll bars in the preferences
> > (should
> > > be the default IMO)?
> >
> > Good call. How do i do that?
> >
> >
> >
> > >
> > > You might also try getting the scroll bars themselves and hooking
> them...
> > >
> > > |
> > > ----+----------------------------------------------
> > > | Byron Blattel
> > > | CADwerx---Applications for AutoCAD
> > > | Autodesk Registered Developer
> > > | email: [email protected]
> > > | web site: http://www.cadwerx.net
> > > |
> > >
> > > "Justavian" wrote in message
> > > news:[email protected]...
> > > > I'm giving the user the ability to rotate objects that they've
picked
> > up.
> > > I
> > > > have various "modes" of my application that alter the default way
> > AutoCAD
> > > > processes points. This is one of those modes - it figures out where
> the
> > > > user clicks, and whether it's on or inside the bounds of an object.
> If
> > it
> > > > is, then it "picks it up." When the user clicks somewhere else in
the
> > > > drawing, it will set it down. During the time the object is "picked
> > up",
> > > > the user can rotate the object by moving the mouse wheel. This DOES
> > work
> > > > right now, it's just that we have the additional movement of the
> > screen -
> > > > either the scroll or pan.
> > > >
> > > >
> > > > My code is essentially just like the example provided by Owen
Wengerd,
> > > > except that i'm now sublassing the document window, as was
> recommended:
> > > >
> > > > Here are the variables i'm using:
> > > > WNDPROC g_wprocAcad = NULL; //The original AutoCAD window
> procedure
> > > > HWND g_hwndAcad = adsw_acadDocWnd(); //Store the AutoCAD
document
> > > window
> > > >
> > > > Here's my function prototype:
> > > > LRESULT CALLBACK AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM
> > wParam,
> > > > LPARAM lParam );
> > > >
> > > > Then in my entry point i register my new windows message proc:
> > > > g_wprocAcad = (WNDPROC)::SetWindowLong(
> > > > g_hwndAcad,GWL_WNDPROC,(LONG)AcadWndProcHook );
> > > >
> > > >
> > > > And then here's my actual function, which at this piont does
> essentially
> >
> > > > nothing, except printing out that it received scroll and mouse wheel
> > > > messages:
> > > > LRESULT CALLBACK
> > > > AcadWndProcHook( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM
lParam )
> > > > {
> > > > CString a;
> > > > a.Format("\nGot the following message: %d",iMsg);
> > > > //acutPrintf(a);
> > > >
> > > > //Here we just process all the window messages that are on their
> > > > //way to the AutoCAD main window.
> > > > switch( iMsg )
> > > > {
> > > > case WM_VSCROLL:
> > > > acutPrintf("\nScroll");
> > > > return 0;
> > > >
> > > > case WM_MOUSEWHEEL:
> > > > acutPrintf("\nMouse Wheel");
> > > > return 0;
> > > > }
> > > >
> > > > //Now pass the message to the original window procedure
> > > > return ::CallWindowProc( g_wprocAcad, hwnd, iMsg, wParam, lParam );
> > > > }
> > >
> > >
> > >
> >
> >
>
>
0 Likes