ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DrawIcon API (https://www.excelbanter.com/excel-programming/389134-drawicon-api.html)

Phoenix

DrawIcon API
 
Hi Masters :-)

Could anyone of you please translate the following into Visual Basic
2005 Code ?
I am new to this and tried every trick but failed to translate. Any
help would be highly
appreciated. I can't use Graphics.DrawIcon as I don't have a
IconFile , I am using
ExtractIcon to get a handle to the Icon. Here's the VB6 which I am
trying to Convert
- - --

Declare Function DrawIcon Lib "user32" (ByVal hDC As Long, ByVal x As
Long, ByVal Y As Long, ByVal hIcon As Long) As Long

Declare Function ExtractIcon Lib "shell32.dll" Alias
"ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String,
ByVal nIconIndex As Long) As Long

Private Sub Form_Load()

Dim li_hicon As Long

li_hicon = ExtractIcon(li_my_hInst, "C:\WINNT\NOTEPAD.EXE", 0)

picAplIcon.AutoRedraw = -1

li_retcode1 = DrawIcon(picAplIcon.hDC, picAplIcon.ScaleLeft,
picAplIcon.ScaleTop, li_hicon)

picAplIcon.Refresh

End Sub

Thanks to you all in advance!!

Best Regards,

Sudhansu


NickHK

DrawIcon API
 
You would probably be better asking in one of the NGs with .Net in their
name, rather than an Excel group.

NickHK

"Phoenix" wrote in message
ps.com...
Hi Masters :-)

Could anyone of you please translate the following into Visual Basic
2005 Code ?
I am new to this and tried every trick but failed to translate. Any
help would be highly
appreciated. I can't use Graphics.DrawIcon as I don't have a
IconFile , I am using
ExtractIcon to get a handle to the Icon. Here's the VB6 which I am
trying to Convert
- - --

Declare Function DrawIcon Lib "user32" (ByVal hDC As Long, ByVal x As
Long, ByVal Y As Long, ByVal hIcon As Long) As Long

Declare Function ExtractIcon Lib "shell32.dll" Alias
"ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String,
ByVal nIconIndex As Long) As Long

Private Sub Form_Load()

Dim li_hicon As Long

li_hicon = ExtractIcon(li_my_hInst, "C:\WINNT\NOTEPAD.EXE", 0)

picAplIcon.AutoRedraw = -1

li_retcode1 = DrawIcon(picAplIcon.hDC, picAplIcon.ScaleLeft,
picAplIcon.ScaleTop, li_hicon)

picAplIcon.Refresh

End Sub

Thanks to you all in advance!!

Best Regards,

Sudhansu





All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com