Click here to Skip to main content
15,923,051 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionget millisecond Pin
LeeeNN22-Jun-06 9:22
LeeeNN22-Jun-06 9:22 
AnswerRe: get millisecond Pin
Zac Howland22-Jun-06 9:29
Zac Howland22-Jun-06 9:29 
GeneralRe: get millisecond Pin
LeeeNN22-Jun-06 10:24
LeeeNN22-Jun-06 10:24 
GeneralRe: get millisecond Pin
Zac Howland22-Jun-06 10:27
Zac Howland22-Jun-06 10:27 
GeneralRe: get millisecond Pin
David Crow23-Jun-06 3:42
David Crow23-Jun-06 3:42 
Questionmsvc keeps recompiling all Pin
ehh22-Jun-06 9:11
ehh22-Jun-06 9:11 
AnswerRe: msvc keeps recompiling all Pin
PJ Arends22-Jun-06 19:52
professionalPJ Arends22-Jun-06 19:52 
Questionproblem walking all over an array Pin
pblais22-Jun-06 9:04
pblais22-Jun-06 9:04 
I have a strange problem.. Well, strange for me.

I have written a dll called APM_DLL.cpp and its header APM_DLL.h.
I am using this dll in a dialog app calle CAPM_CPDlg.cpp and CAPM_CPDlg.h.

I declare the dll in the dialog as a pointer as follows..........
In CAPM_CPDlg.h, I have the following:
#include "APM_DLL.h"<br />
<br />
class CAPM_CPDlg : public CDialog<br />
{<br />
// Construction<br />
public:<br />
	CAPM_CPDlg(CWnd* pParent = NULL);	// standard constructor<br />
<br />
	APM_DLL	*MYDLL;<br />


Then in CAPM_CPDlg.cpp, I do the following:
BOOL CAPM_CPDlg::OnInitDialog()<br />
{<br />
	CDialog::OnInitDialog();<br />
<br />
	// IDM_ABOUTBOX must be in the system command range.<br />
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);<br />
	ASSERT(IDM_ABOUTBOX < 0xF000);<br />
<br />
	CMenu* pSysMenu = GetSystemMenu(FALSE);<br />
	if (pSysMenu != NULL)<br />
	{<br />
		CString strAboutMenu;<br />
		strAboutMenu.LoadString(IDS_ABOUTBOX);<br />
		if (!strAboutMenu.IsEmpty())<br />
		{<br />
			pSysMenu->AppendMenu(MF_SEPARATOR);<br />
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);<br />
		}<br />
	}<br />
	MYDLL = new APM_DLL;<br />

Don't ask me why, I inherited this code.

I have also have the following declaration inside APM_DLL.h.
byte    RxBuffer[256];<br />

Anyways... in the main app, I make a call like MYDLL->GetSomething(). GetSomething() stores values in RxBuffer[0..n]. Then when I want to access this in the main app, I use MYDLL->RxBuffer[0..n]. This has worked great until this morning when I did the following in APM_DLL.h
byte    ROM_Buffer[100];<br />
byte    RxBuffer[256];<br />

Now, if I put a break inside the actual dll and look at RxBuffer, it is ok. Then when I put a break in the main app right after MYDLL->GetSomething, MYDLL->RxBuffer is trashed. If I comment out the ROM_Buffer declaration, everything works fine inside the dll and out It only gets slammed if I compile the ROM_Buffer declaration. I have moved that declaration after the declaration of RxBuffer and ahead of a variable that I don't need to access from the main app. Everything seems to be working. But, I think this is only a band-aid and I am still walking over something important.

By the way... if I make ROM_Buffer[200], I get the following crash error

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: D:\Projects\Motorola\GS Iden APM\Software\Release\APM_CP.exe
File: dbgheap.c
Line: 1099

Expression: _pLastBlock == pHead

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------



Any ideas and/or suggestions?

Regards
Pierre
AnswerRe: problem walking all over an array Pin
Zac Howland22-Jun-06 9:27
Zac Howland22-Jun-06 9:27 
GeneralRe: problem walking all over an array Pin
pblais22-Jun-06 10:21
pblais22-Jun-06 10:21 
GeneralRe: problem walking all over an array Pin
David Crow23-Jun-06 3:49
David Crow23-Jun-06 3:49 
GeneralRe: problem walking all over an array Pin
pblais23-Jun-06 10:53
pblais23-Jun-06 10:53 
GeneralRe: problem walking all over an array Pin
Zac Howland25-Jun-06 8:45
Zac Howland25-Jun-06 8:45 
GeneralRe: problem walking all over an array Pin
pblais26-Jun-06 9:06
pblais26-Jun-06 9:06 
GeneralRe: problem walking all over an array Pin
Zac Howland26-Jun-06 9:28
Zac Howland26-Jun-06 9:28 
GeneralRe: problem walking all over an array Pin
pblais26-Jun-06 10:13
pblais26-Jun-06 10:13 
GeneralRe: problem walking all over an array Pin
Zac Howland26-Jun-06 10:25
Zac Howland26-Jun-06 10:25 
Questionabout printing formulars Pin
ivanris22-Jun-06 8:08
ivanris22-Jun-06 8:08 
Questionmultiple selections in List View (LVS) Pin
aafcls22-Jun-06 8:04
aafcls22-Jun-06 8:04 
AnswerRe: multiple selections in List View (LVS) Pin
Michael Dunn22-Jun-06 8:28
sitebuilderMichael Dunn22-Jun-06 8:28 
GeneralRe: multiple selections in List View (LVS) Pin
aafcls22-Jun-06 8:48
aafcls22-Jun-06 8:48 
GeneralRe: multiple selections in List View (LVS) Pin
Zac Howland22-Jun-06 9:40
Zac Howland22-Jun-06 9:40 
GeneralRe: multiple selections in List View (LVS) Pin
Michael Dunn22-Jun-06 10:45
sitebuilderMichael Dunn22-Jun-06 10:45 
GeneralRe: multiple selections in List View (LVS) Pin
aafcls23-Jun-06 4:02
aafcls23-Jun-06 4:02 
GeneralRe: multiple selections in List View (LVS) Pin
Michael Dunn23-Jun-06 15:01
sitebuilderMichael Dunn23-Jun-06 15:01 

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.