Click here to Skip to main content
16,011,626 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WaitCommEvent and GetCommMask (and overlapping) Pin
AnotherProgrammer20-May-04 6:23
AnotherProgrammer20-May-04 6:23 
GeneralCheck if application is running Pin
Mathias S.19-May-04 7:42
Mathias S.19-May-04 7:42 
GeneralRe: Check if application is running Pin
Renjith Ramachandran19-May-04 8:04
Renjith Ramachandran19-May-04 8:04 
GeneralRe: Check if application is running Pin
David Crow19-May-04 8:15
David Crow19-May-04 8:15 
GeneralExe Wrapper Pin
Anthony988719-May-04 6:48
Anthony988719-May-04 6:48 
GeneralRe: Exe Wrapper Pin
David Crow19-May-04 7:00
David Crow19-May-04 7:00 
GeneralRe: Exe Wrapper Pin
jmkhael19-May-04 7:03
jmkhael19-May-04 7:03 
GeneralBoundsChecker errors Pin
Deian19-May-04 6:08
Deian19-May-04 6:08 
Hello,

If i Debug my project with the VC++ 6.0 debuger I get no errors, but if I use BoundsChecker I get all kinds of errors, some of which I will post here, so someone out there may tell me if this is something with BoundsChecker or with my code.

First snippet (using mutex to prevent more than one instances of my program)

In the header of my CWinApp derrived main class:

HANDLE m_hMutex;


In the implementation (cpp) file of my CWinApp derrived class:
In InitInstance:

m_hMutex = CreateMutex(NULL, TRUE, _T("somename"));

	if(!m_hMutex || GetLastError())
	{
		CString strMessage, strTitle;
		strMessage.LoadString(IDS_APP_MESS1);
		strTitle.LoadString(IDS_INFORMATION);
		MessageBox(NULL, strMessage, strTitle, MB_OK|MB_ICONERROR);
		return FALSE;
	}


in the ExitInstance function

// if there is a mutex -> release it
	if(m_hMutex)
	{
		ReleaseMutex(m_hMutex);
	}


for this code I get no errors under the standard debugger and I get error from BoundsChecker: "Resource leak: allocated by CreateMutexA.....HANDLE:0x00000718

Next I have the following events occuring:

CMyDlg::OnInitDialog
CMyDlg::DestroyWindow

where in the CMyDlg::OnInitDialog I have the following code fragment:

hBitmap = NULL; // of type HBITMAP 
	hModule = NULL; // of type HMODULE

	hModule = LoadLibrary(_T("resource.dll"));
	
	if (hModule) 
	{
		hBitmap = ::LoadBitmap(hModule, MAKEINTRESOURCE(1000));
		ASSERT(hBitmap != NULL);
		m_bmp.SetBitmap(hBitmap); // static control
	}

and finally at CMyDlg::DestroyWindow I have:

if(hBitmap)
		VERIFY(::DeleteObject(hBitmap) != 0);
	
	if(hModule)
		VERIFY(FreeLibrary(hModule) != 0);

The error I detect using BoundsChecker is

CIShieldView::OnItemNew
CEntryDlg::OnInitDialog
Entry::DestroyWindow
First-chance exception in IShield.exe (KERNEL32.DLL): 0xC0000005: Access Violation.First-chance exception in IShield.exe (KERNEL32.DLL): 0xC0000005: Access Violation.

What am I doing wrong?

Thanks in advance
GeneralRe: BoundsChecker errors Pin
David Crow19-May-04 7:07
David Crow19-May-04 7:07 
GeneralRe: BoundsChecker errors Pin
Deian19-May-04 10:13
Deian19-May-04 10:13 
GeneralRe: BoundsChecker errors Pin
Deian19-May-04 10:18
Deian19-May-04 10:18 
GeneralRe: BoundsChecker errors Pin
David Crow19-May-04 10:28
David Crow19-May-04 10:28 
GeneralRe: BoundsChecker errors Pin
Deian19-May-04 10:36
Deian19-May-04 10:36 
GeneralRe: BoundsChecker errors Pin
John R. Shaw19-May-04 12:30
John R. Shaw19-May-04 12:30 
GeneralRe: BoundsChecker errors Pin
Kelly Herald19-May-04 16:56
Kelly Herald19-May-04 16:56 
GeneralRe: BoundsChecker errors Pin
Joe Woodbury19-May-04 16:59
professionalJoe Woodbury19-May-04 16:59 
GeneralActive X Controls in Dialog Pin
monrobot1319-May-04 4:56
monrobot1319-May-04 4:56 
GeneralRe: Active X Controls in Dialog Pin
Mike Dimmick19-May-04 5:19
Mike Dimmick19-May-04 5:19 
GeneralRe: Active X Controls in Dialog Pin
monrobot1319-May-04 6:44
monrobot1319-May-04 6:44 
GeneralRe: Active X Controls in Dialog Pin
Andrew Quinn AUS19-May-04 5:57
Andrew Quinn AUS19-May-04 5:57 
GeneralRe: Active X Controls in Dialog Pin
monrobot1319-May-04 6:48
monrobot1319-May-04 6:48 
GeneralRe: Active X Controls in Dialog Pin
Andrew Quinn AUS19-May-04 8:46
Andrew Quinn AUS19-May-04 8:46 
GeneralRe: Active X Controls in Dialog Pin
monrobot1319-May-04 9:02
monrobot1319-May-04 9:02 
GeneralCant rebuild ClassView file Pin
Wheatbread19-May-04 4:50
Wheatbread19-May-04 4:50 
GeneralRe: Cant rebuild ClassView file Pin
valikac19-May-04 5:03
valikac19-May-04 5:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.