Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

selecting a menu item programatically in another app

Posted on 1998-08-01
3
Medium Priority
?
431 Views
Last Modified: 2013-12-03
I will like to select a menu item programatically. What I am doing (think should be done)  is_
1. Get a handle to the applications window using 'FindWindowEx'
          hWndApp = FindWindowEx(NULL,  NULL, NULL, AppCap);
2. Get a handle (HMENU) the the top level menu using 'GetMenu'
          hMMenu = ::GetMenu(hWndApp);
3. Get the Menu Handle (HMENU)  to the first entry in the menu (usually 'File') using 'GetSubMenu'
      hMItem1 = ::GetSubMenu(hMMenu, 0);
4. Then select the first entry in the 'FIle' menu item (usually 'New') using 'PostMessage'
      wParam = MAKEWPARAM( 0,  (WORD) MF_MOUSESELECT);
      x = ::PostMessage(hWndApp, WM_MENUSELECT, wParam,(LPARAM) hMItem1);

Well the problem is it is not working. Each of these calls return success. But it does not work.
Will the expert gurus point out the hole in my logic?

Thanks a lot.

0
Comment
Question by:robin_raul
[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
  • 2
3 Comments
 

Author Comment

by:robin_raul
ID: 1412905
Edited text of question
0
 

Author Comment

by:robin_raul
ID: 1412906
Edited text of question
0
 
LVL 11

Accepted Solution

by:
alexo earned 150 total points
ID: 1412907
Conssider a different approach:  Send a WM_COMMAND message with the ID of the menu item.  Works for me...
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 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