473,809 Members | 2,506 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# WinAPI Clicking on menu items

2 New Member
I'm trying to click on a menu item inside a program called Media Subtitler and whatever I'm trying to do it's not working.

First, I tried to use the function GetMenu but it returned IntPtr.Zero. Then, I tried using the ALT key + using the first letter of my menu (F stands for file) but it did nothing. Then, I tried using a simple MOUSEDOWN and MOUSEUP messages but again, it did nothing (I also tried creating a loop that clicks on everything in that range but there was no click in that area).

What I clearly know is that I'm working on the correct window.

What am I doing wrong?

If someone wants to test it out you can download Media Subtitler for free and it doesn't weight that much.

Also, Here's the code I've been testing:
Expand|Select|Wrap|Line Numbers
  1. Process p = Process.Start(@"C:\Program Files\DivXLand\Media Subtitler\MediaSub.exe");
  2.         p.WaitForInputIdle(1500);
  3.         Thread.Sleep(3000);
  4.  
  5.         SetForegroundWindow(p.MainWindowHandle);
  6.         ShowWindow(p.MainWindowHandle, SW_MAXIMIZE);
  7.  
  8.         IntPtr handle = p.MainWindowHandle;
  9.  
  10.         SendMessage(handle, WM_NCHITTEST, 0, MakeLParam(18, 29));
  11.  
  12.         //for (int i = 0; i < 200; i++)
  13.         //{
  14.         //    for (int x = 0; x < 200; x++)
  15.         //    {
  16.         //        SendMessage(p.MainWindowHandle, WM_LBUTTONDOWN, 0, MakeLParam(i, x));
  17.         //        SendMessage(p.MainWindowHandle, WM_LBUTTONUP, 0, MakeLParam(i, x));
  18.         //    }
  19.         //}
  20.         //IntPtr menuItems = GetMenu(p.MainWindowHandle);
  21.         return;
  22.         //SendMessage(p.MainWindowHandle, WM_COMMAND, 6, 0);
  23.         SendMessage(p.MainWindowHandle, WM_KEYDOWN, VK_MENU, 0);
  24.         SendMessage(p.MainWindowHandle, WM_KEYUP, VK_MENU, 0);
  25.         SendMessage(p.MainWindowHandle, WM_KEYDOWN, VK_F, 0);
  26.         SendMessage(p.MainWindowHandle, WM_KEYUP, VK_F, 0);

Thanks for any help!
Feb 22 '12 #1
1 4353
BarrMan
2 New Member
For anyone who's interested, here's the answer:
http://stackoverflow.com/questions/9...-on-menu-items
Feb 23 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6792
by: Heather | last post by:
I notice the Tag property for menu items. Is there a way to assign say a 1 to the Tag property of certain menu items and then make those menu items not visible programatically? Thanks! Heather
4
1662
by: Ian Hinson | last post by:
The pop-up (drop-down?) menu items that appear in both built-in and custom menubars since Office 2000 now sometimes appear "sunken" and by default are not visible, unless the chevron is clicked at the bottom of the menu. How does Office determine which menu items are visible, and which items are sunken/initially not visible? I've noticed this happens with my custom menus too, but can't figure out the "rhyme or reason" that Office uses...
1
2142
by: Sakharam Phapale | last post by:
Hi All, How to show dropdown list of menu items just like click on Parent menu. For example, Edit (Parent menu) Cut (child menu) Copy (child menu) Paste (child menu)
0
1110
by: Elaine | last post by:
I have a truly curious problem with HtmlHelp and Sibling Mode in Visual C++ ..Net 2003 in an MFC app. Sibling mode allows the help viewer to display on top of the app, but if the app is clicked, then the app becomes the top most window. The idea is to let the user switch back and forth between the help viewer and the application. For the case of Menu Items only, sibling mode does not appear to work correctly under normal running...
10
21332
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles mnuTopics_Show.Select Dim mShowMenuItem As MenuItem mShowMenuItem = DirectCast(sender, MenuItem)
2
2350
by: Sakharam Phapale | last post by:
Hi All, How to show dropdown list of menu items just like click on Parent menu. For example, Edit (Parent menu) Cut (child menu) Copy (child menu) Paste (child menu)
4
4157
by: Bob Homes | last post by:
In VB6, I used a system, which I loved, whereby I assigned a "helpId" to each menu item; that way, you could rest the cursor on the item (without actually running it) and then press F1 to get context help with that particular command. In VB6 this was easy, since each menu item had a "helpId" property. That doesn't seem to be the case in VB.NET. Am I wrong about that, or (alternatively) is there some other way to accomplish this? --
8
2113
by: gs | last post by:
I was able to set tooltips on objects other than main menu. I would like to get the effect of tooltip or microhelp in the bottom status bar when the mouse is hovering over a submenu item. How do I do that? For example in outlook express, when one expand a main menu item and holds mouse over one of the enable sub menu item, one would see some sort microhelp text in the status bar in the bottom
1
7165
by: xpnctoc | last post by:
Here's the 30,000-ft. view: I wrapped an asp:Menu control in an ascx control. When I try to dynamically populate the menu in the ascx control, the items appear, but clicking on them fails to trigger the MenuItemClick event handler. However, if I statically declare the menu items in the .ascx page, everything is fine. Any ideas? Here's the details: My ascx page: <%@ Control Language="VB" AutoEventWireup="false"...
2
5908
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more commands to the control's context menu? I'm envisioning a case where the control has a set of context menu items, and the parent form also has a set of context menu items. Thanks.
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.