So erstellen Sie einen WPF -Cursor aus einem INTPTR -Handle

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: So erstellen Sie einen WPF -Cursor aus einem INTPTR -Handle

by Anonymous » 14 Apr 2025, 11:49

Angenommen, ich habe den Handle eines Cursors, und ich möchte eine Instanz von WPF Cursor verwenden. Irgendeine Idee, wie man dies umgeht und einen WPF -Cursor aus dem INTPTR -Handle erstellt?

Code: Select all

[DllImport("kernel32.dll")]
private static extern IntPtr LoadLibrary(string dllToLoad);

[DllImport("user32.dll")]
private static extern IntPtr LoadCursor(IntPtr hInstance, UInt16 lpCursorName);

private void button1_Click(object sender, EventArgs e)
{
var l = LoadLibrary("ole32.dll");
var h = LoadCursor(l, 6);
this.Cursor = new Cursor(h);
}

Top