Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

SendMessageTimeout (user32)
 
.
Summary

C# Signature:

[DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg,
   UIntPtr wParam, string lParam, SendMessageTimeoutFlags fuFlags,
   uint uTimeout, out UIntPtr lpdwResult);

User-Defined Types:

[Flags]
public enum SendMessageTimeoutFlags : uint
{
    SMTO_NORMAL = 0x0000,
    SMTO_BLOCK = 0x0001,
    SMTO_ABORTIFHUNG = 0x0002,
    SMTO_NOTIMEOUTIFNOTHUNG = 0x0008,
}

Notes:

None.

Tips & Tricks:

Changed the IntPtr lParam to string lParam to enable the possibility to use a string as input.

Sample Code:

// notify all windows that User Environment variables are changed
IntPtr HWND_BROADCAST = (IntPtr) 0xffff;
const UInt32 WM_SETTINGCHANGE = 0x001A;
UIntPtr result;
IntPtr settingResult = SendMessageTimeout(HWND_BROADCAST,
                       WM_SETTINGCHANGE,
                       (UIntPtr)0,
                       "Environment",
                       SendMessageTimeoutFlags.SMTO_NORMAL,
10000,                        out result);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions