본문 바로가기
Programming/Unity 3D

Unity에서 쓸만한 user32.dll 와드

by PLUSLUTE 2020. 4. 8.

/* 타이틀 바 이름 바꾸기 */ 
[DllImport("user32.dll", EntryPoint = "SetWindowText")] 
public static extern bool SetWindowText(System.IntPtr hwnd, System.String lpString); 
[DllImport("user32.dll", EntryPoint = "SetWindowTextW")] 
public static extern bool SetWindowTextW(System.IntPtr hwnd, System.IntPtr lpString); 
[DllImport("user32.dll", EntryPoint = "SetWindowTextA")] 
public static extern bool SetWindowTextA(System.IntPtr hwnd, System.IntPtr lpString); 

/* 프로세스 찾아주기용 */ 
[DllImport("user32.dll", EntryPoint = "FindWindow")] 
public static extern System.IntPtr FindWindow(System.String className, string windowName);

 

/* IntPtr 변환 */

public static System.IntPtr StringToIntPtr(string a_strTitleName) { return Marshal.StringToCoTaskMemAuto(a_strTitleName); }