Thread: DrawIcon API
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phoenix Phoenix is offline
external usenet poster
 
Posts: 1
Default 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