Có thể tóm gọn trong 2 bước:
. Tìm thẻ cửa sổ Notepad: HWND hWnd = <Viết hàm tìm thẻ cửa sổ>;
. Di chuyển tùy sở thích: MoveWindow(hWnd, x, y, cx, cy, bRedraw);
Chào 500 AE!
Làm sao để có thể Set width, height, di chuyển (x,y) cho 1 cái cửa sổ mở bằng cmd vậy AE? Tks all.
VD (img bên dưới): Open notepad = cmd.
Nếu là trong c# thì:
using ManagedWinapi.Windows;
...................................
notepad = Process.Start("linkto_notepad");
handle = new SystemWindow(notepad .MainWindowHandle);
handle.Size = new System.Drawing.Size(100, 100);
Có thể tóm gọn trong 2 bước:
. Tìm thẻ cửa sổ Notepad: HWND hWnd = <Viết hàm tìm thẻ cửa sổ>;
. Di chuyển tùy sở thích: MoveWindow(hWnd, x, y, cx, cy, bRedraw);
Tks pro nha!
Đang tìm giải pháp cái này : <Viết hàm tìm thẻ cửa sổ>;
Để ý các hàm API: FindWindow, FindWindowEx, EnumWindows, EnumChildWindows
Code:class GIALAPDT { public: HWND hWnd; public: bool Get_Window(WCHAR *NameWindow) { HWND hCurWnd = NULL; do { hCurWnd = FindWindowEx(NULL, hCurWnd, NULL, NULL); if (GetWindowTextLength(hCurWnd) > 0) { const DWORD TITLE_SIZE = 1024; WCHAR windowTitle[TITLE_SIZE]; GetWindowText(hCurWnd, windowTitle, TITLE_SIZE); if (wcscmp(windowTitle, NameWindow) == 0) { hWnd = hCurWnd; return true; } } } while (hCurWnd != NULL); return false; }