Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
EliosMax opened this issue Mar 9, 2021 · 0 comments
Open

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

EliosMax opened this issue Mar 9, 2021 · 0 comments

Comments

@EliosMax
Copy link

EliosMax commented Mar 9, 2021

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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant