Page 1 of 1
Separately for WinXP
Posted: Fri Jun 30, 2023 2:18 am
by AZJIO
I use this code to make the program work on WindowsXP, but I still get an error calling ChangeWindowMessageFilter.
Code: Select all
If OSVersion() > #PB_OS_Windows_Vista
ChangeWindowMessageFilter_(#WM_DROPFILES, #MSGFLT_ADD)
ChangeWindowMessageFilter_(#WM_COPYDATA, #MSGFLT_ADD)
ChangeWindowMessageFilter_(73, #MSGFLT_ADD)
EndIf
If I remove this code, it works on WindowsXP
Re: Separately for WinXP
Posted: Fri Jun 30, 2023 3:29 am
by BarryG
What exactly is the error message, and what is the question?
Re: Separately for WinXP
Posted: Fri Jun 30, 2023 3:37 am
by jacdelad
Thank god, I'm not the only one who doesn't understand the question.
Anyway, look here:
https://learn.microsoft.com/en-us/windo ... sagefilter
Minimum is Windows Vista/Server 2008.
Re: Separately for WinXP
Posted: Fri Jun 30, 2023 4:40 am
by BarryG
Okay, I'm guessing that because ChangeWindowMessageFilter is not available on XP, the code won't compile due to the unavailable API.
So, AZJIO, you might need to try something like below. It's how I used to deal with such errors in the past when an API wasn't supported by an OS.
I give no guarantee that the below code will work.
Code: Select all
Procedure ChangeWindowMessageFilter(param1,param2)
lib=OpenLibrary(#PB_Any,"user32.dll")
If lib
CallFunction(lib,"ChangeWindowMessageFilter",param1,param2)
CloseLibrary(lib)
EndIf
EndProcedure
ChangeWindowMessageFilter(#WM_DROPFILES,#MSGFLT_ADD)
Re: Separately for WinXP
Posted: Fri Jun 30, 2023 7:28 am
by AZJIO
BarryG wrote: Fri Jun 30, 2023 4:40 am
So, AZJIO, you might need to try something like below.
Thanks It works
jacdelad wrote: Fri Jun 30, 2023 3:37 am
Anyway, look here:
This information is known to me.
I use this code in 3 programs, two of which can run on WinXP (
ContMenuFiles и
zRegistration). The function allows you to drag and drop exe-files into the program window when working as an administrator. Without this code, you cannot drag and drop files from a program opened as a user into a program opened as an administrator. Receiver rights must be the same or lower, but not vice versa
Re: Separately for WinXP
Posted: Fri Jun 30, 2023 8:03 am
by RASHAD
In that case
MSDN
[Using the ChangeWindowMessageFilter function is not recommended, as it has process-wide scope. Instead, use the ChangeWindowMessageFilterEx function to control access to specific windows as needed. ChangeWindowMessageFilter may not be supported in future versions of Windows.]
Re: Separately for WinXP
Posted: Fri Jun 30, 2023 9:19 am
by NicTheQuick
BarryG wrote: Fri Jun 30, 2023 4:40 amCode: Select all
Procedure ChangeWindowMessageFilter(param1,param2)
lib=OpenLibrary(#PB_Any,"user32.dll")
If lib
CallFunction(lib,"ChangeWindowMessageFilter",param1,param2)
CloseLibrary(lib)
EndIf
EndProcedure
ChangeWindowMessageFilter(#WM_DROPFILES,#MSGFLT_ADD)
I think the better way is to use prototypes:
Code: Select all
Prototype ChangeWindowMessageFilter.i(message.i, dwFlag.i)
Global ChangeWindowMessageFilter.ChangeWindowMessageFilter = 0
Define lib_user32.i = OpenLibrary(#PB_Any, "user32.dll")
If lib_user32
ChangeWindowMessageFilter = GetFunction(lib_user32, "ChangeWindowMessageFilter")
EndIf
Besides of that it is also better to not open the library everytime you want to call that function. Just load it once and you're fine.
Disclaimer: I did not test my code since I don't own Windows. Please correct me if I did something wrong.