Jump to content
  • Advertisement
Sign in to follow this  
MarkS

I need to create a utility to drag windows from outside of the application.

This topic is 3045 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Sorry for the confusing title, but here is what I'm after and why. I work for a large family entertainment restaurant/game room. We use a very poorly designed (and I'm assuming cheap) point of sale (POS) software system. It would appear that the user interface was designed by trained monkeys. The main window for the new administrator software we just upgraded to requires a monitor with a resolution of 1024x768. The window can be resized, but nothing in the window resizes or reconfigures, and most odd, there are no scroll bars. Anyway, our tech manager uses a small netbook to diagnose games, but the screen size is less than 1024x768. Because of this, he can no longer get to the parts of the interface to do some of the work he needs to do. The company that wrote the software just doesn't seem to care to answer inquiries about the issues we are having. What he needs is a utility where he can press a hot key and then be able to click and drag the window to where he needs it, from any point in the window (title bar is out since it will need to be moved off screen). How to do this without hacking the program is what stumps me. I need to write a background app that sits and waits for a hot key to be pressed and then takes control of any mouse events in the active window until another hot key is pressed. I'm just too new to Windows programming. I'm still learning event handling, and this goes beyond my knowledge. MSDN is not too helpful since it requires you to know what you're looking for and I really have no idea. Any ideas would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Tried Alt+Space+M? ;)

Edit: As for what you're trying to do.. How about using SetWindowsHookEx with WH_CALLWNDPROC and then intercepting WM_MOUSEMOVE/WM_LBUTTONDOWN/WM_LBUTTONUP? You could probably use WindowFromPoint to test whether you're in the client area of the window or over a child/control in the window and then MoveWindow appropriately.
But you will have to pay attention not to cause a deadlock; WindowFromPoint might send WM_NCHITTEST and MoveWindow will of course also send messages to the window, so you need to make sure never to call these in response to messages that they can cause.

Share this post


Link to post
Share on other sites
Quote:
Original post by pablo24
Tried Alt+Space+M? ;)


I wasn't aware of such a feature, but doing so forces the mouse to the title bar. That will not work as the window will need to be dragged from within the client rect.

Quote:
Original post by pablo24
Edit: As for what you're trying to do.. How about using SetWindowsHookEx with WH_CALLWNDPROC and then intercepting WM_MOUSEMOVE/WM_LBUTTONDOWN/WM_LBUTTONUP? You could probably use WindowFromPoint to test whether you're in the client area of the window or over a child/control in the window.


Thanks, I'll look into that.

Share this post


Link to post
Share on other sites
Quote:
I wasn't aware of such a feature, but doing so forces the mouse to the title bar. That will not work as the window will need to be dragged from within the client rect.

I find myself using this method to bring back windows to the desktop after I switched from a dual-monitor setup at home/office on a regular basis.

I am usually able to move any window type, even those without a title bar (unnecessary fancy GUIs etc.) using the cursor keys - you should at least give it a try.

Share this post


Link to post
Share on other sites
Ah. Arrow keys. Now it makes sense. That will work perfectly. I'll let him know about this today. Thanks guys!

Share this post


Link to post
Share on other sites
Quote:
Original post by maspeir

uses a small netbook


My EEE came with a tool that allows resolution to be full 1024x768, and will automatically scroll.

Some drivers also allow desktop to be larger than physical screen, check the display settings.

Google for "scrolling virtual desktop".

Share this post


Link to post
Share on other sites
I don't think alt+space+m will work (I hope it does though), because Windows will automatically move the window back when you press enter to ensure at least a small part of its title bar remains within the work area. However, this doesn't happen when you use something like SetWindowPos().

Share this post


Link to post
Share on other sites
Quote:
Original post by Amr0
I don't think alt+space+m will work (I hope it does though), because Windows will automatically move the window back when you press enter to ensure at least a small part of its title bar remains within the work area. However, this doesn't happen when you use something like SetWindowPos().


Yep. I'm at work and just verified this. :( Looks like I'll be writing a utility...

Share this post


Link to post
Share on other sites
Couple quick thoughts.

Try remote desktop from the small screen system to a large screen desktop running the app. I think it will give you the ability to scroll the whole desktop/window.

Or, simply re-parent the window into your own application window and add scroll bars. Should be trivial with a bit of C# and a few interop calls.

Share this post


Link to post
Share on other sites
Quote:
Original post by pjcast
Or, simply re-parent the window into your own application window and add scroll bars. Should be trivial with a bit of C# and a few interop calls.


I tried this and it seemed simple. It worked perfectly while under development in Visual C++ 2008, but the moment I tried the app from the desktop, it failed to work.

The problem is that I do not have the application on my home computer and it requires serves on our server to run, so I cannot get a copy. On top of that, I cannot install Visual Studio at work. As such, I'm trying to parent the top most window when my program runs. However, clicking on an icon on the desktop actives the desktop window and the program ends up parenting it instead.

I've tried just about every "GetXXWindow" function I can and none of them work. I'm guessing that the window list is tied to the current process.

Any idea how to get a handle to the window of another application under my main window?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!