English
Forum

Verify, whether file has just is used

 
- Page 1 -



Peter
Mallow
Hi,
how can one with Profan Verify, whether a File in use becomes.

i want z.B. a File copy with the copy-commands. If but the File straight of a others Program is used or the program opened is, comes a Error Message.
the would like I bypass.

Greeting
Peter
 
WinXP Pro SP2, XProfan 9 + XPSE
AMD Athlon 64 X2 3800
11/17/07  
 



 
- Page 1 -


whether it itself circa a Exe or otherwise a File deals game no role. an executed Exe is imho usually readable. in order to Verify whether readable read ioresult to assign and openrw from. whether a exe however grade carryed out becomes is hardly directly messbar, be because You can The executed Exe self program so these on possible inquire answer. the however is the Topic of Prozesskommunikation and not reading of opened Files or. Verify, whether file has just is used.
 
11/17/07  
 




Peter
Mallow
Okay, thanks. functions now:
CompileMarkSeparation
 
WinXP Pro SP2, XProfan 9 + XPSE
AMD Athlon 64 X2 3800
11/17/07  
 



Überarbeitet:
CompileMarkSeparation
 
11/17/07  
 




Peter
Mallow
is the XProfan 10 code?
 
WinXP Pro SP2, XProfan 9 + XPSE
AMD Athlon 64 X2 3800
11/17/07  
 



Yes, XProfan10 code! You write You would have XProfan10, Why testest You it because not simply?
 
11/17/07  
 




Peter
Mallow
No, Have only XProfan 9. and 9 knows whom Var commands not. But in the principle the same code, or?
 
WinXP Pro SP2, XProfan 9 + XPSE
AMD Athlon 64 X2 3800
11/17/07  
 



Nimm the var simply lane and deklariere The with var led variables by Declare, the code having yet a Error.
 
11/17/07  
 




RGH
Peter Mallow
No, Have only XProfan 9. and 9 knows whom Var commands not. But in the principle the same code, or?


Hello Peter,
there XProfan 9 Assign too not yet as function knows, should You with your Variante the Codes stay.

Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
11/18/07  
 



Ah! well true...
 
11/18/07  
 



 
- Page 2 -



Michael
Dell
whether a EXE carryed out becomes sees one herewith:
CompileMarkSeparation
Suchen und beenden von Prozessen (Programmen)
1.) Parameter = DateiName$ (ohne Pfad)
2.) Parameter = 0 - Prozess nicht beenden / 1 - Prozess beenden  (falls vorhanden)
Autor: nicht bekannt!
Bearbeitet: Michael Dell
Def ProcessSnapshot(2)  !KERNEL32.DLL,CreateToolhelp32Snapshot
Def ProcessFirst(2)     !KERNEL32.DLL,Process32First
Def ProcessNext(2)      !KERNEL32.DLL,Process32Next
Def GetLastError(0)     !KERNEL32.DLL,GetLastError
Def OpenProcess(3)      !KERNEL32.DLL,OpenProcess
Def TerminateProcess(2) !KERNEL32.DLL,TerminateProcess
Def CloseHandle(1)      !KERNEL32.DLL,CloseHandle
Struct FOKP_PROCENTR32 = dwSize&,cntUsage&,th32ProcessID&,th32DefaultHeapID&,th32ModuleID&,cntThreads&,
th32ParentProcessID&,pcPriClassBase&,dwFlags&,szExeFile$(260)

Proc FindOrKillProcess

    Parameters FOKP_Process$,FOKP_Delete&
    Declare FOKP_NameLng&,FOKP_hSnapshot&,FOKP_Result&,FOKP_hProcess&,FOKP_ProcAnz&,FOKP_TermOk&,FOKP_PROCENTR#
    Dim FOKP_PROCENTR#,FOKP_PROCENTR32
    Clear FOKP_NameLng&,FOKP_hSnapshot&,FOKP_Result&,FOKP_hProcess&,FOKP_ProcAnz&,FOKP_TermOk&,FOKP_PROCENTR#
    Long FOKP_PROCENTR#,0 = SizeOf(FOKP_PROCENTR#)
    FOKP_NameLng&   = Len(FOKP_Process$)
    FOKP_Process$   = Lower$(FOKP_Process$)
    FOKP_hSnapshot& = ProcessSnapshot(2, 0)

    IfNot FOKP_hSnapshot& = -1

        FOKP_Result& = ProcessFirst(FOKP_hSnapshot&, FOKP_PROCENTR#)

        While FOKP_Result&

            If  Lower$(Right$(FOKP_PROCENTR#.szExeFile$,FOKP_NameLng&)) = FOKP_Process$

                If FOKP_Delete& = 1

                    FOKP_hProcess& = OpenProcess(1, 0, FOKP_PROCENTR#.th32ProcessID&)
                    FOKP_TermOk& = TerminateProcess(FOKP_hProcess&, 0)
                    CloseHandle(FOKP_hProcess&)
                    sleep 100

                EndIf

                FOKP_ProcAnz& = FOKP_ProcAnz& + (FOKP_Delete&<>1) + FOKP_TermOk&

            EndIf

            FOKP_Result& = ProcessNext(FOKP_hSnapshot&, FOKP_PROCENTR#)

        EndWhile

    EndIf

    CloseHandle(FOKP_hSnapshot&)
    Dispose FOKP_PROCENTR#
    Return Int(FOKP_ProcAnz&)

EndProc

Declare GL_DateiName$,GL_ProzessAnz&
GL_DateiName$ = TESTX.EXE
Cls
GL_ProzessAnz& = FindOrKillProcess(GL_DateiName$,0)

If GL_ProzessAnz&

    Print (GL_DateiName$ +  ist Aktiv)

Else

    Print (GL_DateiName$ +  ist Inaktiv)

EndIf

Print
Print
Print (Anzahl der Prozesse von q + GL_DateiName$ + q im Speicher:  + Str$(GL_ProzessAnz&))
Wai
End
 
Salu Michael...

Hab zwar krumme Fieß awer dofir e' ecklich Gsicht! 
11/18/07  
 



nice idea The processes To search!
 
11/18/07  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

7.281 Views

Untitledvor 0 min.
Sven Bader09/08/21
Klaus Ernst08/01/14
Jupp Fitten02/03/14

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