图标栏 鼠标滑过的文字乱码,该怎么解决
图标栏 鼠标滑过的文字乱码
全局外部函数
Public Function Integer Shell_NotifyIcon (Long dwMessage, Any lpData) Library "shell32" Alias For "Shell_NotifyIconA"
Public Function Long LoadImage (Long hInst, String lpsz, Long un1, Long n1, Long n2, Long un2) Library "user32" Alias For "LoadImageA;Ansi"
Public Function Long DestroyIcon (Long hIcon) Library "user32" Alias For "DestroyIcon"
Public Function Long SetForegroundWindow (Long hwnd) Library "user32" Alias For "SetForegroundWindow"
函数wf_AddToTray
// 功能:加载图标
// 参数说明:
// string as_icon :加载的图标文件名
// long al_handle :窗口句柄
// string as_tips :显示的tips
IF hIcon = 0 Then // 图标还没有装载
hIcon = LoadImage(0, as_icon, IMAGE_ICON, 0, 0, LR_LOADFROMFILE)
END IF
IF hIcon = 0 Then
MessageBox ("Error", "图标装载失败!")
Return -1
END IF
istr_notifyicondata.cbsize = 88
// 窗口句柄
istr_notifyicondata.hwnd = al_handle
istr_notifyicondata.uid = 0
// 窗口回调事件号,pbm_custom01为1024,pbm_custom02为1025,依此类推
istr_notifyicondata.ucallbackmessage = 1024
// 图标
istr_notifyicondata.hIcon = hIcon
// 标识值,即为显示tips
istr_notifyicondata.tips = as_tips
istr_notifyicondata.uflags = NIF_MESSAGEorNIF_ICONorNIF_TIP//7
// 显示icon关键函数, NIM_ADD 0为显示,1为修改,2为删除
shell_notifyicon ( NIM_ADD, istr_notifyicondata )
return 1
函数调用
wf_AddToTray('icon\sysicon2.ico', handle(this), "你好")
我编译运行的时候“你好”是乱码的
------解决方案--------------------
Public Function Integer Shell_NotifyIcon (Long dwMessage, Any lpData) Library "shell32" Alias For "Shell_NotifyIconA"
改成
Public Function Integer Shell_NotifyIcon (Long dwMessage, Any lpData) Library "shell32" Alias For "Shell_NotifyIconA;ansi"
或者
Public Function Integer Shell_NotifyIcon (Long dwMessage, Any lpData) Library "shell32" Alias For "Shell_NotifyIconW"
全局外部函数
Public Function Integer Shell_NotifyIcon (Long dwMessage, Any lpData) Library "shell32" Alias For "Shell_NotifyIconA"
Public Function Long LoadImage (Long hInst, String lpsz, Long un1, Long n1, Long n2, Long un2) Library "user32" Alias For "LoadImageA;Ansi"
Public Function Long DestroyIcon (Long hIcon) Library "user32" Alias For "DestroyIcon"
Public Function Long SetForegroundWindow (Long hwnd) Library "user32" Alias For "SetForegroundWindow"
函数wf_AddToTray
// 功能:加载图标
// 参数说明:
// string as_icon :加载的图标文件名
// long al_handle :窗口句柄
// string as_tips :显示的tips
IF hIcon = 0 Then // 图标还没有装载
hIcon = LoadImage(0, as_icon, IMAGE_ICON, 0, 0, LR_LOADFROMFILE)
END IF
IF hIcon = 0 Then
MessageBox ("Error", "图标装载失败!")
Return -1
END IF
istr_notifyicondata.cbsize = 88
// 窗口句柄
istr_notifyicondata.hwnd = al_handle
istr_notifyicondata.uid = 0
// 窗口回调事件号,pbm_custom01为1024,pbm_custom02为1025,依此类推
istr_notifyicondata.ucallbackmessage = 1024
// 图标
istr_notifyicondata.hIcon = hIcon
// 标识值,即为显示tips
istr_notifyicondata.tips = as_tips
istr_notifyicondata.uflags = NIF_MESSAGEorNIF_ICONorNIF_TIP//7
// 显示icon关键函数, NIM_ADD 0为显示,1为修改,2为删除
shell_notifyicon ( NIM_ADD, istr_notifyicondata )
return 1
函数调用
wf_AddToTray('icon\sysicon2.ico', handle(this), "你好")
我编译运行的时候“你好”是乱码的
------解决方案--------------------
Public Function Integer Shell_NotifyIcon (Long dwMessage, Any lpData) Library "shell32" Alias For "Shell_NotifyIconA"
改成
Public Function Integer Shell_NotifyIcon (Long dwMessage, Any lpData) Library "shell32" Alias For "Shell_NotifyIconA;ansi"
或者
Public Function Integer Shell_NotifyIcon (Long dwMessage, Any lpData) Library "shell32" Alias For "Shell_NotifyIconW"