Solved

TranslateAccelerator and VB6 (SP6)

Posted on 2004-04-07
12
1,631 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.
0
Comment
Question by:g0rath
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
12 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 10775460
>>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.
0
 
LVL 5

Author Comment

by:g0rath
ID: 10775484
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?
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10775903
the email address is

steve @vbaccelerator.com

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

http://www.vbaccelerator.com

AW
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 17

Expert Comment

by:inthedark
ID: 10781108
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?
0
 
LVL 17

Expert Comment

by:inthedark
ID: 10781470
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?
0
 
LVL 5

Author Comment

by:g0rath
ID: 10782782
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.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10782893
yes, I have no problems whatsoever, accessing the site, both from Home (using AOL), and from work.

AW
0
 
LVL 5

Author Comment

by:g0rath
ID: 10783011
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.

0
 
LVL 5

Accepted Solution

by:
g0rath earned 0 total points
ID: 10785138
Ok guys, so I fixed this. It's actually just an issue of the VB IDE being a bit more particular in its type checking. After studying the module and getting the newer version of the subclassing module...I found out I just needed to change the reference in the IPOHookStruct to match up with which object I was using as my "super class" for lack of a better term.

It wasn't quite as generic as with SP5 but I can get it to work without too much hassle...as some would say "that's a bug not a feature" and when it was fixed it just caused me a few issues.

I'm going to ask for points refunded since I already had steve's email from the whois when I couldn't get my machine to access the main website if that's allright with you guys.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 10785420
No problem here
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question