Window messages

 
 
 
Posted by:Vincentt
Data created:16 June 2013

Hello,

I’m wondering if you know an (easy) way to catch window messages from Max.

I would like to know when someone resizes the viewport, because the plugin I’m making is visible in all open viewports.  So I’d like to catch the WM_WINDOWPOSCHANGED message, because that one is being fired when the viewports change size/pos.

Till now I have been using http://www.codeproject.com/Articles/6362/Global-System-Hooks-in-NET to do this. The problem is that this only works on 1 process at a time, as soon as you start my plugin in a new Max process the old hook gets unhooked. Then someone told me about EasyHook, I’ve been trying to get this to work, but without much luck.

So this is why I was thinking, maybe there is an easier way. Because as far as I understand, I need to inject a native dll in Max’ memory to be able to “read/hook” but maybe my plugin is already in Max’ memory so I don’t actually need another DLL?

(I’ve also tried WinEventHook but this didn’t work either)

 

Thanks in advance,

Vin

Hi Vin,

I do not think I can help you much here. If you are trying to catch viewport resizes I would recommend using Max's viewport redraw callback. I am not positive but I think there might even be a viewport resize callback. In redraw callback you can see if the size changed and perform some appropriate action.

Beyond that I never had a need to heek into another process' resize callbacks without it providing one explicitly.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Hey Marsel,

 

Thanks for you reply, I'll try it with the viewport redraw callback. I've already set that one up for some other things that only need to change when you change something in the active viewport. I didn't think about using it for the resized viewports.

 

Thanks,

Vin