[DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern uint RegisterWindowMessage(string lpString);
Declare Function RegisterWindowMessage Lib "user32.dll" (ByVal lpString As String) As Integer
None.
None.
Please add some!
VB.NET Sample Code
Dim MessageID As Integer
MessageID = RegisterWindowMessage("QueryCancelAutoPlay")
C# Sample Code
//Register the message
lMsg = Win32.RegisterWindowMessage("WM_HTML_GETOBJECT");
//Get the object
Win32.SendMessageTimeout(windowHandle, lMsg, IntPtr.Zero, IntPtr.Zero, SendMessageTimeoutFlags.SMTO_ABORT_IF_HUNG, 1000, out lRes);
if(lRes != IntPtr.Zero)
{
//Get the object from lRes
htmlDoc= (mshtml.IHTMLDocument)Win32.ObjectFromLresult(lRes, IID_IHTMLDocument, IntPtr.Zero);
return htmlDoc;
}
C# Sample Code
//provide a private internal message id
private UInt32 queryCancelAutoPlay = 0;
protected override void WndProc(ref Message m)
{
//calling the base first is important, otherwise the values you set later will be lost
base.WndProc (ref m);
//if the QueryCancelAutoPlay message id has not been registered...
if (queryCancelAutoPlay == 0)
queryCancelAutoPlay = RegisterWindowMessage("QueryCancelAutoPlay");
//if the window message id equals the QueryCancelAutoPlay message id
if ((UInt32)m.Msg == queryCancelAutoPlay)
m.Result = (IntPtr)1;
} //WndProc
Do you know one? Please contribute it!