c = GetItemCount(XTPPopup Bar.hwnd) |
Post Reply |
Author | |
MrComment
Newbie Joined: 17 January 2014 Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 17 January 2014 at 10:47pm |
Hi everybody. My first post on the forum.
I have the pleasure of automating an external application via the Windows API thru MS Excel 2007 VBA. One of the context menus in this application is a Window Class called "XTPPopup Bar". Which is why I'm here, since a little bit of Googling came short list mostly to CodeJock hits. Seems like this is as good a place as any to post my problem. '''''''''''''' Example code: '''''''''''''' Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long Private Sub Foo_Bar() Dim hSysMenu As Long, nCnt As Long hSysMenu = '+ some working code to get the window handle for an active window class "XTPPopup Bar", not shown because its on the other computer.) nCnt = GetMenuItemCount(hSysMenu) '''''''''' The problem is that when GetMenuItemCount is executed the Result is always -1, so not the number of items in the context menu. Obviously, -1 is an error however the error code is 0. As you might of guessed I really dont exactly care how many items are in the context menu. Since my ultimate goal is to find desired command's ID so that I can post a left mouse click to it. With that said attempting to return any of the menu strings always comes up blank. Declare Function GetMenuString Lib "user32" Alias "GetMenuStringA" (ByVal hMenu As Long, ByVal wIDItem As Long, ByVal lpString As String, ByVal nMaxCount As Long, ByVal wFlag As Long) As Long I would prefer to find a way which doesn't require the application to keep focus so that I can post the left mouse click. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |