-
Notifications
You must be signed in to change notification settings - Fork 942
Open
Milestone
Description
Hello, I need to get the currently used icon(bitmap) in windows. Before, I used Pyhon and this function works:
Get cursor icon as bitmap, with ability to save it or get pixels from it
def get_icon_mouse(self):
info = win32gui.GetCursorInfo()
if info[1] != 0:
gdc = win32gui.GetDC(0)
hdc = win32ui.CreateDCFromHandle(gdc)
hbmp = win32ui.CreateBitmap()
hbmp.CreateCompatibleBitmap(hdc, self.ico_height, self.ico_width)
hdc = hdc.CreateCompatibleDC()
hdc.SelectObject(hbmp)
hdc.DrawIcon((0, 0), info[1])
signedIntsArray = hbmp.GetBitmapBits(True)
img = np.fromstring(signedIntsArray, dtype='uint8')
img.shape = (self.ico_height, self.ico_width, 4)
# hbmp.SaveBitmapFile(ico, 'icon.bmp')
# win32gui.DestroyIcon(info[1])
win32gui.DeleteObject(hbmp.GetHandle())
win32gui.ReleaseDC(0, gdc)
hdc.DeleteDC()
self.error_get_icon = 0
return img
else:
return self.error_imageCould someone help me write this code in Golang?
Thank you
Metadata
Metadata
Assignees
Labels
No labels
