Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 49337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:25:15+00:00 2026-05-10T16:25:15+00:00

I’ve been searching around, and I haven’t found how I would do this from

  • 0

I’ve been searching around, and I haven’t found how I would do this from C#.

I was wanting to make it so I could tell Google Chrome to go Forward, Back, Open New Tab, Close Tab, Open New Window, and Close Window from my C# application.

I did something similar with WinAmp using

[DllImport('user32', EntryPoint = 'SendMessageA')] private static extern int SendMessage(int Hwnd, int wMsg, int wParam, int lParam); 

and a a few others. But I don’t know what message to send or how to find what window to pass it to, or anything.

So could someone show me how I would send those 6 commands to Chrome from C#? thanks

EDIT: Ok, I’m getting voted down, so maybe I wasn’t clear enough, or people are assuming I didn’t try to figure this out on my own.

First off, I’m not very good with the whole DllImport stuff. I’m still learning how it all works.

I found how to do the same idea in winamp a few years ago, and I was looking at my code. I made it so I could skip a song, go back, play, pause, and stop winamp from my C# code. I started by importing:

    [DllImport('user32.dll', CharSet = CharSet.Auto)]     public static extern IntPtr FindWindow([MarshalAs(UnmanagedType.LPTStr)] string lpClassName, [MarshalAs(UnmanagedType.LPTStr)] string lpWindowName);     [DllImport('user32.dll', CharSet = CharSet.Auto)]     static extern int SendMessageA(IntPtr hwnd, int wMsg, int wParam, uint lParam);     [DllImport('user32.dll', CharSet = System.Runtime.InteropServices.CharSet.Auto)]     public static extern int GetWindowText(IntPtr hwnd, string lpString, int cch);     [DllImport('user32', EntryPoint = 'FindWindowExA')]     private static extern int FindWindowEx(int hWnd1, int hWnd2, string lpsz1, string lpsz2);     [DllImport('user32', EntryPoint = 'SendMessageA')]     private static extern int SendMessage(int Hwnd, int wMsg, int wParam, int lParam); 

Then the code I found to use this used these constants for the messages I send.

    const int WM_COMMAND = 0x111;     const int WA_NOTHING = 0;     const int WA_PREVTRACK = 40044;     const int WA_PLAY = 40045;     const int WA_PAUSE = 40046;     const int WA_STOP = 40047;     const int WA_NEXTTRACK = 40048;     const int WA_VOLUMEUP = 40058;     const int WA_VOLUMEDOWN = 40059;     const int WINAMP_FFWD5S = 40060;     const int WINAMP_REW5S = 40061; 

I would get the hwnd (the program to send the message to) by:

IntPtr hwnd = FindWindow(m_windowName, null); 

then I would send a message to that program:

SendMessageA(hwnd, WM_COMMAND, WA_STOP, WA_NOTHING); 

I assume that I would do something very similar to this for Google Chrome. but I don’t know what some of those values should be, and I googled around trying to find the answer, but I couldn’t, which is why I asked here. So my question is how do I get the values for:

m_windowName and WM_COMMAND

and then, the values for the different commands, forward, back, new tab, close tab, new window, close window?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:25:16+00:00Added an answer on May 10, 2026 at 4:25 pm

    Start your research at http://dev.chromium.org/developers


    EDIT: Sending a message to a window is only half of the work. The window has to respond to that message and act accordingly. If that window doesn’t know about a message or doesn’t care at all you have no chance to control it by sending window messages.

    You’re looking at an implementation detail on how you remote controlled Winamp. Sending messages is just one way to do it and it’s the way the Winamp developers chose. Those messages you’re using are user defined messages that have a specific meaning only to Winamp.

    What you have to do in the first step is to find out if Chromium supports some kind of remote controlling and what those mechanisms are.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
I'm looking for suggestions for debugging... If you view this site in Firefox or
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.