Friday 15 June 2012

How to change cursor Icon in C# like in autoit -



How to change cursor Icon in C# like in autoit -

this question has reply here:

using custom colored cursors in c# windows application 4 answers

i alter cursor in autoit syntax:

dllcall($user32, 'int', 'loadcursorfromfile', 'str', 'data\cursors\rotmg.cur')

does know how in c#?

you need utilize pinvoke/dllimport create windows api calls.

from pinvoke.net, declaration be:

[dllimport("user32.dll")] static extern intptr loadcursorfromfile(string lpfilename);

and sample use:

intptr colorcursorhandle = loadcursorfromfile("c:\\temp.cur"); cursor mycursor = new cursor(colorcursorhandle); this.cursor = mycursor;

pinvoke.net resource getting right function signatures of pinvoke calls , construction marshalling.

c# cursor autoit

No comments:

Post a Comment