Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Icon using API not working

Status
Not open for further replies.

AccessGuruCarl

Programmer
Jul 3, 2004
471
US
Can someone please tell me what I'm doing wrong here.

I'm using this code from 'The Access Web' with Access 2000
Link to code:
In Form Load and Activate, I've tried using this call.

Code:
SetFormIcon(0, strIconPath)
This code causes an err msg when try to leave the line:
Compile Error:
Expected: =

Tried this next...
Code:
Call SetFormIcon(0, strIconPath)
No errors, but not working!

Then This...
Code:
Dim frmIcon
Dim strIconPath As String   'Use a custom icon on the form
    strIconPath = "C:\DEV\Com.ico"
frmIcon = SetFormIcon(0, strIconPath)
Same thing, No Errors, but not working!


What am I missing here?????
Do I need to declare frmIcon as a Byte or something?
Everytime I open the form, it's still the 'form' default.

I know the icon is valid, I set it in the Startup's App Icon, and ticked the Use on Forms & Reports, and it worked fine, except it's the SAME.

Thanks




AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Located my answer shortly after making the post.

This is the working code...

Code:
Private Sub Form_Open(Cancel As Integer)

Dim strIconPath As String
    strIconPath = "C:\DEV\Com.ico"
'Use a custom icon on the form
'[URL unfurl="true"]http://support.microsoft.com/?kbid=304264[/URL]

    SetFormIcon Me.hwnd, strIconPath

End Sub

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top