What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

[Guide||Code] Tile/Resize D3 Windows C#

xsol

Member
Joined
Nov 7, 2011
Messages
503
Reaction score
12
I know there are other scripts/tools, I don't care if you like autoit or compiled code use it, this is for developers and advanced users who may want to tweak their d3 window experience.


  1. Run all your D3s in Fullscreen Windowed.
  2. Launch the program
  3. Type Tile or Reset and press ENTER



If you are multi botting and you have a boss system this will tile all your D3s across all your screens and into invisible space if you have that many (48???)

There are variables that can be tweaked. Currently it shrinks the window(s) down to 320x240 and tiles them as if running 1920x1080

PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace FixD3
{
    public delegate bool EnumWindowsCallback(int hwnd, int lParam);

    class Program
    {

        private static EnumWindowsCallback callback;

        public class D3Mover 
        {
            [DllImport("user32.dll")]
            public static extern int EnumWindows(EnumWindowsCallback cb, int l);

            [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
            static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);

            [DllImport("user32.dll", SetLastError = true)]
            [return: MarshalAs(UnmanagedType.Bool)]
            internal static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);

            public static bool Report(int hwnd, int lParam) 
            {
                IntPtr wnd = new IntPtr(hwnd);
                StringBuilder sb = new StringBuilder(255);
                GetWindowText(wnd, sb, 255);
                string title = sb.ToString().Trim();
                if (title == "Diablo III")
                {
                    handles.Add(wnd);
                }
                return true;
            }

            static List<IntPtr> handles = new List<IntPtr>();
            public static void TitleWindows()
            {
                int topConst = 0;
                int widthConst = 320;
                int heightConst = 240;
                int offsetTop = topConst;
                int offsetLeft = 0;
                int capBottom = 1080;
                for (int i = 0; i < handles.Count; i++)
                {
                    SetWindowPos(handles[i], IntPtr.Zero, offsetLeft, offsetTop, widthConst, heightConst, 0);
                    Console.WriteLine(string.Format("Moved D3 to X:{0},Y:{1}",new object[]{offsetLeft,offsetTop}));
                    offsetTop += 240;//moce down
                    if (offsetTop >= capBottom)
                    {   //move right
                        offsetTop = topConst;
                        offsetLeft += 320;
                    }
                }
            }

            public static void ResetWindows()
            {
                for (int i = 0; i < handles.Count; i++)
                {
                    SetWindowPos(handles[i], IntPtr.Zero, 0, 0, 1920, 1080, 0);
                    Console.WriteLine("Reset D3");
                }
            }

        }

        static void Main()
        {

            callback = new EnumWindowsCallback(D3Mover.Report);
            D3Mover.EnumWindows(callback, 0);
            Console.WriteLine("Type the command TILE or RESET and press ENTER.");
            string cmd = Console.ReadLine();
            cmd = cmd.ToUpper();

            if (cmd == "TILE") D3Mover.TitleWindows();
            if (cmd == "RESET") D3Mover.ResetWindows();
        }
    }
}
 
That would help alot if I knew how to run it :\
it is a plugin for db?
or should we compile this code to . exe?
 
wow it is excellent, thank you
also thanks for compiling trevor!
 
is there a way to make the reset one do a smaller window? cause right now its this big
 
its leaving them the original size of 800x600 i believe, but tiling them.
 
If someone wanted to they could add support for:

reset 800 600

Code:
            public static void ResetWindows(int w, int h) 
            { 
                for (int i = 0; i < handles.Count; i++) 
                { 
                    SetWindowPos(handles[i], IntPtr.Zero, 0, 0, w, h, 0); 
                    Console.WriteLine("Reset D3"); 
                } 
            } 

            void foo()
            {
                string[] parts = cmd.Split(' ');
                if(parts.Length > 2)
                {
            
                    int w = int.Parse(parts[1]);
                    int h = int.Parse(parts[2]);
                    ResetWindows(w,h);
                }
                else
                {
                    ResetWindows();
                }
            }
 
Do I run them all in windowed or windowed (full screen) mode?
Thanks, program looks awesome!
 
im trying to use this as an autoit script and failing, not sure why. lol
 
im trying to use this as an autoit script and failing, not sure why. lol

Because it is c# that has to be compiled using ms visual studio or the command line "linker" and compiler
 
Because it is c# that has to be compiled using ms visual studio or the command line "linker" and compiler

i have MSVS just no idea what type of file to pick, i got 100+ errors when I picked windows console app, wish I knew what I was doing, there are a few things i want to change in this
 
Doesn't seem to resize my other window. Running 2 instances of D3 and only resizes 1 window successfully?
 
although it is resizing, render resolution is screen resolution for each account right?
So GPU load is much higher than going with windowed mode ?
 
although it is resizing, render resolution is screen resolution for each account right?
So GPU load is much higher than going with windowed mode ?

this seems it may be the case but I have not tested

that said I wrote this to make room on my screens not reduce load
 
Nice try but pretty useless as it doesn't reduce load, if anything it increases it. Great if your just after aesthetics but doesn't really serve a functional purpose.
 
Nice try but pretty useless as it doesn't reduce load, if anything it increases it. Great if your just after aesthetics but doesn't really serve a functional purpose.

Running, 3 d3s, minecraft bukkit server (with people connected), wow (hb leveling a new pally) , minecraft client, and several web browsers my pc is at 10%-20% cpu running them at 800x600 my cpu changes to 15%-25% make of that what you will.

So it does exactly what I need/want and allows me to see my bots while not have a stupid amount of wasted screen.


And minecraft doesn't even lag; of course my system eats most computers for breakfast

For the last time no one is making you use this; I made this for myself and shared the code, feel free to subclass the d3s and remove the re size restriction, I don't need that and I'm not here to make anyone think I'm cool

All that said if I open SWTOR; well everything goes AHH DUR DUR DUR CLUNK BANG FZZZZZZT
 
Its not about CPU load its about GPU load you wont notice it with 3 D3s, my system can run 10 D3+DB easily in windowed mode, but when I use this resize or DBrelogger resize my GPU load goes to 90-100% with 6 D3+db
I wonder if its possible to resize windowed mode?
 
Back
Top