My way of doing this....
'==========================================================
Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
Const IMAGE_ICON = 1
Const LR_LOADFROMFILE = &H10
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd 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 Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal dwImageType As Long, ByVal dwDesiredWidth As Long, ByVal dwDesiredHeight As Long, ByVal dwFlags As Long) As Long
Private return2 As Long
Private strPic As String
Private hBitmap As Long
Private Sub CmdDraw_Click()
DrawIcon GetWindowDC(0), 100, 100, return2&
End Sub
Private Sub Form_Load()
strPic = app.path & "\icon.ico"
hBitmap = LoadImage(App.hInstance, strPic, IMAGE_ICON, 32, 32, LR_LOADFROMFILE)
return2 = hBitmap
End Sub
'========================================================== All the Best
Praveen Menon
pcmin@rediffmail.com