Синтаксис:
Используется csharp
using UnityEngine;
using System;
using System.Runtime.InteropServices;
public class WinAPI: MonoBehaviour {
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool SetWindowTextW(IntPtr hWnd, string lpString);
[DllImport("user32.dll", EntryPoint="FindWindow", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
public static void SetTitle(string oldTitle, string title) {
IntPtr hWnd = FindWindow(null, oldTitle);
SetWindowTextW(hWnd, title);
}
}
using System;
using System.Runtime.InteropServices;
public class WinAPI: MonoBehaviour {
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool SetWindowTextW(IntPtr hWnd, string lpString);
[DllImport("user32.dll", EntryPoint="FindWindow", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
public static void SetTitle(string oldTitle, string title) {
IntPtr hWnd = FindWindow(null, oldTitle);
SetWindowTextW(hWnd, title);
}
}