Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

ShutDownRunningApp.rul -> Applicationsname


3 replies to this topic

bernard

bernard
  • Full Members
  • 127 posts

Posted 05 April 2011 - 13:15

Habe InstallScript Project
InstallShield 2011 - Professional Edition

Ich möchte das Script ShutDownRunningApp.rul von "List and Shut Down Running Applications" nutzen.

Statt ProcessEnd("XXX");
möchte ich MessageBox("Beende die Anwendung YYY manuall!",INFORMATION) ausgeben.
Wie bekomme ich den Anwendungnamen vom Prozesse "XXX"? Welche API Function?

Danke im Voraus

bernard

bernard
  • Full Members
  • 127 posts

Posted 08 April 2011 - 11:53

Habe die Function ProcessRunning() so ergänzt:

prototype number USER32.GetWindowText(HWND, byref wstring, number);
prototype HWND KERNEL32.GetProcessId( byval HWND );

function BOOL ProcessRunning(szAppName)
...
string strTitle[256];
number nv_szTitle, nv_Error;
string sz_Error;
HWND hwndCurrentWindow;
...
if StrCompare(svFileName, szAppName) = 0 then
// The process module matches the application
// name passed to the function.
bvRunning = TRUE;
// zeigen Caption
hwndCurrentWindow = GetProcessId(nvProcessHandle); // NUMBER nvProcessHandle;
NumToStr(sz_Error, hwndCurrentWindow);
MessageBox("ProcessRunning - GetProcessId(nvProcessHandle) = " + sz_Error,INFORMATION);
// Ergebnis -> sz_Error = 1208
nv_szTitle = 256;
nv_Error = GetWindowText(hwndCurrentWindow, strTitle, nv_szTitle);
NumToStr(sz_Error, nv_Error);
MessageBox("ProcessRunning - nv_Error = GetWindowText() = " + sz_Error,INFORMATION);
// Ergebnis -> sz_Error = 0
MessageBox("ProcessRunning - Caption = " + strTitle + ";",INFORMATION);
// Ergebnis -> strTitle = leer
goto ProcessRunningEnd;
endif; // StrCompare()

Was ist falsch bei mir?

Danke im Voraus

bernard

bernard
  • Full Members
  • 127 posts

Posted 14 April 2011 - 06:42

Habe etwas gefunden:

http://msdn.microsof...e/cc301495.aspx

Q How can I find the main window for a process?
vom John Riggins

Alles in C+, schwirig in die InstallShield umzustellen.

Brauche eine Hilfe

Danke im Voraus

bernard

bernard
  • Full Members
  • 127 posts

Posted 15 April 2011 - 09:54

Es gab im Script ShutDownRunningApp.rul:
function BOOL ProcessRunning(szAppName)
...
// Get a handle to the first module in the process, which
// should be the executable.

if EnumProcessModules(nvProcessHandle, nvModuleHandle,
PROCESSID_LENGTH, nvBytesRequired) != 0 then
// Get the path of the module.

if GetModuleFileNameExA(nvProcessHandle, nvModuleHandle,
svModuleName, SizeOf(svModuleName)) != 0 then
// Extract the filename (without an extension) from
// the path.

ParsePath(svFileName, svModuleName, FILENAME_ONLY);

if StrCompare(svFileName, szAppName) = 0 then
// The process module matches the application
// name passed to the function.

bvRunning = TRUE;
// meine Ergänzung
hwndCurrentWindow = GetProcessId(nvProcessHandle);
// zeigen Anwendungsname
// meine Funkcion
dltMainWindowForProcess(hwndCurrentWindow, sv_CaptionForProcess);
MessageBox("ProcessRunning - -> Caption =\n" + sv_CaptionForProcess,INFORMATION);
// meine Ergänzung


goto ProcessRunningEnd;
endif;
endif;
endif;

Mit der Function dltMainWindowForProcess()
habe es so gelöst.
Mit dieser Lösung kann ich leben.

Attached Files


Edited by bernard, 15 April 2011 - 09:56.