[WIN32API]




win32API (with using System.Runtime.InteropServices;)


user32.dll
        <window>

         public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

         public static extern void SetForegroundWindow(IntPtr hWnd);

         public static extern void BringWindowToTop(IntPtr hWnd);
        
         public static extern void SetWindowText(IntPtr hWnd, string strName);

         //윈도우의 DC 핸들 얻기 ( 화면 그리기 사용 )
         public static extern IntPtr GetWindowDC(IntPtr hWnd);

         public static extern bool GetClientRect(IntPtr hWnd, [In, Out] ref RECT rect);

         //Screen 좌표 기준 ( local 좌표 )
          public static extern bool ScreenToClient(IntPtr hWnd, [In, Out] ref RECT rect);


         <message>

         public static extern void PostMessage(IntPtr hWnd, int nMsg, int nWparam, int nLparam);

         public static extern void SendMessage(IntPtr hWnd, int nMsg, int nWparam, int nLparam);

         


         <UI>
         public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);

         public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);

         public static extern void SetCursorPos(int nX, int nY);

         public static extern void GetCursorPos(IntPtr Point);

         //windows HotKey설정
         public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);

         public static extern bool UnregisterHotKey(IntPtr hWnd, int id);


       


gdi32.dll

         public static extern IntPtr CreateDC(string str1, int n1, int n2, int n3);

         public static extern int GetPixel(IntPtr hWnd, int nX, int nY);
      

kenel32.dll
         //ini파일의 키값을 수정/입력
         public static extern bool WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName);
 
         public static extern uint GetPrivateProfileInt(string lpAppName, string lpKeyName, int nDefault, string lpFileName);
 
         public static extern int GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);

 

winmm.dll
         //http://blog.naver.com/hero_juni?Redirect=Log&logNo=90026784873
         public static extern int PlaySound(String pszSound, int hmod, int falgs);


Yamecoder 야매코더_
C# 2010.12.04 02:25
Powerd by Tistory, designed by criuce
rss