Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CloseHandle

CloseHandle

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dellthinker
    wrote on last edited by
    #1

    Hi all. Im having trouble finding a simple example of CloseHandle. Does anyone know of a place where i can see a simple code using this function? Thanx in advance!

    P J 2 Replies Last reply
    0
    • D dellthinker

      Hi all. Im having trouble finding a simple example of CloseHandle. Does anyone know of a place where i can see a simple code using this function? Thanx in advance!

      P Offline
      P Offline
      Paresh Chitte
      wrote on last edited by
      #2

      Please refer http://msdn2.microsoft.com/en-us/library/ms724211.aspx[^]. For example, HANDLE hFile; hFile = CreateFile( lpFileName, // file name dwDesiredAccess, // access mode dwShareMode, // share mode lpSecurityAttributes, // SD dwCreationDisposition, // how to create dwFlagsAndAttributes, // file attributes hTemplateFile // handle to template file ); ::CloseHandle(m_hFile);

      1 Reply Last reply
      0
      • D dellthinker

        Hi all. Im having trouble finding a simple example of CloseHandle. Does anyone know of a place where i can see a simple code using this function? Thanx in advance!

        J Offline
        J Offline
        Jonathan Darka
        wrote on last edited by
        #3

        How could you have difficulty ? Did you try google, MSDN, etc ? Here is a very basic example:

        HANDLE myHandle = CreateMutex(); // Or whatever call you want here

        ...

        if(!CloseHandle(myHandle))
        {
        // Handle error, you should always check return value of CloseHandle()
        }

        regards,


        Jonathan Wilkes Darka[Xanya.net]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups