Jump to content

Recommended Posts

Posted (edited)

I was messing with DLLcalls.. okay heres one.. (note: my conversion to autoit is not the best :D)

I assume i need handle rather then process name.. but dont know how to get it../ i know this is already built into autoit i just wanna try this with a real dllcall..

$Process = 'notepad.exe'
$ExitC = DllCall('kernel32.dll','None','GetExitCodeProcess','hwnd',$Process,'ptr',0)
DllCall('kernel32.dll','None','TerminateProcess','hwnd',$Process,'int',$ExitC)
Edited by slightly_abnormal
Posted (edited)

well.. heres at msdn it said void i assume it means none, or would that be ptr ?? at answeres.com it says long .. :D

$Process = 'notepad.exe'
$ExitC = DllCall('kernel32.dll','Long','GetExitCodeProcess','hwnd',$Process,'ptr',0)
DllCall('kernel32.dll','ptr','TerminateProcess','hwnd',$Process,'int',$ExitC)
Edited by slightly_abnormal
Posted (edited)

What? ProcessClose() does exactly what you are doing. What is the point of a second link?

BOOL TerminateProcess(
  HANDLE hProcess, // handle to the process
  UINT uExitCode   // exit code for the process
);

becomes

int TerminateProcess(
  void *hProcess,
  unsigned int uExitCode
);

and

BOOL GetExitCodeProcess(
  HANDLE hProcess,   // handle to the process
  LPDWORD lpExitCode   // termination status
);

becomes

int GetExitCodeProcess(
  void *hProcess,
  unsigned long *lpExitCode
);

HANDLE is not HWND. HANDLE = void* and HWND = HWND__*.

Edited by Icekirby1
Posted (edited)

[edit]

$Process = 'notepad.exe'
$Proc =  DllCall('kernel32.dll','Long','GetCurrentProcess','str',$Process)
$ExitC = DllCall('kernel32.dll','Long','GetExitCodeProcess','hwnd',$Proc,'ptr',0)
DllCall('kernel32.dll','ptr','TerminateProcess','hwnd',$Process,'int',$ExitC)
Edited by slightly_abnormal
Posted (edited)

okay heres another try .. why isn't there any processgethandle, processgetsate funcs btw?? do i need handle?

[edit] btw in the helpfile Int and long both say a 32 bit integer for whatever reason.. o.o

opt('wintitlematchmode',2)
$Winhandle = WinGetHandle('Untitled - Notepad')
$ProcH =  DllCall('kernel32.dll','int','GetCurrentProcess','hwnd',$Winhandle)
$ExitC = DllCall('kernel32.dll','int','GetExitCodeProcess','hwnd',$ProcH,'ptr',0)
DllCall('kernel32.dll','ptr','TerminateProcess','hwnd',$Winhandle,'int',$ExitC)
Edited by slightly_abnormal

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...