I know the .Net Cursor class doesn't work with color cursors. So I'm
currently using the LoadCursorFromF ile API with reflection to set color
cursors:
here is my code:
[DllImport("user 32.dll")] public static extern IntPtr LoadCursorFromF ile(
string fileName );
IntPtr hwdCursor= LoadCursorFromF ile( "color.cur" );
myCursor.GetTyp e().InvokeMembe r("handle",Bind ingFlags.Public |
BindingFlags.No nPublic |BindingFlags.I nstance |
System.Reflecti on.BindingFlags .SetField,null, myCursor,new object [] {
hwdCursor} );
It works great, but I'd like to be able to embed the cursors. I've been
trying to get theLoadCursor API to work with embedded resources and I am not
having any luck.
here is the code that doesn't work:
[DllImport("user 32.dll")] public static extern IntPtr LoadCursor( long hwd,
string fileName );
private static IntPtr hInstance =
Marshal.GetHINS TANCE(Assembly. GetExecutingAss embly().GetModu les()[0]);
private static IntPtr hwdRedCursor=
LoadCursor((lon g)hInstance,"co lor.cur" );
Any suggestions?
currently using the LoadCursorFromF ile API with reflection to set color
cursors:
here is my code:
[DllImport("user 32.dll")] public static extern IntPtr LoadCursorFromF ile(
string fileName );
IntPtr hwdCursor= LoadCursorFromF ile( "color.cur" );
myCursor.GetTyp e().InvokeMembe r("handle",Bind ingFlags.Public |
BindingFlags.No nPublic |BindingFlags.I nstance |
System.Reflecti on.BindingFlags .SetField,null, myCursor,new object [] {
hwdCursor} );
It works great, but I'd like to be able to embed the cursors. I've been
trying to get theLoadCursor API to work with embedded resources and I am not
having any luck.
here is the code that doesn't work:
[DllImport("user 32.dll")] public static extern IntPtr LoadCursor( long hwd,
string fileName );
private static IntPtr hInstance =
Marshal.GetHINS TANCE(Assembly. GetExecutingAss embly().GetModu les()[0]);
private static IntPtr hwdRedCursor=
LoadCursor((lon g)hInstance,"co lor.cur" );
Any suggestions?
Comment