using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace Corp3s.NativeAPI
{
    public delegate int WndProcDelegate(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

    public class WinAPI
    {
        private static IWinAPI m_apiProxy;

        static WinAPI()
        {
            if (Environment.OSVersion.Platform == PlatformID.WinCE)
                m_apiProxy = (IWinAPI)Assembly.GetExecutingAssembly().CreateInstance("Corp3s.NativeAPI.WM5API");
            else
                m_apiProxy = (IWinAPI)Assembly.GetExecutingAssembly().CreateInstance("Corp3s.NativeAPI.NTAPI");
        }

        public static IWinAPI Instance
        {
            get { return m_apiProxy; }
        }
    }


    public interface IWinAPI
    {
        int GetWindowLong(IntPtr hWnd, int nIndex);
        int SetWindowLong(IntPtr hWnd, int nIndex, WndProcDelegate newProc);
        int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr newProc);
        int CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
        IntPtr GetWindow(IntPtr hWnd, uint uCmd);
        IntPtr GetCapture();
        int SetWindowLong(IntPtr hWnd, int index, int dwNewLong);
        bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
    }
}
