Difference between a pointer and a handle

This is a discussion on Difference between a pointer and a handle within the Windows Programming forums, part of the Platform Specific Boards category; What is the basic difference between a HANDLE and a pointer? Why do windows need handles, why can't it manage ...

  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, 12:03 PM
  2. Difference between character pointer
    By sarathius in forum C Programming
    Replies: 10
    Last Post: 06-01-2011, 05:05 PM
  3. difference between pointer and array
    By zcrself in forum C Programming
    Replies: 4
    Last Post: 04-25-2010, 10:10 AM
  4. Replies: 3
    Last Post: 10-30-2009, 05: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, 02:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21