Jump to content

Using C++ in Autoit?


Recommended Posts

Search function in this forum isn't very accurate.

I want to use this : http://msdn.microsoft.com/en-us/library/ms633522%28VS.85%29.aspx : in my autoit script to retrieve the processID. wingetprocess and processexist won't work for my situation so I turned to another language. I remember reading about plugins? Could that be what I'm searching for? Or maybe even something to do with DLLs.

I'm going to continue to search the 1000 posts but in the meanwhile I thought someone could provide a quicker response. Going to go google it as well. Thanks.

(Don't think I need to post a script since I just need to get the ProcessID by window name.)

EDIT: Hmmm. Might not necessarily be C++. Read the bottom of that link and there's only vbscript and C#.

This thread is very informative about plugins. >_<

http://www.autoitscript.com/forum/index.php?showtopic=15279&st=160&p=710663&hl=plugin&fromsearch=1&#entry710663

Edited by strikeraid
Link to comment
Share on other sites

This works for the DLL call but I don't think it will be much different than WinGetProcess()...

$Pid = _processID("Untitled - Notepad")
If @error or $Pid = 0 Then
    MsgBox(0, "test", "error: " & @error)
Else
    MsgBox(0, "test", $Pid)
EndIf

Func _processId($WinTitle, $Wintext = "")
    $stPID = DllStructCreate("int")
    $hWnd = WinGetHandle($WinTitle, $Wintext)
    Local $aResult
    DllCall("User32.dll", "int", "GetWindowThreadProcessId", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPID))
    If @error Then Return SetError(@error, 0, 0)
    Return DllStructGetData($stPID, 1)
EndFunc   ;==>_processId
Link to comment
Share on other sites

This works for the DLL call but I don't think it will be much different than WinGetProcess()...

$Pid = _processID("Untitled - Notepad")
If @error or $Pid = 0 Then
    MsgBox(0, "test", "error: " & @error)
Else
    MsgBox(0, "test", $Pid)
EndIf

Func _processId($WinTitle, $Wintext = "")
    $stPID = DllStructCreate("int")
    $hWnd = WinGetHandle($WinTitle, $Wintext)
    Local $aResult
    DllCall("User32.dll", "int", "GetWindowThreadProcessId", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPID))
    If @error Then Return SetError(@error, 0, 0)
    Return DllStructGetData($stPID, 1)
EndFunc   ;==>_processId

There is a difference but you are not taking the advantage of it.

Btw, this function is within WinApi.au3 and it's description can be found in Autoit's help file.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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