We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

TranslateAccelerator and VB6 (SP6)

g0rath
g0rath asked
on
Medium Priority
1,796 Views
Last Modified: 2007-12-19
I've been in development for a few months on a large project. Upon upgrading to SP6 the OleInPlace module breaks. This code was from www.vbaccelerator.com. Now this site has been down for over a month now, so now I'm either having to remove SP6 and return to SP5 or I need to find another solution.

BTW the code now breaks in the mIOleInPlaceActiveObject.bas file

Public Type IPAOHookStruct 'IOleInPlaceActiveObjectHook
    lpVTable As Long 'VTable pointer
    IPAOReal As IOleInPlaceActiveObject 'Un-AddRefed pointer for forwarding calls
    TBEx As ListView   'Un-AddRefed native class pointer for making Friend calls
    ThisPointer As Long
End Type

in function


Private Function TranslateAccelerator(This As IPAOHookStruct, lpMsg As VBOleGuids.msg) As Long
Dim hRes As Long
   
   ' Check if we want to override the handling of this key code:
   hRes = S_FALSE
   hRes = This.TBEx.TranslateAccelerator(lpMsg)
   If hRes Then
      ' If not pass it on to the standard UserControl TranslateAccelerator method:
      hRes = This.IPAOReal.TranslateAccelerator(ByVal VarPtr(lpMsg))
   End If
   TranslateAccelerator = hRes

End Function


Basically, the TBEx is a place holder for the object that you want to take control of.
The object of the game is to make a structure that you can remove the pointer reference and point it to the object of your choice and intercept the ALT, TAB or the Accelerator keys.

The issue appears to be that the VB IDE is doing a "better" job of type checking.

Since it's declared as type ListView it's really just a placeholder.
CopyMemory takes this 4 byte region and points the form of your choice to here, and it has the member function TranslateAccelerator. Late binding. You can't change this to type Object because a Variant can't be coerced unless  in a public module.

So if anyone has found a solution yet, or another way of intercepting the Accelerators it would be most helpful.
Comment
Watch Question

>>Now this site has been down for over a month now

If you're talking about vbaccelerator, it hasn't been down, and if you email Steve (the owner of the site) he will almost certainly respond to answer your question.

Author

Commented:
well I've been trying to look up an email for the site...haven't seen it....I've only been reading up docs via the google cache.

So I would assume the addreses listed at the WHOIS listing is correct?
the email address is

steve @vbaccelerator.com

you can find the link at the very bottom of the page

http://www.vbaccelerator.com

AW
CERTIFIED EXPERT

Commented:
You can download and edit the type library source and replace with some other reference.  I have never changed a type library so I can't tell you how you do that.

The version I downloaded from vbAccelerator declared this structure like this:

Private Type IPAOHookStruct             'IOleInPlaceActiveObjectHook
    lpVTable As Long                    'VTable pointer
    IPAOReal As IOleInPlaceActiveObject 'Un-AddRefed pointer for forwarding calls
    NativeClassPointer As Long          'Un-AddRefed native class pointer for making Friend calls
    ThisPointer As Long
End Type

I also downloaded & loaded, registered and added as references ISHF_ex.tlb & OLEGUIDS.tlb.

I wonder what else won't work with SP6?
CERTIFIED EXPERT

Commented:
What happens if you add the references to you project and import the classes and module into your project to run as local private classes?

Author

Commented:
this is a project that was working fine with SP5, had all the .tlb files referenced etc....so I'm wanting to change it to work, but not really hack up the class...waiting for Steve's response and I'm moving on ahead with it.

BTW it sounds like everyone can actually access this website? I haven't been able to access it from work, home, or from some server in another state for a couple of months.
yes, I have no problems whatsoever, accessing the site, both from Home (using AOL), and from work.

AW

Author

Commented:
yeah this is really weird...but now I remember that I didn't try it at home....too tired :)

I can't access it from work, so I think no problem, I just set up a proxy and send all requests through to another site...still doesn't work with my W2K IE6 setup....but under my Linux box, the one that I have the proxy through....it can connect via Lynx....so I don't have time to figure out the Browser issue...so I'll just get the latest version of everything and try again.

Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
No problem here
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.