Jump to content

Send message to a window


Recommended Posts

I'm not good in windows programming... How to send message(f.e. WM_INPUTLANGCHANGEREQUEST) to a some window? This window wasn't create by AutoIt, handle is known.

i want to say WinPostMessage() function in user32.dll but i could be wrong, smoke_n has used it before, he could probably put some code up, i'm going to see if i can't find it first though...
Link to comment
Share on other sites

  • Developers

will be something like this:

$WM_INPUTLANGCHANGEREQUEST = 0x0050
$Dutch = 0x0413
DLLCall("user32.dll","int","SendMessage","hwnd",$H_Win,"int",$WM_INPUTLANGCHANGEREQUEST,"int",0,"int",$Dutch)

You need to figure out the third parameter .. more info here

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

i can't find WinPostMessage in MSDN

i was wrong on the name of it.... here's what platform sdk help file shows....

PostMessage Function

--------------------------------------------------------------------------------

The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.

To post a message in the message queue associate with a thread, use the PostThreadMessage function.

Syntax

BOOL PostMessage( HWND hWnd,

UINT Msg,

WPARAM wParam,

LPARAM lParam

);

Parameters

hWnd

[in]Handle to the window whose window procedure is to receive the message. The following values have special meanings.

HWND_BROADCAST

The message is posted to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows. The message is not posted to child windows.

NULL

The function behaves like a call to PostThreadMessage with the dwThreadId parameter set to the identifier of the current thread.

Msg

[in] Specifies the message to be posted.

wParam

[in] Specifies additional message-specific information.

lParam

[in] Specifies additional message-specific information.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Messages in a message queue are retrieved by calls to the GetMessage or PeekMessage function.

Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage function to obtain a unique message for inter-application communication.

The system only does marshalling for system messages (those in the range 0 to WM_USER). To send other messages (those above WM_USER) to another process, you must do custom marshalling.

If you send a message in the range below WM_USER to the asynchronous message functions (PostMessage, SendNotifyMessage, and SendMessageCallback), its message parameters cannot include pointers. Otherwise, the operation will fail. The functions will return before the receiving thread has had a chance to process the message and the sender will free the memory before it is used.

Do not post the WM_QUIT message using PostMessage; use the PostQuitMessage function.

Windows 2000/XP: There is a limit of 10,000 posted messages per message queue. This limit should be sufficiently large. If your application exceeds the limit, it should be redesigned to avoid consuming so many system resources. To adjust this limit, modify the following registry key:

HKEY_LOCAL_MACHINE

SOFTWARE

Microsoft

Windows NT

CurrentVersion

Windows

USERPostMessageLimit

The minimum acceptable value is 4000.

Windows 95/98/Me: PostMessageW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...