Thread: hInstance

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    385

    hInstance

    MSDN defination for hInstance : "A handle to the current instance of the application."

    What does that mean ?? and what exactly is an instance?? Is that a pointer ?? If yes, what does it point to ?? I would really appreciate if someone could give me a detailed description...

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Open Calculator on your desktop ... THAT is one instance of Calculator.

    HInstance is a handle needed by window creation, menus, and a whole host of other functions to identify the correct program and instance when passing commands or requesting data. Each instance of a program gets it's own memory space, it's own set of handles, it's own stack and so on... this handle --not a pointer, a handle-- is how Windows knows what's where.

    For all your needs as a programmer, Handles are merely identifiers that you need to refer to things -- much like your own name is your "handle" and has no meaning other than it's reference to you.

    The value or type of these handles is of no consequence to you. These are just identifiers you pass around in your program as needed.
    Last edited by CommonTater; 01-08-2012 at 04:31 AM.

  3. #3
    Registered User
    Join Date
    Aug 2011
    Posts
    385
    so does that mean that it is a handle (a void pointer), which stores the base address of our applications code in memory??

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    No it means exactly what I said it means...

    You are on here as "Juice" ... that's your handle. It is a way to identify you and has no meaning beyond that.

    A handle is simply the means by which Windows internally identifies your program and it has no meaning beyond that.



    Really... DO NOT turn this into yet another boondoggle like your EOF threads over in C Programming.
    You've already burned most of your support here, don't make it worse.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 12-01-2005, 07:38 PM
  2. Get HINSTANCE of another process
    By Thantos in forum Windows Programming
    Replies: 3
    Last Post: 01-14-2005, 08:22 PM
  3. getting an hinstance
    By voodoomagic in forum Windows Programming
    Replies: 2
    Last Post: 12-11-2004, 02:34 PM
  4. Global HINSTANCE?
    By confuted in forum Windows Programming
    Replies: 6
    Last Post: 06-24-2003, 02:13 AM
  5. finding hInstance
    By anobody in forum Windows Programming
    Replies: 7
    Last Post: 01-26-2003, 02:02 AM