Last active
October 30, 2023 07:00
-
-
Save G4MR/b1767ac54d47939bbf5d to your computer and use it in GitHub Desktop.
nim windows tool tip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import windows, typeinfo, os | |
var wc : Widechar = 32515; | |
var h : HINST | |
var nid : NOTIFYICONDATA = NOTIFYICONDATA() | |
var szip : array[0..63, char] | |
var info : array[0..255, char] | |
var infoTitle : array[0..63, char] | |
var title = "My Title" | |
for x in 0..title.len: | |
szip[x] = title[x] | |
info[x] = title[x] | |
infoTitle[x] = title[x] | |
echo szip.len, szip | |
echo info.len, info | |
echo infoTitle.len, infoTitle | |
nid.cbSize = 932 #DWORD(0x0601) | |
nid.uID = WINUINT(1112) | |
nid.uFlags = WINUINT(0x00000080) or WINUINT(0x00000010) or WINUINT(0x00000002) or WINUINT(0x00000004) | |
nid.hIcon = HICON(LoadImageA(h, "D:/test.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE)) | |
nid.szTip = szip | |
nid.szInfo = info | |
nid.szInfoTitle = infoTitle | |
nid.dwInfoFlags = WINUINT(0x00000001) | |
nid.uVersion = 4 | |
discard Shell_NotifyIconA(0x00000000, addr(nid)) | |
discard Shell_NotifyIconA(0x00000004, addr(nid)) | |
sleep(5000) | |
discard Shell_NotifyIconA(0x00000002, addr(nid)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment