strikeraid Posted August 14, 2009 Posted August 14, 2009 (edited) 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 August 14, 2009 by strikeraid
DW1 Posted August 14, 2009 Posted August 14, 2009 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 AutoIt3 Online Help
trancexx Posted August 15, 2009 Posted August 15, 2009 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now