December 14th, 2004, 10:33 AM
Join Date: Dec 2004
Time spent in forums: < 1 sec
Reputation Power: 0
Question on GetIcon Code
Great article! I am trying to get this code to work with a VBA project.
lngIcon = ExtractIcon(Access.hWndAccessApp, strDefaultIcon, lngIconNumber)
If lngIcon = 1 Or lngIcon = 0 Then GoTo No_Icon
lngError = DrawIcon(Me.IconPicture, 0, 0, lngIcon) 'Draw the icon in the box
lngError = DestroyIcon(lngIcon)
strDefaultIcon = Space(260)
lngStringLength = GetSystemDirectory(strDefaultIcon, 260)
strDefaultIcon = Left(strDefaultIcon, lngStringLength) & "SHELL32.DLL"
lngIconNumber = 0
When it gets to this section of code it always sets the lngIcon to zero on the No_Icon
label and so goes into an endless loop. Can you see what I have done wrong. It appears
to not be finding the icon for Shell32.dll or else I'm missing the boat somewhere else. I'm also
not clear on what hsd is in an Access form environment. This may be the problem.
Thanks for any help.