Jump to content

Intercept WM_GETDLGCODE


Recommended Posts

Hi all!

First of all, congratulation on this language and comunity.

Im making a script, and i need to detect if a listview from another application is updated.

I tried several _GUICTRL_Listview commands, and they dont work.

I found with Winspector that everytime it updates, a new event occurs. I need to detect it in order to run the rest of the script.

I search in the forum all day, but never found anything similar.

Here is my code:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Constants.au3>
$List = ControlGetHandle("Wintitle", "", "WinListClass9")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $List = ' & $List & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

Global Const $VK_RETURN = 0x0D ;Enter key
$wProcHandle = DllCallbackRegister("_WindowProc", "int", "hwnd;uint;wparam;lparam")
$wProcOld = _WinAPI_SetWindowLong($List, $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle))
Sleep(120000)
_WinAPI_SetWindowLong($List, $GWL_WNDPROC, $wProcOld)
DllCallbackFree($wProcHandle)

Func _WindowProc($hWnd, $Msg, $wParam, $lParam)
ConsoleWrite(@CRLF & $hWnd & $Msg & @CRLF)
Switch $Msg
  Case $WM_GETDLGCODE
   ConsoleWrite("Window Changed" & @LF)
   Return 0
EndSwitch
Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $Msg, $wParam, $lParam)
EndFunc   ;==>_WindowProc

Could someone put me some enlightment on how to detect that particular event? it can also be the (DLGC_WANTARROWS). I also uploaded a screenshot.

Kind regards, Ovvnage

post-72895-0-48643900-1338051562_thumb.j

Link to comment
Share on other sites

SetWindowLong + GWL_WNDPROC

http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591%28v=vs.85%29.aspx

Sets a new address for the window procedure.

You cannot change this attribute if the window does not belong to the same process as the calling thread.

Hi!

First of all, thank you for your interest.

I was reading you reply and searched more in forum about it, but i found no conclusive information about it.

It seems from your post, that you think i pretend to change something. I only want to know when it gets triggered. if i can read it is a bonus.

The control handle from the list i want to spy is

$List = ControlGetHandle("Wintitle", "", "WinListClass9")

Coul you please tell the a sample code for it?

For my tests, seems like Func _WindowProc( dont get called...

Kind regards

Link to comment
Share on other sites

@Ovvnage

but you can intercept control messages with external subclassing.

So you will have to listen for the listview messages directly (and not the window messages) and try what suits your purpose.

Edit: I just reread the topic and i think it would be possible to intercept window messages too. You have to try ;)

Edited by qsek
Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite
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...