Thread: Difference between a pointer and a handle

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

    Difference between a pointer and a handle

    What is the basic difference between a HANDLE and a pointer?
    Why do windows need handles, why can't it manage with pointers to structures??

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    If you want to ask what the programmer's intent was, you're not likely to get good answers from a forum posting...
    But you could try emailing Microsoft and asking them why they made certain mysterious decisions.

    Your best bet is to do what the rest of us do... work with it as it is.

  3. #3
    Registered User
    Join Date
    Aug 2011
    Posts
    385
    ya, but there must be some reason why microsoft switched on to using HANDLES, rather than mere pointers to structures and I think its worth knowing.

  4. #4
    Registered User gardhr's Avatar
    Join Date
    Apr 2011
    Posts
    151
    If you give access via pointers then you run the risk of exposing the underlying data structures to unwanted examination and/or modification (which could pose a serious threat to system security, etc), whereas handles provide an "opaque" identifier which can only be accessed via API calls. There are other reasons, too, such as the fact that it prevents API's from being broken when the underlying data structures have to be changed and whatnot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Difference between Reference and Pointer?
    By DarkMage530 in forum C Programming
    Replies: 10
    Last Post: 09-20-2011, 11:03 AM
  2. Difference between character pointer
    By sarathius in forum C Programming
    Replies: 10
    Last Post: 06-01-2011, 04:05 PM
  3. difference between pointer and array
    By zcrself in forum C Programming
    Replies: 4
    Last Post: 04-25-2010, 09:10 AM
  4. Replies: 3
    Last Post: 10-30-2009, 04:41 PM
  5. Pointer to function to handle event.Is a good idea?
    By giannirossi in forum C++ Programming
    Replies: 3
    Last Post: 05-31-2005, 01:12 AM