From: Kuenga on
Hi,

I have used third party menu bar to get the Visual Studio type Menu.
When I run VBScript like SendKeys "%FO", the menu bar doesnot respond.
The VBScript sends the following message:-

WM_SETCURSOR
WM_SYSCOMMAND
WM_ENTERMENULOOP
WM_SETCURSOR
WM_INITMENU
WM_MENUCHAR
WM_CAPTURECHANGED
WM_MENUSELECT
WM_EXITMENULOOP
WM_PAINT

The VBScript is meant to select the File from Menu and then Open.

Previous the script worked since CMenu was being used. Now we are
using third party menu bar which does Not respond to the above
message, since CMenu has been removed by the third party and they had
used their own Menu bar derived from CControl Bar to provide the Menu
feature.

So wanted to know how to send message to menu bar from the VBscript ?

Thanks

From: David Ching on

"Kuenga" <sagkumar(a)gmail.com> wrote in message
news:5129d204-25db-44bb-9594-418048f37a3f(a)y22g2000prd.googlegroups.com...
> Hi,
>
> I have used third party menu bar to get the Visual Studio type Menu.
> When I run VBScript like SendKeys "%FO", the menu bar doesnot respond.
> The VBScript sends the following message:-
>
> WM_SETCURSOR
> WM_SYSCOMMAND
> WM_ENTERMENULOOP
> WM_SETCURSOR
> WM_INITMENU
> WM_MENUCHAR
> WM_CAPTURECHANGED
> WM_MENUSELECT
> WM_EXITMENULOOP
> WM_PAINT
>
> The VBScript is meant to select the File from Menu and then Open.
>
> Previous the script worked since CMenu was being used. Now we are
> using third party menu bar which does Not respond to the above
> message, since CMenu has been removed by the third party and they had
> used their own Menu bar derived from CControl Bar to provide the Menu
> feature.
>
> So wanted to know how to send message to menu bar from the VBscript ?
>

Run Spy++ to capture messages received by your main window when you manually
type Alt+F, O. These are the messages your VBScript needs to send (or
post).

FWIW, I think SendKeys() uses either keybd_event() or SendInput() to
manually generate keyboard events at a very low level (the level above the
hardware-generated events) which Windows then uses interprets and generates
the above WM_ messages. I don't think SendKeys() generates WM_ messages
directly. You could investigate just generating the raw keystrokes, if
you're sure your window has the focus when the script is run.

-- David


From: Kuenga on
On Apr 30, 3:58 pm, "David Ching" <d...(a)remove-this.dcsoft.com> wrote:
> "Kuenga" <sagku...(a)gmail.com> wrote in message
>
> news:5129d204-25db-44bb-9594-418048f37a3f(a)y22g2000prd.googlegroups.com...
>
>
>
>
>
> > Hi,
>
> > I have used third party menu bar to get the Visual Studio type Menu.
> > When I run VBScript like SendKeys "%FO", the menu bar doesnot respond.
> > The VBScript sends the following message:-
>
> > WM_SETCURSOR
> > WM_SYSCOMMAND
> > WM_ENTERMENULOOP
> > WM_SETCURSOR
> > WM_INITMENU
> > WM_MENUCHAR
> > WM_CAPTURECHANGED
> > WM_MENUSELECT
> > WM_EXITMENULOOP
> > WM_PAINT
>
> > The VBScript is meant to select the File from Menu and then Open.
>
> > Previous the script worked since CMenu was being used. Now we are
> > using third party menu bar which does Not respond to the above
> > message, since CMenu has been removed by the third party and they had
> > used their own Menu bar derived from CControl Bar to provide the Menu
> > feature.
>
> > So wanted to know how to send message to menu bar from the VBscript ?
>
> Run Spy++ to capture messages received by your main window when you manually
> type Alt+F, O.  These are the messages your VBScript needs to send (or
> post).
>
> FWIW, I think SendKeys() uses either keybd_event() or SendInput() to
> manually generate keyboard events at a very low level (the level above the
> hardware-generated events) which Windows then uses interprets and generates
> the above WM_ messages.  I don't think SendKeys() generates WM_ messages
> directly.  You could investigate just generating the raw keystrokes, if
> you're sure your window has the focus when the script is run.
>
> -- David- Hide quoted text -
>
> - Show quoted text -

Thanks David. The problem I when i debug, the message sent by VBScript
goes to the VS IDE, since it has got the focus because of the
breakpoint.
The script is written using enable32.dll.

Is it possible to get the ID of a menu item in the OnMenuChar function
when WM_MENUCHAR message is ID. I see when this message is posted, I
get char and CMenu but I donot get the ID, on which the user wants to
pass message to the my window through script.

The problem is by using the third party implemenation for VS IDE type
Menu Bar, it has removed the system menu and instead put its buttons
in place which receive the ON_COMMAND message, but VBScript is sending
the Menu messages, so the Menu bar does not recognise it and does not
do anything.

I think the problem will be resolved if I get the ID, in which the
script wants to send the message and I do SendMessage in WindowProc
function.

But when the script is played I donot know on which ID its wants to
send message, since it works on shortcuts like Alt+F,O. In an hellow
world MFC application pressing ALt+F goes to OnMenuChar but in my
application the control does not go there.
I donot have control between the two third parties I am using. I need
to implement a bridge to communicate between the two.
From: David Ching on

"Kuenga" <sagkumar(a)gmail.com> wrote in message
news:c776b644-357b-4651-8201-7565af1460b1(a)c19g2000prf.googlegroups.com...
> Thanks David. The problem I when i debug, the message sent by VBScript
> goes to the VS IDE, since it has got the focus because of the
> breakpoint.
>
> The script is written using enable32.dll.

Perhaps you could show the script, or part of it. I'm confused whether the
script calls SendKeys("%FO") or some functions of enable32.dll (which I
found to be from Cypress Software). I had thought the script called
SendKeys("%FO"). In that case it wouldn't matter whether the app used CMenu
or some custom control bar, as long as it reacted to Alt+FO correctly when
the user typed it manually.

Thanks,
David


From: Kuenga on
On May 1, 5:23 pm, "David Ching" <d...(a)remove-this.dcsoft.com> wrote:
> "Kuenga" <sagku...(a)gmail.com> wrote in message
>
> news:c776b644-357b-4651-8201-7565af1460b1(a)c19g2000prf.googlegroups.com...
>
> > Thanks David. The problem I when i debug, the message sent by VBScript
> > goes to the VS IDE, since it has got the focus because of the
> > breakpoint.
>
> > The script is written using enable32.dll.
>
> Perhaps you could show the script, or part of it.  I'm confused whether the
> script calls SendKeys("%FO") or some functions of enable32.dll (which I
> found to be from Cypress Software).  I had thought the script called
> SendKeys("%FO").  In that case it wouldn't matter whether the app used CMenu
> or some custom control bar, as long as it reacted to Alt+FO correctly when
> the user typed it manually.
>
> Thanks,
> David

Hi,

Here is one of the script:-

SUB TmpMacro
'MACROMENU
'MACROKEY
'MACRODESCRIPTION
SendKeys "%FND", TRUE
END SUB

It is for File New Design.

Enable32.dll sends the message like WM_MENUCHAR, WM_MENUSELECT etc as
stated above. Since I have used a third party to implement dockable
menu bar, CMenu is removed by the third party and instead of menu it
has put menu buttons.
Alt+F does work, since it generates WM_COMMAND message with ID as the
parameters. But enable32 sends other message which the third party
menu bar implementation is not interpreting correctly.

Any idea how to make the script work in the third party implementaion
of the dockable menu bar ?