function SHOW_WINDOWS_PROCESSES(VOID) * Copyright (c) 2004 by State of the Art Systems Pty. Ltd. * This code may not be resold or distributed without leaving * this Copyright notice attached. * Demonstrates the way that Open Insight 32 can * discover what other processes are running under Windows, * listing their primary classes and handles /* First, modify STPROC*DLL_USER32 to contain the following lines then RUN DECLARE_FCNS "DLL_USER32" - you'll need to open one instance of OI32 to run this program and one other instance to be detected you can the see the class of Open Engine. USER32 HANDLE STDCALL GetDesktopWindow(VOID) HANDLE STDCALL GetWindow(HANDLE, ULONG) LONG STDCALL GetWindowTextA(HANDLE, LPCHAR, LPLONG) HANDLE STDCALL GetForegroundWindow(VOID) LONG STDCALL GetWindowLongA (HANDLE, ULONG) LONG STDCALL GetClassNameA(HANDLE,LPCHAR,LPLONG) */ DECLARE FUNCTION GetDesktopWindow, GetWindow DECLARE FUNCTION GetWindowTextA, GetWindowLongA, DECLARE FUNCTION GetForegroundWindow, DECLARE FUNCTION GetClassNameA, ShowWindow, FindWindowA DECLARE SUBROUTINE MSG VISIBLE$ = 0x10000000 display = '' lngx = GetDesktopWindow() * Return the process which is the * "first" child process of the Windows Desktop * GetWindow() second parameter can be * FIRST = 0, LAST = 1, NEXT = 2, * PREV = 3, OWNER =4, CHILD = 5, lngx = GetWindow(lngx, 5) junk = GetForegroundWindow(void) * Loop through each child process of the Desktop in turn Loop While lngx <> 0 strBuffer = Str(char(0), 260) * Get the Caption text of the Window intCount = GetWindowTextA(lngx, strBuffer, 260) If intCount > 0 Then strCaption = strBuffer[1,intCount] End Else strCaption = '' End * Get the Main Class name of * the executable , by using the Window handle If Len(strCaption) > 0 Then * get visible windows only, comment out for all procs. lngStyle = GetWindowLongA(lngx, -16) *If bitand(lngStyle,VISIBLE$) > 0 Then classBuffer = Str(char(0), 260) intCount = GetClassNameA(lngx, classBuffer, 260) If intCount > 0 Then classname = classBuffer[1,intCount] End Else classname = '' End display<-1>=classname:@vm:strCaption:@vm:lngx:@vm:lngStyle *End End * get the handle of the next child window * of the desktop (basically a Windows "readnext process") lngx = GetWindow(lngx, 2) Repeat Swap @fm with \0D0A\ in display flush garbagecollect return display