Re: [BLACKBOX] starting and stopping application from BlackBox

From: [at]} <Werner>
Date: Thu, 13 May 2010 17:50:43 +0200

----boundary-LibPST-iamunique-1763399728_-_-
Content-type: text/plain

Hi,

> Hello BlackBox peoples,
>
> There is a procedure in the HostDialog called Start to start an
> application from within BlackBox. Is there a
> equivalent procedure to this to close an application. One obvious problem is
> knowing which applications have
> been started by BlackBox.

try module O3bbWin of our Tool-Package
http://www.o3-software.de

or just this:

IMPORT
        HostFiles,
        WinApi;

TYPE
        Process* = POINTER TO LIMITED RECORD
                hProcess, hThread : WinApi.HANDLE;
        END;


PROCEDURE (p : Process) Terminate*,NEW;
        VAR res, exitCode : INTEGER;
        BEGIN
                IF p.hProcess # 0 THEN
                        res := WinApi.TerminateProcess(p.hProcess,exitCode);
                        res := WinApi.CloseHandle(p.hProcess);
                        res := WinApi.CloseHandle(p.hThread);
                        p.hProcess := 0;
                END;
        END Terminate;

PROCEDURE ProcessCreate* (commandLine : ARRAY OF CHAR) : Process;
        VAR si : WinApi.STARTUPINFOW; pi : WinApi.PROCESS_INFORMATION;
                res : INTEGER; proc : Process;
        BEGIN
                WinApi.GetStartupInfoW(si); (* get information about the current process *)
                si.wShowWindow := WinApi.SW_SHOWNORMAL; (* activate and display the window *)
                        (* Docu: An application should specify this flag when displaying the window for the first time. *)
                res := WinApi.CreateProcessW(NIL,commandLine,NIL,NIL,WinApi.FALSE,{},0,NIL,si,pi);
                        (* Docu: lpCommandLine The Unicode version of this function, CreateProcessW, can modify the contents of this string.
                                Therefore, this parameter cannot be a pointer to read-only memory ...
                        *)
                ASSERT(res # 0,100);
                NEW(proc);
                proc.hProcess := pi.hProcess;
                proc.hThread := pi.hThread;
                RETURN proc
        END ProcessCreate;





mit freundlichen Grüssen

Werner Braun

Mobil +49 (0)178 145 8768 * Fon +49 (0)431 556 8907-1 * Fax +49 (0)431 556 8907-9

O³ Software GmbH & Co. KG * Franziusallee 131 * D-24148 Kiel * Germany
Sitz der Gesellschaft Kiel * HR Amtsgericht Kiel HRA 6418 KI
Persönlich haftende Gesellschafterin O³ Software GmbH * HR Amtsgericht Kiel HRB 10335 KI * Geschäftsführer Werner Braun


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1763399728_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBIaSxccGFyDQpccGFyDQo+IEhl
bGxvIEJsYWNrQm94IHBlb3BsZXMsXHBhcg0KPiBccGFyDQo+ICAgIFRoZXJlIGlzIGEgcHJvY2Vk
dXJlIGluIHRoZSBIb3N0RGlhbG9nIGNhbGxlZCBTdGFydCB0byBzdGFydCBhblxwYXINCj4gYXBw
bGljYXRpb24gZnJvbSB3aXRoaW4gQmxhY2tCb3guIElzIHRoZXJlIGFccGFyDQo+IGVxdWl2YWxl
bnQgcHJvY2VkdXJlIHRvIHRoaXMgdG8gY2xvc2UgYW4gYXBwbGljYXRpb24uIE9uZSBvYnZpb3Vz
IHByb2JsZW0gaXNccGFyDQo+IGtub3dpbmcgd2hpY2ggYXBwbGljYXRpb25zIGhhdmVccGFyDQo+
IGJlZW4gc3RhcnRlZCBieSBCbGFja0JveC5ccGFyDQpccGFyDQp0cnkgbW9kdWxlIE8zYmJXaW4g
b2Ygb3VyIFR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JFUk9OLkNIfX0A429i7w=
----boundary-LibPST-iamunique-1763399728_-_---
Received on Thu May 13 2010 - 17:50:43 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:32 UTC