- 积分
- 10513
- 明经币
- 个
- 注册时间
- 2002-6-3
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-10-12 14:33:00
|
显示全部楼层
我不会C,在VBA中是通过调用API来实现的。
在VC++中应该也是类似的吧,程序可能更简单点。
- 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
|
|