Page 3 of 9
Posted: Mon Sep 24, 2007 4:56 pm
by srod
I'll just point out here that #OnUnhandledWinMessage is a rather specialised event and does require some careful treatment and a good read of the EasyVENT user guide.
This event is sent in the form of the underlying Windows message and consequently you should handle this accordingly.
For example, a #OnButtonClick event is, at the outset, sent to the #OnButtonClick handler attached to the underlying button.
However, at the Windows level this message corresponds to a #BN_CLICKED command message sent to the parent window of the button. Hence, if you are looking to process this event in response to a #OnUnhandledWinMessage message, then you must look for it in the #OnUnhandledWinMessage handler attached to the parent window of the button. It’s an important point and one which has caused a few developers a few headaches!

Posted: Wed Oct 10, 2007 11:29 pm
by DoubleDutch
Is it possible to replace the "GetAncestor_(" function in EasyVent with GetParent or some combination of GetParent(s) that does the same job as Get Ancestor?
The reason is that by using GetAncestor you automatically stop Windows 95 machines from running programs that use EasyVent.
As I understand it, GetAncestor is the same as GetParent, but with added flags to go further back through the chain?
It seems a pity to do this for one (possibly replaceable) call.
Posted: Wed Oct 10, 2007 11:39 pm
by srod
The only place where I use GetAncestor_() (or at least the only reason I use it) is in order to be able to interface correctly with PB's drag/drop library.
As such, in order to trap #PB_Event_GadgetDrop in a subclassed procedure, I need to subclass the root ancestor which is the one receiving #PB_Event_GadgetDrop etc. If you remove the GetAncestor_() then either replace it with multiple GetParents_() in a loop or you'll have to make do without the drag / drop functionality etc.
Posted: Thu Oct 11, 2007 8:23 am
by DoubleDutch
I'll see what I can do about a replacement function, it looks like the GetAncestor isn't bug fixed until XP.
http://www.virtualdub.org/blog/pivot/entry.php?id=153
Posted: Thu Oct 11, 2007 8:36 am
by DoubleDutch
Here is a section of code that appears to work ok.
I don't know if you want to keep the CompilerIf in (just in case you have problems with it in the future). But it worked with #Win98Plus=#False on my tests.
It should fit in and replace just the If/EndIf section in your latest posted version, the #Win98Plus should go at the top of your code.
I don't think it noticably slows things down. Please let me know what you think.
Code: Select all
#Win98Plus=#False
If evtype = #OnDropItem
CompilerIf #Win98Plus=#True
anchWnd = GetAncestor_(hwnd, 2)
CompilerElse
anchWnd=hwnd
tempAnchWnd=GetParent_(hwnd)
While Not tempAnchWnd
anchWnd=tempAnchWnd
tempAnchWnd = GetParent_(tempAnchWnd)
Wend
CompilerEndIf
result*EventRegisterControl(anchWnd)
EndIf
ProcedureReturn result
Posted: Thu Oct 11, 2007 10:54 am
by srod
Hi,
why not use OSVersion() ?
Posted: Thu Oct 11, 2007 11:54 am
by DoubleDutch
Because the "GetAncestor_" causes it to crash while loading, not executing.
If you opened the system dll and then checked and called it by name then you can use OSVersion().
When you use the _() versions of calls, then you have to be sure that the library is installed on the system before execution.
Posted: Thu Oct 11, 2007 11:56 am
by DoubleDutch
I've tested your code with the mod I made and it works perfect with drag/drop on Win95 thru Vista.

Posted: Thu Oct 11, 2007 12:01 pm
by srod
DoubleDutch wrote:Because the "GetAncestor_" causes it to crash while loading, not executing.
If you opened the system dll and then checked and called it by name then you can use OSVersion().
When you use the _() versions of calls, then you have to be sure that the library is installed on the system before execution.
Ah, I didn't realise it was crashing on compilation or loading - I thought it was a runtime issue.
Now do I add this to the official package...? Anyone using Win 95 should be shot anyhow!

Posted: Thu Oct 11, 2007 12:03 pm
by srod
DoubleDutch wrote:I've tested your code with the mod I made and it works perfect with drag/drop on Win95 thru Vista.

Actually I think the OSVersion() is the way to go rather than ask the user to define a constant etc. I will adjust EasyVENT and load up the function through OpenLibrary_() etc.
Thanks.
Posted: Thu Oct 11, 2007 12:04 pm
by DoubleDutch
imho, you should add it as the default "compilerif" because (if you go to the link) you will see that even if it loads then that function is unstable until XP.
Even if the function is there - it can have unpredictable results.
I have no idea how microsoft messed up such a simple function for 6 years! :roll:
Posted: Thu Oct 11, 2007 12:12 pm
by srod
I've simply removed the GetAncestor_() then in favour of your code - no conditional compilation.

It won't effect performance as it's only used when registering the drop event handlers anyhow.
I'll upload an update presently because I made one or two other alterations anyhow.
Thanks.
Posted: Thu Oct 11, 2007 12:12 pm
by DoubleDutch
I only made it a "compilerif" so that in the future if you suspected it was a problem you could easily test it.
What is great is running a program that has drag/drop and all then event stuff and it working on EVERY variety of windows since 95!

Posted: Thu Oct 11, 2007 12:27 pm
by srod
11th October 2007. (Purebasic 4.1 onwards).
Release version 3.1.
Release version 3.1 incorporates all of the 3.0.x betas + the following :
- Code supplied by DoubleDutch (my thanks) to make EasyVENT more compatible with Win 95 (boo!) 98 / ME etc.
- Adjusted the events #OnItemSelected and #OnItemSelecting when used with panel gadgets. The developer is now informed how the user attempted to select a tab (mouse or keyboard etc.)
Anyone coming from earlier versions of EasyVENT who has not kept up with the version 3.0.x betas will need to read through the alterations detailed in the first post regarding these betas as there have been some significant updates / upgrades etc.
See the first post for the download link.
Posted: Thu Oct 11, 2007 2:59 pm
by DoubleDutch
Tested it, no problems here - works great!
