From: glyn Date: Fri, 29 Apr 2016 09:30:00 +0000 (+0100) Subject: Add function show_window to iminimise cmd windows via Win32 ShowWindow X-Git-Url: https://git.8kb.co.uk/?a=commitdiff_plain;h=1f327f53d245cfe1cc60c3991580d402248e7111;p=dataflex%2Fdf32func Add function show_window to iminimise cmd windows via Win32 ShowWindow --- diff --git a/src/df32/win32.h b/src/df32/win32.h index 8c42634..8500b58 100644 --- a/src/df32/win32.h +++ b/src/df32/win32.h @@ -43,6 +43,7 @@ external_function SetConsoleTitle "SetConsoleTitleA" Kernel32.dll string lpszTit external_function FindWindow "FindWindowA" user32.dll pointer lpszClassName string lpszWindowName returns handle external_function GetSystemMenu "GetSystemMenu" user32.dll handle hwnd dword bRevert returns dword external_function EnableMenuItem "EnableMenuItem" user32.dll handle hmenu integer uIDEnableItem integer uEnable returns integer +external_function ShowWindow "ShowWindow" user32.dll handle hWnd integer nCmdShow returns integer external_function ShellExecute "ShellExecuteA" shell32.dll handle hWnd pointer lpOperation pointer lpFile pointer lpParameters pointer lpDirectory integer nShowCmd returns integer external_function CreateProcess "CreateProcessA" kernel32.dll pointer lpAN pointer lpCL pointer lpPA pointer lpTA integer bIH dword dwCF pointer lpE pointer lpCD pointer lpSI pointer lpPi returns integer external_function OpenProcess "OpenProcess" kernel32.dll dword dwDesiredAccessas integer bInheritHandle dword dwProcId returns handle diff --git a/src/df32/win32.inc b/src/df32/win32.inc index cd6dc5a..d792ecc 100644 --- a/src/df32/win32.inc +++ b/src/df32/win32.inc @@ -452,6 +452,18 @@ function disable_close global integer argv returns integer function_return 0 end_function + +// Manipulate cmd window to minimise maximise etc. E.g show_window("pap", SW_MINIMIZE) +function show_window global string argv integer argv2 returns integer + local number Ret + local handle hWnd + + move (SetConsoleTitle(argv)) to strmark + move (FindWindow(0, argv)) to hWnd + move (ShowWindow(hWnd, argv2)) to ret + + function_return ret +end_function // This function will run any external application directly from dataflex // argv = application to run (command name/path) argv2 = any parameters to pass to the program argv3 = directory to run from