-
Option Explicit
Private Declare Function ExtractAssociatedIcon Lib "shell32.dll" Alias "ExtractAssociatedIconA" (ByVal hInst As Long, ByVal lpIconPath As String, lpiIcon As Long) As Long
Private Declare Function DrawIcon Lib "user32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Sub Command1_Click()
Dim hIcon As Long
hIcon = ExtractAssociatedIcon(0, "Notepad.exe", 0)
If hIcon = 0 Then Exit Sub
Call DrawIcon(Picture1.hDC, 0, 0, hIcon)
End Sub
Private Sub Command2_Click()
SavePicture Picture1.Picture, "C:/pic1.ico"
End Sub
-
I didnt think picturebox supported icons... that could be the problem... try saving it as a bmp or a gif.
-
-
Is the picture being displayed in the picturebox? as if it is in there the code shouldnt change.
-
yes, i'm using a PictureBox
-
Can you use picturebox control with savepicture... it doesnt say yo ucan or cant... but keeps making reference to IPictureDisp which has nothing to do with a picturebox... i dont think
-
i dont think i got u
what u mean?
-
From what i read if you want to use save picture you have to use ipicturedisp not picturebox... do a search for ipicturedisp on vb-forums and you will see what i mean...