postmessage

Programmatically change combobox

I need to update a combobox with a new value so it changes the reflected text in it. The cleanest way to do this is after the combobox has been initialised and with a message. So I am trying to craft a postmessage to the hwnd that contains the combobox. So if I want to send a message to it, changing the currently selected item to the n...

Using PostMessage in Windows Mobile to simulate a menu pick

I'm writing a routine to provide user definable keyboard short-cuts for any menu item in my Windows Mobile 5 application, which is in C++/MFC. To do this I am getting all of the available menu command IDs, and using the CWnd::PostMessage(WM_COMMAND,MyMenuID) to post it to the application. I use this technique to good effect elsewhere f...

How to programmatically select popup menu item in Windows?

I have an app that I'm writing a little wizard for. It automated a small part of the app by moving the mouse to appropriate buttons, menus and clicking them so the user can watch. So far it moves the mouse to a tree item and sends a right-click. That pops up a menu via TrackPopupMenu. Next I move the mouse to the appropriate item on ...

How send WM_HOTKEY with PostMessage?

I want to send WM_HOTKEY to be captured by other application using a global desktop HotShortCut. The expected Keys are CTRL + F10 This is the only way I found to trigger the capture of WM_HOTKEY: procedure TfmMain.ButtonTalkClick(Sender: TObject); var Article: TArticleBase; Msg: TMessage; begin Article:= GetSelectedArticle; if...

PostMessage in service applications

There is a problem I am unable to solve. I created two service applications in Delphi and tried to post messages within them. Of course, there are no windows in such applications and PostMessage needs a window handle parameter to send a message. Therefore, I created a window handle using the AllocateHWnd(MyMethod: TWndMethod) function ...

I can't understand how to use SendMessage or PostMessage calls :(

Hi guys, I need to simulate a keypress in a third party application. Let's say I have a C# application that needs to send an "8" to the Calculator application. I can't use the SendKeys of .Net or the keybd_event of win32 api because they both require the window to be the top active one, which is not case in my situation. So that leaves...

Determining Window Message Queue Depth

We have an application that uses the window message queue to pass data from a socket to consumer HWNDs (at a rate of ~2100Hz). This application has worked for >2 years. Recently our application has started exhibiting problems where WM_TIMER is not being fired/executed by our application. I think this is due to the data being pumped into ...

Send a double click to a listview (c++, not .net!)

Hello. I want to send a double click to a listview. From what I've read on msdn it seems I gotta send a WM_NOTIFY message and something with NM_DBLCLK. But I do not understand really well hwo to implement it. I've worked with SendMessage before but MSDN is not that clear on how to fill the structs and so: WM_NOTIFY http://msdn.microsoft...

PostMessage() alternative in Java(Android)

Hi, I am rewriting the existing C++ application and adapting it for Android environment. In the code there is a PostMessage statement: PostMessage( bExitApp ? WM_CLOSE : WM_LOGIN, wParam, lParam ); Does anyone know what is the most appropriate way to achieve tha same result in Android (Java)? Is it well enough to create two methods...

How to send a message from one instance of a managed app to another?

I've got a WinForms app, where if there is already an instance running & the user tries to spin up another one, I stop it by checking against a Mutex before calling Application.Run(). That part works just fine. What I would like to do is pass a message from the new instance of the app (along with a piece of data in string form) to the ...

Which is faster: SetEvent, SendMessage, PostMessage

Environment: Win32, C/C++ All three (3) can be used for a thread to signal to main() that it has completed an operation for example. But which one is the fastest signal of all? hmm... ...

Sending WM_COMMAND to a TMenuItem

In my Delphi form's OnShow method, I determine that a dialog must be opened automatically once the form is opened - and I should be able to do this by simulating a click on a menuitem. However, calling menuitem.Click brings up the dialog before the main form has opened - which is not what I want. I expect that should do what I want, bu...

How to send a string via PostMessage?

Inside my app, I want to send a message to a dialog from a different thread. I want to pass an std::exception derived class reference to the dialog. Something like this: try { //do stuff } catch (MyException& the_exception) { PostMessage(MyhWnd, CWM_SOME_ERROR, 0, 0); //send the_exception or the_exception.error_string() here }...

How do you encode an Object in a Web Worker for it to be passed via postMessage?

Internally, Firefox will JSON encode an object passed via postMessage to and from the Web Worker. However, this only works in Trunk builds of Firefox (3.6+) and not in Firefox 3.5, so the question is really how to add backwards support of this operation to the current platform. The window.atob() and window.btoa() methods had been suggest...

PostMessage with priority?

Is it possible to prioritize a message sent with PostMessage (or any of the other related methods)? IIRC, the WM_PAINT message, for instance, is only processed when there are no other messages in the queue. Is it possible to achieve a similiar behavior with custom messages? If I use WM_PAINT with special parameters in order to deliver ...

Problem with SendMessage

Hello friends, I am developing an application using C# having similar functionality of copy,paste as in Windows. I have added menu items and linked with respective applications. Please look at the following image for getting more idea. Like we select multiple items in windows explorer, you need to select multiple files and/or folde...

PostMessage unable to pass a string C#

Here is my prototype: [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern bool PostMessage(int hhwnd, uint msg, IntPtr wparam, IntPtr lparam); And here is how I'm using it: PostMessage(HWND_BROADCAST, msg, Marshal.StringToHGlobalAuto("bob"), IntPtr.Zero); In a different thread I can intercept this message...

Is it possible to sendkeys / Post Message directly to a HtmlElement rather than to a webbrowser control?

I would like to send keys to a c# web browser control element directly, not just the window with the correct focus. Right now I am able to send a key using PostMessage and documentHandle and focus like this i.e. Pseudo Code HtmlElement el = getelement(); el.Focus(); IntPtr docptr = browser.Handle; PostMessage(docptr,WM_KEYDOWN,1,0);...

[C#][Win32 API] PostMessage Help?

I've looked at sites and MSDN documentation but I still don't understand the last parameter of PostMessage(). On forums in which people ask how to use PostMessage, people reply with one of two implementations: PostMessage(WindowHandle, WM_KEYDOWN, KeyCode, MapVirtualKey(KeyCode, 0) << 16); PostMessage(WindowHandle, WM_KEYDOWN, KeyCode...

PostMessage does not seem to be working.

I am trying to use PostMessage to send a tab key. Here is my code: // This class allows us to send a tab key when the the enter key // is pressed for the mooseworks mask control. public class MaskKeyControl : MaskedEdit { // [DllImport("coredll.dll", SetLastError = true, CharSet = CharSet.Auto)] // static extern IntPtr SendMessag...