Programmer:)
[Unity] user32.dll을 이용한 윈도우 컨트롤 (feat.최대화, 최소화) 본문
반응형
딱히 설명할 부분이 없넹..:)
using System;
using System.Runtime.InteropServices;
public static class User32DII
{
#region 윈도우 화면 이동
[DllImport("user32.dll")]
private static extern IntPtr GetActiveWindow();
[DllImport("user32.dll")]
private static extern bool GetWindowRect(IntPtr hwnd, out Rect lpRect);
[DllImport("user32.dll")]
private static extern bool MoveWindow(IntPtr hWnd, int x, int y, int nWidth, int nHeight, bool bRepaint);
[DllImport("user32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
private struct Rect { public int left, top, right, bottom; }
public static void ShowWindowControl(int nCmdShow)
{
//0: 최소화 3 : 최대화
var hwnd = GetActiveWindow();
ShowWindowAsync(hwnd, nCmdShow);
}
#endregion
}
반응형
'DEV > Unity' 카테고리의 다른 글
[Unity] Android 인앱 업데이트 (0) | 2024.04.30 |
---|---|
[Unity] Button Color (Inspector에서 설정하기) (0) | 2023.10.24 |
[Unity] Google Sheets 연동 ( google sheets to unity ) (0) | 2022.10.11 |
[C#] string '+' or Concat or StringBuilder (0) | 2022.08.24 |
[Unity] object Hierarchy 순서 Script에서 Control (0) | 2022.07.05 |
Comments