Exemplo n.º 1
0
        public bool Initialize(IntPtr targetWindow, string targetWindowName, int width, int height, int fps)
        {
            m_width            = width;
            m_height           = height;
            m_length           = m_width * m_height * 4;
            m_desiredFPS       = fps;
            m_targetWindow     = targetWindow;
            m_targetWindowName = targetWindowName;

            // get working dir for loading D3D9Hook.dll
            System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
            string dllPath = a.Location;
            int    pos     = dllPath.LastIndexOf('\\');

            dllPath  = dllPath.Remove(pos);
            dllPath += "\\D3D9Hook.dll";

            // inject into target process (must be a directx appliction using d3d9.dll)
            if (!ProcessInjector.DoProcessInjection(m_targetWindow, m_targetWindowName, dllPath))
            {
                return(false);
            }

            // Set D3D9Hook.dll capture size
            PinvokeD3D9Hook.SetCapSize(m_width, m_height);

            return(true);
        }