- 积分
- 10513
- 明经币
- 个
- 注册时间
- 2002-6-3
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-10-13 13:51:00
|
显示全部楼层
又记错了,那是我以前写的一个函数Public Function SetIcon(byval Hwnd as long,byval IconFileName as string),应该使用LoadImage和SendMessage来设置。
更改窗口的图标见下面的代码:
- Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
- Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
- Private Const WM_SETICON = &H80
- Private Const IMAGE_ICON = 1
- Private Const LR_LOADFROMFILE = &H10
- Public Sub SetIcon()
- Dim hIcon As Long
-
- 'FileName 图标文件, Hwnd ACAD应用程序的句柄
- hIcon = LoadImage(0&, FileName, IMAGE_ICON, 16, 16, LR_LOADFROMFILE)
- If hIcon <> 0 Then
- Call SendMessage(Hwnd, WM_SETICON, 0, ByVal hIcon)
- End If
- End Sub
|
|