c# - Silverlight 5 Get Usercontrol's handle -


i'm trying make pinvoke call register usb device connection notification.

[dllimport("user32.dll", setlasterror = true)] protected static extern intptr registerdevicenotification(intptr hwnd, devicebroadcastinterface ointerface, uint nflags);  [structlayout(layoutkind.sequential, charset = charset.unicode, pack = 1)] public class devicebroadcastinterface {     public int size;     public int devicetype;     public int reserved;     public guid classguid;     [marshalas(unmanagedtype.byvaltstr, sizeconst = 256)]     public string name; } 

a handle window, obtained onhandlecreated in winforms application required make such pinvoke calls. there way of obtaining handle of usercontrol in silverlight 5?

silverlight, unlike wpf, not expose window handles. however, can, if try hard enough, find handle window. article describes method. call findwindow function hold of window handle.

and remember won't handle user control because top level windows have handles under silverlight. silverlight controls not windowed.

as aside, quite sure struct packed? quite unusual.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -