Hi All and mods, please don't be misled by the Delphi reference on the subject. I chose to post in VB6 forum because I only have the code for the VB6 User Control and absolutely no power over the Delphi part.

So the situation is this: There is this Win32 EXE created in Delphi that can load COM user controls made in Delphi or VB6. I have created a user control dll in VB6 the delphi app to load. The app picks my dll by looking at some designated folder during startup. Seems straightforward but no; please read on.

My first problem then was that any textbox within my user control doesn't respond to navigation keys and CTRL+V and CTRL+C when embedded into the delphi app. In fact I had a thread about this problem way back January. Somehow this problem was fixed by a seemingly simple un-complicated code similar to shortcut key solution posted by Hack in this thread.

A snippet of which can be found below.
Code:
Do While Not bCancel
        'wait for a message
        WaitMessage
        'check if it's a HOTKEY-message
        If PeekMessage(Message, Me.hWnd, WM_HOTKEY, WM_HOTKEY, PM_REMOVE) Then
            'minimize the form
            WindowState = vbMinimized
        End If
        'let the operating system process other events
        DoEvents
    Loop
(Also, I've tested the one using APIs with the same result as above )
Code:
while(getmessage)
translatemessage
dispatchmessage
if condition is false  then
break
end if
loop
All is well the next few months after that until today. Always there will be an even bigger problem that'll defeat the last one. This time it's a side-effect to the solution of the problem I mentioned before.

What's happening now is that, when my user-control is loaded with the fix above, the shortcuts of the menu items on the delphi app itself is not working properly. Especially application-set shortcuts that start with CTRL, i.e. CTRL+T, CTRL+G, etc., don't work anymore. If I unload my usercontrol, the delphi app works fine and can respond to CTRL+key shortcuts.

Looking at SPY++, I can tell that the delphi app is not using RegisterHotKey api for its shortcuts and probably uses normal shortcuts like you would specify onto a VB Menu bar.

So my question are the following:

1. Why is this happening?
2. Is the delphi app starving the usercontrol of the keyboard navigation within textboxes when my usercontrol have only a textbox? Any ideas how this is doing it?
3. Is the my usercontrol starving the delphi app of the CTRL+key messages when I have the DoEvents loop code to solve the problem in 2? Any ideas how this is doing it?
4. I was never an expert at Windows internals so are there any other reason related to windows threading, messaging queues, event dispatching that has to do with CTRL keys that I am missing here which is causing the starvation on any one side of the app?
5. The other solution available to me so far is to remove the fix for the usercontrol navigation problem and implement my own keyboard navigation, keyboard selection and CTRL+V and CTRL+C without using API (Quite a pain). I would appreciate other simple unbloated c0d alternatives, like other APIs that doesn't require the loopy thing above perhaps.

I'm not a good story teller but I hope this has given a proper picture of my problem.

Please help.