Sign in to follow this  
Followers 0
DieterMoeyersoon

How to read a ptr to a string (returned by WM_Settingchange

5 posts in this topic

Hello all,

in my program I would like to respond to the WM_Settingchange, so I use

GUIRegisterMsg($WM_SETTINGCHANGE , "WM_SETTINGCHANGE")

The lParam parameter is a pointer to a string (see http://msdn.microsoft.com/en-gb/library/windows/desktop/ms725497(v=vs.85).aspx). How can I read this string from memory?

I've tried already with DLLStruct, but this doesn't seem to work well (I also don't know the length of the string). In another topic I found a reference to using __SQLite_szStringRead from SQLite.au3 but this doesn't work either. Any help is welcome.

Func WM_SETTINGCHANGE($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg,$wParam
;$myString = __SQLite_szStringRead($lParam)
;$lParamString = DllStructCreate("char[128]", $lParam)
;$myString = DllStructGetData ($lParamString,1)
ConsoleWrite($myString & @cr)
EndFunc

Brgds

Dieter

Share this post


Link to post
Share on other sites



Have you read this note?

Note that some applications send this message with lParam set to NULL.

So it's not necessarily to have a pointer to a string.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Hi Andreik,

yes I've seen that but I know for sure in certain cases (eg Group Policy updates) it should be a pointer to a string (eg "Policy")...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

So, what exactly is the problem, if there is any anymore?

First you check if lParam is not 0, then you use e.g. _WinApi_StringLen on that pointer to size the struct made at lParam address and then just read the content. How hard is that?

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Hi trancexx,

this was indeed the function I was looking for.

Thanks for your help!

Share this post


Link to post
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
Sign in to follow this  
Followers 0