Antonio
I have to close a program (that is in Try Icon Bar )
I tryed with GetTasks() but the program is not in the list , but if I open task manger insted it is.
Thank in anticipation
Maurizio
www.nipesetvice.com
#include "FiveWin.ch"
#define GHW_HWNDFIRST 0
#define GHW_HWNDNEXT 2
#define GWW_HINSTANCE -6
//----------------------------------------------------------------------------//
function GetTasks()
local hWnd := GetWindow( GetActiveWindow(), GHW_HWNDFIRST )
local aTasks := {}
local cTask
while hWnd != 0
#ifdef __CLIPPER__
cTask = GetModuleFileName( GetWindowWord( hWnd, GWW_HINSTANCE ) )
#else
// cTask = GetModuleFileName( GetWindowLong( hWnd, GWW_HINSTANCE ) )
cTask = GetWindowText( hWnd ) // The above does now work :-(
#endif
if AScan( aTasks, cTask ) == 0
AAdd( aTasks, cTask )
endif
hWnd = GetWindow( hWnd, GHW_HWNDNEXT )
end
return aTasks
//----------------------------------------------------------------------------//
#define HKEY_CURRENT_USER 2147483649
#define REG_DWORD 4
function SetTaskManager( lOnOff ) // Enables/Disables Ctrl+Alt+Del
local hKey := 0
if lOnOff
RegCreateKey( HKEY_CURRENT_USER,;
"Software\Microsoft\Windows\CurrentVersion\Policies\System", @hKey )
RegSetValue( hKey, "DisableTaskMgr", 0, REG_DWORD, L2BIN( 0 ), 4 )
RegCloseKey( hKey )
else
RegCreateKey( HKEY_CURRENT_USER,;
"Software\Microsoft\Windows\CurrentVersion\Policies\System", @hKey )
RegSetValue( hKey, "DisableTaskMgr", 0, REG_DWORD, L2BIN( 1 ), 4 )
RegCloseKey( hKey )
endif
return nil
DLL32 static FUNCTION REGCREATEKEY( hKey AS LONG, cSubKey AS LPSTR, @nHandle AS ;
PTR ) AS LONG PASCAL FROM "RegCreateKeyA" LIB "advapi32.dll"
DLL32 static FUNCTION REGSETVALUE( hKey AS LONG, cValueName AS LPSTR, nReserved AS ;
LONG, nType AS DWORD, cData AS LPSTR, nData AS DWORD ) AS LONG ;
PASCAL FROM "RegSetValueExA" LIB "advapi32.dll"
DLL32 static FUNCTION REGCLOSEKEY( hKey AS LONG ) AS LONG ;
PASCAL FROM "RegCloseKey" LIB "advapi32.dll"
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 38 guests