IanN1990 Posted April 11, 2012 Posted April 11, 2012 (edited) I had to take a break from autoit coding because of uni work but i want to get back into it. One of the projects i was working on was working with chat-programs. Opt('WinTitleMatchMode', 2 ) while 1 sleep(250) ;Show Chat Messages $Steam = WinGetState("- Chat", "") If _Flash("- Chat") <> 0 Then if BitAnd($Steam, 16) Then WinSetState("- Chat","",@SW_RESTORE) EndIf EndIf Wend Func _Flash($win) If WinActive($win) Then Return 0 $tFLASHWINFO = DllStructCreate("uint;hwnd;dword;uint;dword") DllStructSetData($tFLASHWINFO, 1, 20) DllStructSetData($tFLASHWINFO, 2, WinGetHandle($win)) $a = DllCall("user32.dll", "int", "FlashWindowEx", "ptr", DllStructGetPtr($tFLASHWINFO)) Return $a[0] EndFunc I dont understand the _Flash Function, but when steam gets a message "turning orange" to detects this. Checks the chat-program is minimized and if so, restores it. "Making it so, when i get a message from someone it shows me the message". Now the problem is, though this code works for steam chat it doesn't work for msn or skype. "Same code but using skype/msn window titles". So i was wondering if everyone does understand this function, and could help me understand why it doesn't work for these two applications. Edited April 14, 2012 by IanN1990
DCCD Posted April 12, 2012 Posted April 12, 2012 FlashWindowEx function flashes the specified window, btw already exists on WinAPI library called _WinAPI_FlashWindowEx, and about detect flashing window, I think RegisterShellHookWindow function can do the job.seeya. [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group
IanN1990 Posted April 12, 2012 Author Posted April 12, 2012 Aye, as you have already pointed out there are Autoi functions which is/are able to make applications flash As for the detection, i checked out ur RegisterShellHookWindow link but honestly cant make heads or tails of it
rover Posted April 13, 2012 Posted April 13, 2012 (edited) There are numerous posts on this look for RegisterShellHookWindow / HSHELL_FLASH events some links here Intercepting a Window Message edited from an example by Siao expandcollapse popup;from Siao example ;http://www.autoitscript.com/forum/topic/56536-easy-shell-hooking-example/ ;#NoTrayIcon Opt("WinWaitDelay", 0) ;OnAutoItExitRegister("_OnExit") HotKeySet("{ESC}", "_OnExit") ;ShellHook notification codes: Global Const $HSHELL_FLASH = 32774; Global $bHook = 1 ;GUI stuff: Global $hGui = GUICreate("", 1, 1, -100, -100) ;Hook stuff: GUIRegisterMsg(RegisterWindowMessage("SHELLHOOK"), "HShellWndProc") ShellHookWindow($hGui, $bHook) While 1 Sleep(1000) WEnd Func _OnExit() ShellHookWindow($hGui, 0) Exit EndFunc Func HShellWndProc($hWnd, $Msg, $wParam, $lParam) Switch $wParam Case $HSHELL_FLASH ConsoleWrite("-Window flash hWnd: " & $lParam & " (" & WinGetTitle($lParam) & ")" & @CRLF) EndSwitch EndFunc ;register/unregister ShellHook Func ShellHookWindow($hWnd, $bFlag) Local $sFunc = 'DeregisterShellHookWindow' If $bFlag Then $sFunc = 'RegisterShellHookWindow' Local $aRet = DllCall('user32.dll', 'int', $sFunc, 'hwnd', $hWnd) Return $aRet[0] EndFunc ;register window message Func RegisterWindowMessage($sText) Local $aRet = DllCall('user32.dll', 'int', 'RegisterWindowMessageW', 'wstr', $sText) Return $aRet[0] EndFunc Edited April 13, 2012 by rover I see fascists...
IanN1990 Posted April 13, 2012 Author Posted April 13, 2012 (edited) Thanks for your help rover and dccd with this code i should be able to get everything workin **Edit thanks again now when i get a message for steam, skype or msn it "restores" the message so i can see. Before it only worked for steam Nice to see projects coming togeather Edited April 13, 2012 by IanN1990
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