Results 1 to 4 of 4

Thread: Changing a form icon using API

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    56

    Question

    Hi everybody,

    Is there a way to change a form icon using API calls??

    Help would be nice, tnx

    keetsh

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Nil Problemmo,

    get a handle to your Icon and use SetClassLong
    Code:
    Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    yuou use this constant for nIndex
    Code:
    Private Const GCL_HICON = (-14)
    it returns the handle of the old Icon, remember to put it back before you end your program, otherwise you could run into problems.

  3. #3
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655

    Question

    Is there a particular reason you want to use an API call for this? You can change an icon at runtime rather easily by type:

    '''''''''''''''''''''''''''
    Form1.icon = "somepath"
    '''''''''''''''''''''''''''

    Where "somepath" is the path of your icon.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    56

    Cool

    Tnx Sam. But could you please explain a little more what you mean by "get a handle to your Icon and use SetClassLong"

    Please help!

    Hummm RealisticGraphics, I trying to get this out of an Access form. That's why )

    See you

    keetsh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width