0

I want to develop Windows program who can stick into other window.

I searching fastest-way to do this. I can get by WinAPI all information about target window and move my window into good location and after it Sniffing Windows Messages of target window to searching resize or move window and after this doing move my window again. But i don't know what is a simplest good working way (maybe somewhat on .NET? But i don't preffer answers in .NET i like free framework's).

I want to stick on the top, bottom, left, right of the target window, but this maybe never mind.

Can anyone help me something with this problem? Thanks.

Svisstack
  • 16,203
  • 6
  • 66
  • 100
  • Did you try re-parenting your window? I have no idea how that would work with the windows in two different processes. – sje397 Jul 30 '10 at 13:55
  • @sje397: i don't think about it from this point;-) i dont trying this but this is a good point for alternative method to solve this. – Svisstack Jul 30 '10 at 14:00
  • @sje397: in diffrent processes i thinking about target windows MessageQueue sniffing. – Svisstack Jul 30 '10 at 14:01

2 Answers2

0

I used DLLInjection to get into target windows process, created some hooks using winapi calls and by XML over Message Pipe transporting this values to other application who stick to this windows.

Svisstack
  • 16,203
  • 6
  • 66
  • 100
-1

You basically need to do two things:

  1. Get a list of all windows to which your app is supposed to stick, and their locations/dimensions.
  2. Listen to your application's main window's move event and if at any point your window gets close enough to any of the relevant windows from #1 you move it yourself so that they align.

You can do both in Win32 API or with .Net. You just need a good criterion for #1. Like, for example, all top level visible windows that are within the desktop's boundaries.

Might want to include the desktop itself in the list above, so that your app sticks to the edges of the desktop as well.

Assaf Lavie
  • 73,079
  • 34
  • 148
  • 203
  • I have #1 already developed in WinAPI in full version ;-) But i asking about align function. I can do this with WinAPI? I must write this from base form? I can't find about this on MSDN infromation. – Svisstack Jul 30 '10 at 13:58
  • You need to catch WM_WINDOWPOSCHANGING message, and modify WINDOWPOS structure (it resides in lParam). – Kurovsky Jul 30 '10 at 15:40
  • 1
    No, there's no alignment functionality in the API AFAIK. You have to do it yourself (or find existing code). – Assaf Lavie Jul 31 '10 at 07:00