losession = createobject('Notes.NotesSession')This caused the Notes client to launch, if it already wasn't, displaying the password dialog. Starting with version 5.0.3, you could use:
clear clear dlls #define PROCESS_QUERY_INFORMATION 0x400 #define PROCESS_VM_READ 0x10 #define PROCESS_MASK BITOR(PROCESS_QUERY_INFORMATION,PROCESS_VM_READ) set procedure to clsheap additive declare integer GetLastError in win32api declare integer EnumProcesses in PSAPI string@, integer, integer@ declare integer EnumProcessModules in PSAPI integer, string@, integer, integer@ declare integer GetModuleFileNameEx in PSAPI integer, integer, string@, integer declare integer OpenProcess in kernel32 integer, integer, integer declare integer CloseHandle in kernel32 integer declare string GetCommandLine in kernel32 integer local oheap, lpPIDarray, lpModarray, lnsize, lpneeded, lcarrstr, lnMod local llprocess oheap = createobject('heap') lpPIDarray = replicate(chr(0),4096) lnsize = 200 lpneeded = 0 lpneeded1 = 0 if EnumProcesses(@lpPIDarray,lnsize,@lpneeded) <> 0 then lpPIDarray = left(lpPIDarray,lpneeded) local lxx, lnPDI, lnhproc, lyy, lcModname for lxx = 1 to lpneeded step 4 lnPID = DWordtoNum(substr(lpPIDarray,lxx,4)) if lnPID <> 0 then lnhproc = OpenProcess(PROCESS_MASK,0,lnPID) if lnhproc <> 0 then lpModarray = replicate(chr(0),8192) if EnumProcessModules(lnhproc,@lpModarray,lnsize,@lpneeded1) <> 0 then llprocess = .F. for lyy = 1 to 1 step 4 lnMod = DWordtoNum(substr(lpModarray,lyy,4)) if lnMod <> 0 then lcModname = replicate(chr(0),128) GetModuleFileNameEx(lnhproc,lnMod,@lcModname,128) if !llprocess and (lyy = 1 and !("VFP" $ upper(lcmodname))) then llprocess = .T. endif if !llprocess then exit endif ? justfname(left(lcModname,at(chr(0),lcModname)-1)) endif endfor else * do nothing endif CloseHandle(lnhproc) else * do nothing endif endif endfor else ? 'Error occurred: ' + transform(GetLastError()) ENDIFIt requires you download Ed Rauh's CLSHEAP class in the Download section. DWordtoNum is a function in it. You can also use Windows Management Instrumentation (WMI). Here is an example:
clear local loloc, lomgr, loproccol, loproc loloc = createobject('WBemScripting.SWbemLocator') lomgr = loloc.ConnectServer() loproccol = lomgr.InstancesOf('Win32_Process') for each loproc in loproccol ? upper(loProc.Properties_("Name").Value) next store .NULL. to loproccol, lomgr, lolocThis works by default on Win2K and XP. You can download WMI for NT and 98.