Article View: borland.public.cppbuilder.nativeapi
Article #2594To Kill A Process
From: poojo hackma
Date: Thu, 01 Feb 2007 21:13
Date: Thu, 01 Feb 2007 21:13
29 lines
2312 bytes
2312 bytes
I have 2 small programs that potentially could interfere with one another: The first is CustomSetup.exe: It installs AutoRun.exe and MainApp.exe on removable media. If the media is not inserted, a message box pops up telling the user that the media must be inserted in order to install with a MB_RETRYCANCEL option. The second is AutoRun.exe: It is placed on the removable media by CustomSetup.exe, and prompts to start MainApp.exe with CreateProcess whenever the media is inserted. The Issue: A Techs installs the program by running CustomSetup.exe. CustomSetup.exe (first detects that MainApp.exe is not already installed, then) detects that there is no removable media, and informs the Tech that the media needs to be inserted. The Tech inserts the media, which just happens to have AutoRun.exe and MainApp.exe already on it. The Problem: If AutoRun.exe can detect that CustomSetup.exe is running, it can close CustomSetup.exe ... or itself. I'd like to use EnumWindows and GetWindowThreadProcessId within AutoRun.exe to find and close CustomSetup.exe (using WM_CLOSE), but I don't know how to locate it.. The closest functions I have found are GetWindowText and GetClassName, but it appears that neither is suitable since both are small "WinMain Only" programs (neither has a class or a window). How can I find the CustomSetup.exe process? Any ideas?
Technical Details
Message-ID:
<45c257c5$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,122949c7220b533e,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "poojo hackma" <poojo.com/mail> Newsgroups: borland.public.cppbuilder.nativeapi Subject: To Kill A Process Date: Thu, 1 Feb 2007 15:13:42 -0600 Lines: 31 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original X-Antivirus: avast! (VPS 000709-2, 02/01/2007), Outbound message X-Antivirus-Status: Clean NNTP-Posting-Host: 12.191.89.68 Message-ID: <45c257c5$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1170364357 12.191.89.68 (1 Feb 2007 13:12:37 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail