Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

DrawIcon API

1 réponse
Avatar
Phoenix
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

1 réponse

Avatar
Jean-marc
Phoenix wrote:
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:WINNTNOTEPAD.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



Hi,

FYI, you are here on the french speaking hieracrchy of the Microsft
Newsgroup, which is fine anyway :-)

However, you'll probably find more interseting info by trying to post
on the corresponding english speaking group: microsoft.public.vb

On top of this, as the question concerns a porting of VB6 to VB2005 and
as VB2005 users are often ex-VB6 fans, you'll probably get usefull
answers in the dedicated group: microsoft.public.dotnet.languages.vb

Hope this helps :-)

Best regards,


--
Jean-marc Noury (jean_marc_n2)
Microsoft MVP - Visual Basic
mailto: remove '_no_spam_' ;
FAQ VB: http://faq.vb.free.fr/