Listing 3: Using HandleTracker

#include <afx.h>
#include "htracker.h"

int main()
{
    TRACE("Inside main()\n");

    HANDLE hMutex1 =
    CreateMutex
    (0, // default security.
     FALSE, // not owned.
     NULL); // not named.

    HANDLE hMutex2 =
    CreateMutex
    (0, TRUE, "Mutex #2");

    CloseHandle(hMutex1);

    TRACE("Leaving main()\n");

    return 0;
}

/*

Produces the following output:

Inside main()
Leaving main()
Detected resource leaks!
C:\users\Mike\CUJ\HTracker
 \main.cpp(16) : created in 
 CreateMutex
The program 'C:\users\Mike\CUJ
 \HTracker\Debug\HTracker.exe' 
 has exited with code 0 (0x0).

*/

//End of File