|
Use your debugger and check where the code crashes. You are probably writing somewhere in memory where you shouldn't.
|
|
|
|
|
The context arround this exception is that I declare and realize a CDialog class. And I override its construct function. In the constructor, I initialize a pointer varriable to an varriable's address of parent window. I trace the code and I find the crasher happened after the execution of DDX_Control on the control varriable I added for an EditBox. Then when execute the CDialog::OnInitDialog(), the code crash. I'm really not know the reason. I try to delete the EditBox and the varriable associate with it. But the exception still happen.
|
|
|
|
|
I think I had like your problem previous How do you create editbox ?
|
|
|
|
|
The editbox is created using the dialog editor.
|
|
|
|
|
Are you sure id of editbox is unique on the Resource.h
|
|
|
|
|
For example if you have this code it generate an error
public:
CButton mm;
CButton mmm;
DDX_Control(pDX, IDC_BUTTON1, mm);
DDX_Control(pDX, IDC_BUTTON1, mmm);
or if you have an invalid IDC_BUTTON1 you get this message
An unsupported operation was attempted.
|
|
|
|
|
I had checked this varriable already that no duplicate was found.
|
|
|
|
|
For first try if you delete that line that has problem what happens?(DDX_)?
|
|
|
|
|
This exception disappeared.
|
|
|
|
|
Use of breakpoints for see error with F5 then you arrive will to error.
|
|
|
|
|
Thanks for your answer. I occasionally move the declaration of CEdit varriable to another place and put it adjoin with other CEdit varriable. So the exception disappear, although I don't know why. But this problem was resolved. I'm very happy! Thanks for everyone's helping.
|
|
|
|
|
I glad you sovled your problem.
|
|
|
|
|
And I override its construct function
Wrong term; a ctor can be overloaded but not overriden.
I try to delete the EditBox and the varriable associate with it. But the exception still happen.
Then possibly the reason is not that variable. Could you show us the line at which the failure accurs?
--
=====
Arman
|
|
|
|
|
//header file
class COpPDAFile : public CDialog<br />
{<br />
DECLARE_DYNAMIC(COpPDAFile)<br />
<br />
public:<br />
COpPDAFile(CWnd* pParent = NULL,CMySocket *pSock=NULL);<br />
virtual ~COpPDAFile();<br />
//cpp file
COpPDAFile::COpPDAFile(CWnd* pParent,CMySocket *pSock)<br />
: CDialog(COpPDAFile::IDD, pParent)<br />
, msg(NULL)<br />
, clsImage(NULL)<br />
{<br />
p_sock=pSock;<br />
}<br />
void COpPDAFile::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
DDX_Control(pDX, IDC_PDAFILE, lsPDAFile);<br />
DDX_Control(pDX, IDC_UPBTN, btnUp);<br />
DDX_Control(pDX, IDC_PATH, edPDAPath);<br />
}<br />
BOOL COpPDAFile::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();
......<br />
|
|
|
|
|
whiteclouds wrote: CDialog::DoDataExchange(pDX);
Set a breakpoint on this statement and F10 over the next three DDX_Control() statements. The one that crashes is the one you need to focus on.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
This is an access exception, meaning you're trying to read or write to a memory address you shouldn't. Generally this means you've not initialised a pointer, or you've freed memory and are still trying to access it.
If this is a debug build, run it under the debugger, and it should stop when the exception triggers. Examine your stack trace, and determine the line giving you problems.
Steve S
Developer for hire
|
|
|
|
|
Can you show your code on the OnInitDialog();
|
|
|
|
|
Pls see above.
|
|
|
|
|
Can Any one told me how to upload file in vc++ without Active X control
I want to upload file in MySQL Database using VC++ ,so can any
one told me how we accompolish this task
Regard's
Kaushik
|
|
|
|
|
I deaclare a static member in CMyDoc.h:
static CLogFile * m_pLogFile;
CLogFile is a class inherit from CFile. The class has some member functions to write some information into a txt file like some of log file.
In CMyDoc.cpp there are two static member function which use the m_pLogFile to record information in a txt file.
Then I should implement the statement:
m_pLogFile =new CLogFile;
m_pLogFile->Open(".\\log.txt",CFile::modeCreate|CFile::modeNoTruncate|
CFile::modeReadWrite|CFile::shareDenyNone);
but i have the question: where should i put these statements ?
I put them in the constructor of CMydoc class, there are the error:
error LNK2001: unresolved external symbol "public: static class CLogFile * CMyDoc::m_pLogFile" (?m_pLogFile@CMyDoc@@2PAVCLogFile@@A)
|
|
|
|
|
In your cpp file, outside the class declaration, you should put something like this:
CLogFile* CMyDoc::m_pLogFile = NULL;
Static members are initialized at startup so they need to be defined at global scope.
|
|
|
|
|
Cedric Moonen wrote: CLogFile* CMyDoc::m_pLogFile = NULL;
it works.thank you very much!
|
|
|
|
|
Work environment:WinXP+SP2 , VC6.0+Sp6
I want to write a server program to search some files in office network.
My Question Is:
when i call
/*the directory is exist*/
LPCTSTR pstrName= _T("\\\\OfficeNet\\TmpDir\\*.*");
pNextInfo = new WIN32_FIND_DATA;
lstrcpy(((WIN32_FIND_DATA*) pNextInfo)->cFileName, pstrName);
hContext = ::FindFirstFile(pstrName, (WIN32_FIND_DATA*)pNextInfo);
if these statements run in server program, then
hContext = INVALID_HANDLE_VALUE,GetLastError=183.I got these infomation by output a log file.
if i run them in my another program that isn't a server program, it can work
correcttly.
Why????????????????????
|
|
|
|
|
Some times ago I tried like you with FindFirstFile and got same problem but it seems it doesnt work on the network.
|
|
|
|
|
I think it work on network, but can't run with server program.
FindFirstFile work corretlly in nonserver program .
|
|
|
|