cmattb Posted December 13, 2008 Share Posted December 13, 2008 Alright, so a twist on the code from _WinGetCtrlInfo(), . Eventually, Ill have it list the control class, ID, and names of the controls of the active window to a text file. We do alot of automations of drivers and software, and by making it easier for our install technicians to log this stuff will help me alot. Im new to DLL's, and it's starting to become a headache for me. I keep getting blank as the result of $wintext. Im sure I just have something wrong in the DLLCall.Anyone know DLL's well enough to give me a hand? Thanks in advance.expandcollapse popupHotKeySet("!^s", "capture") While 1 sleep(500) WEnd func capture() Global $Array = _WinGetCtrlInfo(WingetTitle("[ACTIVE]")) Global $sOne = '[0][0] = ' & $Array[0][0] & @CR, $sTwo For $iCC = 1 To $Array[0][0] $sOne &= '[' & $iCC & '][0] = ' & $Array[$iCC][0] & @CR $sTwo &= '[' & $iCC & '][1] = ' & $Array[$iCC][1] & @CR Next winactivate("Untitled - Notepad") MsgBox(64, 'WinInfo', StringTrimRight($sOne, 1) & @CR & StringTrimRight($sTwo, 1)) Exit EndFunc Func _WinGetCtrlInfo($hWin) If IsString($hWin) Then $hWin = WinGetHandle($hWin) Local $sClassList = WinGetClassList($hWin), $iAdd = 1, $aDLL, $ctrl_hwnd, $sHold Local $aSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF), $aReturn[1][2] For $iCount = $aSplitClass[0] To 1 Step - 1 Local $nCount = 0 While 1 $nCount += 1 If ControlGetHandle($hWin, '', $aSplitClass[$iCount] & $nCount) = '' Then ExitLoop If Not StringInStr(Chr(1) & $sHold, Chr(1) & $aSplitClass[$iCount] & $nCount & Chr(1)) Then $sHold &= $aSplitClass[$iCount] & $nCount & Chr(1) $iAdd += 1 ReDim $aReturn[$iAdd][2] $aReturn[$iAdd - 1][0] = $aSplitClass[$iCount] & $nCount ;something below here is wrong------------------------------------------------------------------------------------------------------------------- $aDLL = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', ControlGetHandle($hWin, '', $aSplitClass[$iCount] & $nCount)) $DLLstr = DllStructCreate("char var1[128]") $aDLL1 = DLLCall("user32.dll","str","GetDlgItemText","hwnd",ControlGetHandle($hWin, '', $aSplitClass[$iCount] & $nCount),"int",$aDLL[0],"LPTSTR",DllStructGetPtr($DLLstr, "var1")) $wintext = DllStructGetData($DLLstr,1) ;something above here is wrong------------------------------------------------------------------------------------------------------------------- If @error = 0 Then $aReturn[$iAdd - 1][1] = $wintext Else $aReturn[$iAdd - 1][1] = @error EndIf EndIf WEnd Next $aReturn[0][0] = $iAdd - 1 Return $aReturn EndFunc Link to comment Share on other sites More sharing options...
cmattb Posted December 14, 2008 Author Share Posted December 14, 2008 Nevermind, Im dumb. ControlGetText () does exactly what I need. Link to comment Share on other sites More sharing options...
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