Sunday 15 February 2015

.net - Call of BroadcastSystemMessage never finish -


Text after "div class =" itemprop = "text">

I'm calling BroadcastSystemMessage User32.dll method. A method is called a PC (Windows 8 Pro), but the call never ends. The application is waiting, but the result (and the exception) is never returned. I try to do it on several Windows8 computers (with different HW, / without antivirus, etc ...), but this behavior never happens on these computers

The target computer will register the custom message which is not running any installed or application. Therefore all app broadcast should be ignored

Is this behavior correct? I did not get any mention in MSDN about this. What is wrong?

  [DllImport: There is a code that is not the right way to stop the call after some timeout  

Any advice or tip is welcome

?. ("User32", SetLastError = true)) Public static extern int BroadcastSystemMessage (Messaging Flags Flags, Referees MessagesBrustcards LPInfo, UIT Messages, Input Use, Interpet ElParam); // ...... BroadcastSystemMessage (MessageBroadcastFlags.BSF_IGNORECURRENTTASK, // this process ref Send MessageBroadcastRecipients.BSM_ALLDESKTOPS, // Broadcast Recipients Message, // Registered Private Message IntPtr.Zero, // Not to send message with message-specific value IntPtr .Zero); // ...... [Flags] public enum MessageBroadcastFlags: uint {BSF_QUERY = 0x00000001, BSF_IGNORECURRENTTASK = 0x00000002, BSF_FLUSHDISK = 0x00000004, BSF_NOHANG = 0x00000008, BSF_POSTMESSAGE = 0x00000010, BSF_FORCEIFHUNG = 0x00000020, BSF_NOTIMEOUTIFNOTHUNG = 0x00000040, BSF_ALLOWSFW = 0x00000080, BSF_SENDNOTIFYMESSAGE = 0x00000100, BSF_RETURNHDESK = 0x00000200, BSF_LUID = 0x00000400} [flags] public enum MessageBroadcastRecipients: uint {BSM_ALLCOMPONENTS = 0x00000000, BSM_VXDS = 0x00000001, BSM_NETDRIVER = 0x00000002, BSM_INSTALLABLEDRIVERS = 0x00000004, BSM_APPLICATIONS = 0x00000008, BSM_ALLDESKTOPS = 0x00000010}

I think this is a question for Raymond Chen - Hopefully he'll see it

Is there no way to stop the call after some timeout?

Sure, use the BSF_NOHANG flag.

No comments:

Post a Comment