English
Source / code snippets

Api commands Notepad Per Run Sendstring

 

CompileMarkSeparation
Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
Run-Befehl per API und mit SendString an NotePad
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)

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(NOTEPAD.EXE)

IF NOTEPAD&

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

href='./../../Function-References/XProfan/endif/'>ENDIF

 
07/16/07  
 




p.specht

Revitalisiert 2019-01:
'Run-commands by API and Strings with SendString on NotePad
CLS'<<< CLS can with erwiesenem functions omitted.
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")

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("Unbenannt - Editor")'<< Leeres Notepad in Win7, ev. adjust!

            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("NOTEPAD.EXE")

IF NOTEPAD&

    SENDSTRING(NOTEPAD&, ".LOG")
    SENDSTRING(NOTEPAD&, "\r XProfan is simply pointed!")
    SENDSTRING(NOTEPAD&, "\r but the know Yes ohnehin any!")
    SENDSTRING(NOTEPAD&, "\n Greeting, Thomas - 2007,  P.woodpecker - 2019)")

ENDIF

END
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
01/03/19  
 




Manfred
Barei
functions so too under Win10
 
XProfan X2
Zu wenig Wissen ist gefärlich, zu viel auch.(XProfan X4) | Win 10 Pro 64 | Win7 Ultimate 32/64 | AMD FX-8320, 16GB, GeForce GT 630 |
01/03/19  
 



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

4.626 Views

Untitledvor 0 min.
Sven Bader05/23/23
RudiB.04/25/22
funkheld01/01/22
Torsten Boo09/02/21
More...

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