|
-
Sep 4th, 2011, 09:48 AM
#1
Thread Starter
Lively Member
@LaVolpe: your Thunker
Hello LaVolpe!
I wanted to move the WndProc to the 'cSubclass' class from Paul Catons subclassing example.
I was trying this by implementing the interface in that class. - But it did not work:
The callback did not receive any message! - I don't understand, why it is working for other classes,
but not for the 'cSubclass' class itself. Do you know why this happens?
Anyway, this question is not so important, because I found your awesome improvment of this project:
http://www.xtremevbtalk.com/showthread.php?t=285517
=> One single class for everything. No TypeLib, no interface, no standard module needed! 
How are you achieving this exactly? - I just saw, that you are working with ordinals.
PS: I did work with the linked project from 2004. - Now I found the project from 2007:
http://www.planetsourcecode.com/vb/s...68737&lngWId=1
Did you change something later on?
But I also have some questions to it:
* I read, that the API SetWindowSubclass should be used for more stable subclassing.
http://www.classicvb.net/samples/HookXP/
Can you tell me please, how your projects is performing compared to SetWindowSubclass?
* In an article from Paul Caton and Steve McMahon I read, that it is not possible to subclass a form twice.
(e.g. subclassing the parent form out of a UserControl, where two controls are placed on that form)
http://www.vbaccelerator.com/home/vb...ks/article.asp
(please see paragraph "The World Is Never Enough")
But they also wrote that this is "currently". And since your template seems to be based on a later release,
I like to ask, if this would be possible without any problem?
PS: As solution this article suggests following:
"There are two possible ways to stop this happening: use ComCt32.DLL v6.0 subclassing (fixes all problems; the
downside is it requires new ASM code and only works on XP) or attempt to use the Windows Properties database again."
Do they mean with ComCtl32.DLL v6.0 Subclassing, the subclassing technique, which I mentioned in the first point?
(which after all is possible under earler versions of Windows than XP, acording to that first point)
What is meant with that Windows Properties database?
* A next thing which I noticed is, that you (and Paul Caton) are using the API IsBadCodePtr on several places.
But according this the MSDN database this API is obsolete - it is not working correctly in preemptive multitasking
environments:
"Important! This function is obsolete and should not be used. Despite its name, it does not guarantee that the
pointer is valid or that the memory pointed to is safe to use. For more information, see Remarks on this page."
http://msdn.microsoft.com/en-us/library/aa366712.aspx
Can this be a problem in your projects at any point?
* Your template features a TimerProc, while your example not - but it has an EnumFontFamProc instead.
Has this any reason? - I am asking, because I did add all of them to my code. 
* I also added two more security features:
1.) In case of window destroying, the window messages are not handled anymore. - This you avoid, that code like
Text1.Text = Message causes an exception, due to the fact, that Text1 got unloaded already.
Because checking for WM_DESTROY did not help (this message comes to late), I did use hex 90 (=144), which
came always short before WM_DESTROY. - But I did not find any documentation for this message number.
Do you know, for what it is for?
2.) I had the problem, that I did start the subclassing under Form_Initialize and had the Code Me.Caption = Message
in the window procedure. This caused a heavy endless loop, which did prevent me from starting the task manager.
I had to switch the user to be able to terminate the VBE.
That is why I added some simple code to prevent this problem. Are you interested in it?
Thank you in advance!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|