Moving DirectX windows

Started by
5 comments, last by Midol 15 years, 3 months ago
G'day guys, This question is specific to World of Warcraft but I don't think the game I am using matters. Writing a small multiboxing application mostly just to teach myself c# properly but I can't think of an effective way to move the windows. Right now I just use SetWindowPos but obviously this is slow and takes about 2-3 seconds. Is there any way to move a directX window quickly and effectively without this redraw lag? If so, how would I go about it? This isn't a "give me the code" question, but a "give me an idea" question so I can go and do some research. Links to good sites would also be appreciated. If it's not possible in C#, then what would be a solution for me? I intend to learn c++ but not till I feel competent enough in c# to move onto another language. I am posting it here as I assume it'll involve some hooking of directX or something. Ohhh, window when multiboxing looks like this: http://www.sibehuskies.com/images/squid/profile1.JPG So really I do two moves, I move the little one into the big ones position and the big one into the little ones position.
Advertisement
Quote:Original post by Midol
Right now I just use SetWindowPos but obviously this is slow and takes about 2-3 seconds.
What exactly are you doing? Moving a window takes a fraction of a millisecond, it might take a few milliseconds for WoW to re-render again, but nothing like 2-3 seconds.
Quote:Original post by Evil Steve
Quote:Original post by Midol
Right now I just use SetWindowPos but obviously this is slow and takes about 2-3 seconds.
What exactly are you doing? Moving a window takes a fraction of a millisecond, it might take a few milliseconds for WoW to re-render again, but nothing like 2-3 seconds.


Click small window -> code to move executed -> code moves small window into position using setwindowpos -> code moves large window into small pos using setwindowpos.

EDIT: Oops, resizing as well.

Tried it on other PCs, also tried removing 4 windows and only having one up and moving it but it definitely lags. the 2-3 seconds is for both moves, so roughly 1.5seconds each.

The variables will make no sense to you, but here is the code to move the windows.

Quote:
Win32.SetWindowPos(nHandle, 0, x1[oPos], y1[oPos], cx[oPos], cy[oPos], Win32.SWP_NOZORDER);
Win32.SetForegroundWindow(nHandle);
System.Threading.Thread.Sleep(clag);
Win32.SetWindowPos(oHandle, 0, x1[ii], y1[ii], cx[ii], cy[ii], Win32.SWP_NOZORDER);

API = public static extern Int32 SetWindowPos(int Hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
I would personally follow the method of solving this problem.
I would check how the resizing and moving of the window is affecting my resources and how long it's taking to do it manually, without code... because all you are doing really is removing the manual aspect of the exercise.

I know you cannot do it as fast as simply calling 2 methods... but resize the window and see how long that takes. Move the window as see how long that takes.

I personally feel that the moving of the window should not take that long, but resizing the window would take the bulk of the time spent between moving/resizing of the windows. This might be because the device might be lost and resources recreated. Recreating resources can be an expensive task.

I hope this helps.
Quote:Original post by Armadon
I would personally follow the method of solving this problem.
I would check how the resizing and moving of the window is affecting my resources and how long it's taking to do it manually, without code... because all you are doing really is removing the manual aspect of the exercise.

I know you cannot do it as fast as simply calling 2 methods... but resize the window and see how long that takes. Move the window as see how long that takes.

I personally feel that the moving of the window should not take that long, but resizing the window would take the bulk of the time spent between moving/resizing of the windows. This might be because the device might be lost and resources recreated. Recreating resources can be an expensive task.

I hope this helps.



Moving takes no time at all, but resizing does. So my title is a bit misleading (no idea why I didn't think of testing them individually.)

I know for certain it can be done instantly though (or so close it appears instant), I've heard of another program doing it but can't remember its name.

I'm on my mums PC now (faster) and the time is ~ 1.1seconds which is still slower than I like. It doesn't really bother me, but any improvement is a good thing.
Isn't that usual for DirectX (pre 10) apps that have to unload resources, reset the device and reload their resources again?

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Quote:Original post by Endurion
Isn't that usual for DirectX (pre 10) apps that have to unload resources, reset the device and reload their resources again?


Sure is, but there is a way around it and I wanted to know if anyone knew it.

Remembered which program can do it, innerspace. Average time is 15/20ms.

This topic is closed to new replies.

Advertisement