English
Source / code snippets

receive Hwnd Program Runex started XProfan

 
not any more necessary, see iFs Posting, there is the Source in XPSE kompatibler Version without Authors-Info or ähnlichem. Weiterentwicklung tuned.

[hr:aa5e7cfcab]
Nachtrag of me - iF. Thomas was so kind - to kurzer expressed between me and it - its code me over again available To to put. and there the code original here stood set I it here again into:
CompileMarkSeparation
Ersatz für Run
Wird es als Funktion aufgerufen, erhält man das hWnd des Fensters zurück
Fehlerrückgaben:
-1 = Programm wurde nicht gefunden oder falsche Parameterzahl
0 = Timeout erreicht, das ermitteln des Fenster hat mehr als 5 Sek. gedauert
und wurde abgebrochen
Autor: Thomas Schulz aka ts-soft
erstellt: 23.10.2006
Version: 1.0 für XProfan 10
 $H windows.ph
 $H structs.ph

Proc ?_RunEx

    Case %PCount <> 1 : Return -1
    Parameters cmdline$
    Declare Ret&, SI#, PI#, WinHandle&, pid&, win&, timeout&
    Struct STARTUPINFO = ~STARTUPINFO
    Struct PROCESS_INFORMATION = ~PROCESS_INFORMATION
    Dim SI#, STARTUPINFO
    Dim PI#, PROCESS_INFORMATION
    timeout& = ~GetTickCount() + 5000
    WinHandle& = -1
    Ret& = ~CreateProcessA(0, Addr(cmdline$), 0, 0, 0, 0, 0, 0, SI#, PI#)

    If Ret&

        Repeat

            win& = FindWindow("")

            While win&

                ~GetWindowThreadProcessId(win&, Addr(pid&))

                If pid& = PI#.dwProcessId&

                    WinHandle& = win&
                    Break

                EndIf

                If  ~GetTickCount() > timeout&

                    WinHandle& = 0
                    Break

                EndIf

                win& = ~GetWindow(win&, ~GW_HWNDNEXT)

            EndWhile

        Until WinHandle& > -1

    EndIf

    Dispose SI#
    Dispose PI#
    Return WinHandle&

../../references-fonction/XProfan/endproc/'>ENDPROC

 
10/23/06  
 




CompileMarkSeparation
Proc RunEx(cmdline$)

    Declare SI#, PI#, pid&, win&
    Dim SI#, STARTUPINFO
    Dim PI#, PROCESS_INFORMATION
    var timeout&:=GetTickCount()+5000
    var WinHandle&:=-1

    If CreateProcessA(0,Addr(cmdline$),0,0,0,0,0,0,SI#,PI#)

        Repeat

            win&:=FindWindow("")

            While ((win&) and (winHandle&==-1))

                GetWindowThreadProcessId(win&,Addr(pid&))
                case pid& == PI#.dwProcessId& : WinHandle& = win&
                case GetTickCount() > timeout& : WinHandle& = 0
                win&:=GetWindow(win&, GW_HWNDNEXT)

            EndWhile

        Until WinHandle&>-1

    EndIf

    Dispose SI#
    Dispose PI#
    Return WinHandle&

EndProc

var notepad& = RunEx("c:\windows\notepad.exe")

If notepad&

    SendString(notepad&, "XProfan 10 ist einfach Spitze!")
    SendString(notepad&, "Aber das Wissen ja alle")
    SendString(notepad&, "Gruß, Thomas")

EndIf

 
10/23/06  
 



@iF
The sense, why you whom Source wiederholst, where still what missing, entgeht me here. The code-Snippet ought to too without XPSE walk
The Änderung in the example on Hardcoded Dateipfad is still well not your serious? it ought to possible each walk, or. if, then determined one whom way!
 
10/23/06  
 



what has you because gestochen?

what missing you because and why ought to one CodeSnippet what with needed XPSE marks is too without XPSE walk especially since You Yes already not-XPSE shred posted have?

The Änderung in the example on Hardcoded is sehrwohl my serious - i'm unclear and so in Beispielcodes nothing hardcoded his must! is the a Unit? an DLL?

and the claim on it something - Why too always - To repeat, have I me so created that this here my Community is - what naturally not heissen should that I not wish me hereon attentive To make if I something wrong wiederhole.
 
10/23/06  
 



[quote:8cef19ce1c=TS-Soft]not any more necessary, see iFs Posting, there is the Source in XPSE kompatibler Version without Authors-Info or ähnlichem. Weiterentwicklung tuned.[/quote:8cef19ce1c]
alas god there burn the shoe! The Autorenhinweis was still clear and explicit in DEINEM Posting To reading! only because You your Posting now removes have is still everything for Katz! my Posting kahm to Your Posting and was as appendix To see - not as substitute!

I find you have überreagiert Thomas.

[hr:8cef19ce1c]
unfortunately Thomas has his Posting removes - with the Originalcode (in the not-Xpse-stature), means here again a of XPSE transformed Version in the not-Xpse-stature The naturally niiiieeeemals so beautiful is How Thomas its Variante also a Vermerk on the Author (Thomas Schulz) encompassed.
CompileMarkSeparation
DECLARE __cf1&,__cf2&,__cf3&,__cf4&
STRUCT STARTUPINFO=CB&,LPRESERVED#(4),LPDESKTOP#(4),LPTITLE#(4),DWX&,DWY&,DWXSIZE&,DWYSIZE&,DWXCOUNTCHARS&,DWYCOUNTCHARS&,DWFILLATTRIBUTE&,DWFLAGS&,WSHOWWINDOW%,CBRESERVED2%,LPRESERVED2&,HSTDINPUT&,HSTDOUTPUT&,HSTDERROR&
STRUCT PROCESS_INFORMATION=HPROCESS&,HTHREAD&,DWPROCESSID&,DWTHREADID&
Def __cf1(2) !"KERNEL32","GetProcAddress"
Def __cf2(1) !"KERNEL32","GetModuleHandleA"
__cf1&=__cf1(__cf2("kernel32.dll"),"GetTickCount")
__cf2&=__cf1(__cf2("kernel32.dll"),"CreateProcessA")
__cf3&=__cf1(__cf2("user32.dll"),"GetWindowThreadProcessId")
__cf4&=__cf1(__cf2("user32.dll"),"GetWindow")
 $DEFINE XPSE

proc RUNEX

    PARAMETERS CMDLINE$
    DECLARE SI#, PI#, PID&, WIN&
    DIM SI#, STARTUPINFO
    DIM PI#, PROCESS_INFORMATION
    VAR TIMEOUT&=call(__cf1&)+5000
    VAR WINHANDLE&=-1

    IF call(__cf2&,0,ADDR(CMDLINE$),0,0,0,0,0,0,SI#,PI#)

        REPEAT

            WIN&=FINDWINDOW("")

            WHILE ((WIN&) AND (WINHANDLE&=-1))

                call(__cf3&,WIN&,ADDR(PID&))

                IF PID&=PI#.DWPROCESSID&

                    WINHANDLE&=WIN&

                ENDIF

                IF call(__cf1&) > TIMEOUT&

                    WINHANDLE&=0

                ENDIF

                WIN&=call(__cf4&,WIN&, 2)

            ENDWHILE

        UNTIL WINHANDLE&>-1

    ENDIF

    DISPOSE SI#
    DISPOSE PI#
    RETURN WINHANDLE&

endproc

VAR NOTEPAD&=RUNEX("c:\windows\notepad.exe")

IF NOTEPAD&

    SENDSTRING(NOTEPAD&, "XProfan 10 ist einfach Spitze!")
    SENDSTRING(NOTEPAD&, "Aber das Wissen ja alle")
    SENDSTRING(NOTEPAD&, "Gruß, Thomas")

ref='./../../references-fonction/XProfan/endif/'>ENDIF

 
10/23/06  
 




GDL
Please Nich on my birthday quarrel.

Hello
Georg
 
Windows7 Xprofan 8,9,10 [...]  [...] 
10/23/06  
 



[quote:f0cb3b491f=GDL]Please Nich on my birthday quarrel.

Hello
Georg[/quote:f0cb3b491f]
You zauberst me over ands over again one smiles Georg.
 
10/23/06  
 




GDL
be today for a long time time again well on it what about me hope, the Perhaps any today time well on it are.

Hello
Georg
 
Windows7 Xprofan 8,9,10 [...]  [...] 
10/23/06  
 



Hey the get we sure there - @any: stiiiiimts????
 
10/23/06  
 



I mean we (Thomas what about me) could The Indifferenz in a ausführlichen Skypegespräch enclosing. thatswhy see erstes Posting.
 
10/23/06  
 




Torsten
Rümker
i'm now on the try and try, and of course have I attempts the Procedure yet mitzugeben in welchem mode the program started should. (means minimizes or maximiert or whatever)

The following have I means eingefügt or changed:
before:
CompileMarkSeparation
Case %PCount <> 1 : Return -1
Parameters cmdline$
Declare Ret&, SI#, PI#, WinHandle&, pid&, win&, timeout&
Struct STARTUPINFO = ~STARTUPINFO
Struct PROCESS_INFORMATION = ~PROCESS_INFORMATION
Dim SI#, STARTUPINFO
Dim PI#, PROCESS_INFORMATI

hereafter:
CompileMarkSeparation
Case %PCount <> 2 : Return -1
Parameters cmdline$, mode%
Declare Ret&, SI#, PI#, WinHandle&, pid&, win&, timeout&
Struct STARTUPINFO = ~STARTUPINFO
Struct PROCESS_INFORMATION = ~PROCESS_INFORMATION
Dim SI#, STARTUPINFO
Dim PI#, PROCESS_INFORMATION
LET SI#.wShowWindow%=mode%

have attempts CreateProcessA  To to obey, but somehow comes there by me nothing with out, should hot the program becomes always in the Normalmodus launched alike I make.

A

MfG
Torsten Rümker
 
Ich lerne, ob ich will oder nicht!
Betriebssystem:
- Ubuntu 15.x
- Windows (diverse)
XProfan Version: X2
11/02/06  
 



If you already the lever have, Why using not simply ShowWindow(n1,n2) ?
 
11/02/06  
 




Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

12.708 Views

Untitledvor 0 min.
Torben Nissen05/02/20

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie