Skip to content

Get cursor icon as bitmap, with ability to save it. #115

@EliosMax

Description

@EliosMax

Hello i have code written in python, someone could help me write it in golang? I'm fresh in go, thank you.

import win32gui, win32ui

info = win32gui.GetCursorInfo()
hdc = win32ui.CreateDCFromHandle(win32gui.GetDC(0))
hbmp = win32ui.CreateBitmap()
hbmp.CreateCompatibleBitmap(hdc, 30, 30)
hdc = hdc.CreateCompatibleDC()
hdc.SelectObject(hbmp)
hdc.DrawIcon((0, 0), info[1])
hbmp.SaveBitmapFile(hdc, 'icon.bmp')
win32gui.DeleteObject(hbmp.GetHandle())
hdc.DeleteDC()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions