|
Thanks for the comments, though I know that it works without defining DEBUG_NEW or with using the new operator from globalnamespace (i.e. ::new) as described in Benjamin's comment, but does anyone have any idea why it doesn't work with GDI+ classes? I mean there must be some error somewhere, since the debug_new operator seems to work fine with classes who take parameters in their constructors but not with GDI+.
For example I have created a class with
class CTest <br />
{<br />
public:<br />
CTest();<br />
CTest(int x);<br />
virtual ~CTest();<br />
};<br />
and it works fine by
CTest* test = new CTest(3);
and further testing.. tadaa I found the error!
if your class lacks a constructor without parameters (so do the GDI+ classes), as in:
class CTest <br />
{<br />
public:<br />
CTest(int x);<br />
virtual ~CTest();<br />
};<br />
the debug new operator fails on the following line:
<br />
CTest* test = new CTest(3);<br />
Must be a bug or a lazy implementation.
edit:
That wasn't true, I retested it and debug_new works with the CTest class in both cases.
I'm pretty confused by now..
|
|
|
|
|
Hope I can post this here. How do I disable/enable the message that comes up when you want to delete a file in general on windows? I'm not looking for tis info in Help in the right way so I cant find it...
Appreciate your help,
ns
|
|
|
|
|
Right click on your rec. bin and select properties, then check or uncheck the 'Display delete confirmation dialog' check box.
Or did you mean in code?
Dylan
|
|
|
|
|
Nope> Just mechanically like you informed me. Many thanks!
Appreciate your help,
ns
|
|
|
|
|
I have made a base class like this:
class CLogBook
{
public:
CLogBook();
virtual ~CLogBook();
BOOL Open(string);
void Close();
BOOL FillListBox(HWND);
virtual BOOL Write(string) = 0;
BOOL Clear();
protected:
fstream m_filestream;
};
and a derived class like:
class CErrorLog : public CLogBook
{
public:
CErrorLog();
~CErrorLog();
BOOL Write(string);
};
It builds fine untill I declare a varible of CErrorLog somewhere in my code!
Then I get:
NetPaint error LNK2019: unresolved external symbol "public: __thiscall CErrorLog::CErrorLog(void)" (??0CErrorLog@@QAE@XZ) referenced in function _$E1
NetPaint error LNK2019: unresolved external symbol "public: virtual __thiscall CErrorLog::~CErrorLog(void)" (??1CErrorLog@@UAE@XZ) referenced in function _$E2
I think errors like these are impossible for you to solve, but I make I tray anyway!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Seems that your CErrorLog class is not included in your project.
So :
1. Make sure ErrorLog.cpp and .h have been loaded in your project.(Look at the file browser)
2. Check your #include's
~RaGE();
|
|
|
|
|
I don't think that is the problem...
This is my .h file:
extern string strDay[7];
extern string strMonth[12];
class CLogBook
{
public:
CLogBook();
virtual ~CLogBook();
BOOL Open(string);
void Close();
BOOL FillListBox(HWND);
virtual BOOL Write(string) = 0;
BOOL Clear();
protected:
fstream m_filestream;
};
class CErrorLog : public CLogBook
{
public:
CErrorLog();
~CErrorLog();
BOOL Write(string);
};
And my .cpp:
#include "stdafx.h"
string strDay[7] = {"Söndag", "Måndag",
"Tisdag", "Onsdag",
"Torsdag", "Fredag",
"Lördag"};
string strMonth[12] = {"januari", "februari", "mars",
"april", "maj", "juni",
"juli", "augusti", "september",
"oktober", "november", "december"};
CLogBook::~CLogBook()
{
Close();
}
BOOL CLogBook::Open(string path)
{
m_filestream.open(path.c_str(),
ios_base::in | ios_base::out | ios_base::app);
if(!m_filestream.is_open())
return FALSE;
return TRUE;
}
void CLogBook::Close()
{
if(!m_filestream.is_open())
m_filestream.close();
}
BOOL CLogBook::Clear()
{
if(!m_filestream.is_open())
return FALSE;
m_filestream.write("",0);
return TRUE;
}
BOOL CLogBook::FillListBox(HWND listbox)
{
if(!m_filestream.is_open())
return FALSE;
m_filestream.seekg(0);
while(!m_filestream.eof())
{
string buf("");
getline(m_filestream, buf, '\n');
ListBox_AddString(listbox, buf.c_str());
}
return TRUE;
}
BOOL CLogBook::Write(string data)
{
if(!m_filestream.is_open())
return FALSE;
m_filestream.write(data.c_str(), (int)data.length());
return TRUE;
}
BOOL CErrorLog::Write(string data)
{
string strDataToWrite("");
strDataToWrite.append(DateTimeString());
strDataToWrite.append(" > ");
strDataToWrite.append(data);
return CLogBook::Write(strDataToWrite);
}
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
C++ will not "include" (map) object as long as it's not referenced....
So if you declare class:
class CBrian {
CBrian();
virtual ~CBrian();
void X();
}
It will compile just fine even tho CBrian() and ~CBrian() has no body.
As soon as you declare: CBrain var; compiler will try to map space(frame) for all object members and functions. C++ at that stage will notice all the missing members.
|
|
|
|
|
Argh!
Thank you!
I made a body for all my "unresolved external symbols" and it works!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
DWORD dwCb = sizeof(RASENTRYNAME);
DWORD dwEntries = 0;
RASENTRYNAME lpRasEntryName[20];
lpRasEntryName[0].dwSize = sizeof(RASENTRYNAME);
RasEnumEntries(NULL,NULL,lpRasEntryName,&dwCb,&dwEntries);
This is the code. The problem is that RasEnumEntries returns 610 which is ERROR_BUFFER_INVALID only on Windows98. The code works perfectly on win2000. What is the problem, I need this problem to be solved as soon as possible
Please help me
|
|
|
|
|
Jump_Around wrote:
DWORD dwCb = sizeof(RASENTRYNAME);
DWORD dwEntries = 0;
RASENTRYNAME lpRasEntryName[20];
lpRasEntryName[0].dwSize = sizeof(RASENTRYNAME);
RasEnumEntries(NULL,NULL,lpRasEntryName,&dwCb,&dwEntries);
Change to:
DWORD dwCb = sizeof(RASENTRYNAME);<br />
DWORD dwEntries = 0;<br />
RASENTRYNAME lpRasEntryName[20];<br />
<br />
ZeroMemory(lpRasEntryName, sizeof(lpRasEntryName));<br />
<br />
lpRasEntryName[0].dwSize = sizeof(RASENTRYNAME);<br />
RasEnumEntries(NULL,NULL,lpRasEntryName,&dwCb,&dwEntries);
I'm not sure about it
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Try:
DWORD dwCb = 20 * sizeof(RASENTRYNAME);
|
|
|
|
|
Jump_Around wrote:
lpRasEntryName[0].dwSize = sizeof(RASENTRYNAME);
I think you have to do this for all 20 structures in your array. (Note the word "think" - something rings a bell that you have to do this, but I can't remember for certain!).
Hope this helps!
|
|
|
|
|
Well, the problem is that this code works everywhere else than on Win98 OS and I don't know why.
even when I took a piece of code from the www 610 error appears.
|
|
|
|
|
I had this same problem a couple years ago. In my case the problem showed up when I complied under Studio.Net with win2000 and used the program on Win98. Did not have the problem when I complied under Studio 6. I ended up creating a DLL with all the RAS operations in it complied with Studio 6 and used it in the rest of the application complied with Studio.Net. I spent a lot of time looking at Ras header files and it was a nightmare.
Art
|
|
|
|
|
AOA!
last night as i was trying to do one of my Assignments i tried to open a form using my Class inherted from CFormView!
the problem is that i was able to show the form as i want but as i close this window using the CWnd::DestroyWindow() i get an Assert Failure!
the Code i am using to initialize the window is as follows:
//defined in MyClass.h;
CMyClass Form;
CMyMainView::OnInitialUpdate()
{
CView::OnInitialUpdate();
CRect Rect;
GetClientRect(Rect);
Form.Create(NULL,"NewForm",WS_VISIBLE|WS_BORDER|WS_CHILD,Rect,this,1234,NULL);
}
And to Destroy the Window
CMyMainView::OnFileNew()
{
Form.DestroyWindow();
}
i cant understand y i get the assert failure when i click the new button on the toolbar!
the Assert Failure Message i get is as follows:
Debug Assertion Failed!
Program:E:\Chummi.exe
File:dbgheap.c
Line:1101
Expression:_CrtIsValideHeapPointer(pUserData)
//bla bla bla
plz help!
shoaib!
|
|
|
|
|
You must allocate Form dinamically because CView::PostNcDestroy contains delete this . Make it CMyClass *pForm .
rechi
|
|
|
|
|
Thankx Man ! u r the Gr8est! ;)
|
|
|
|
|
Hiya I have an MFC app that writes data to my SQL database. The columns lenghts are set to 30. But when I open my SQL database to view the contents, I can only see the first 15 chars of each column..
How do I get the SQL database to display the full columns lenghts when it is opened??
Thanks,
grahamoj.
|
|
|
|
|
What do you mean by "the SQL database"?
Regards,
Alvaro
Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com
|
|
|
|
|
I meant that I have SQL loaded on my machine for doing database stuff..
What I do is write the info to the database and then using Enterprise Manager, go in to the table to view it. All of the string is in the column. I can see it when I expand the column.
What I want to be able to do is when I open the table in Enterprise Manager, I want the column already expanded to the full lenght of the string...
Any ideas,
grahamoj
|
|
|
|
|
hi ppl.
i am making an Internet Explorer toolbar plugin using the sample Kbbar.
In it i want to load a dialog from resources. but it resulted in Debug assertion failure.
Upon debugging in depth i came to find out that AfxGetResourceHandle() was the reason, as call to this function or a call to MAKEINTRESOURCE macro resulted in the Debug Assertion failure problem. plz help me in that.
here is the portion of the code :
m_pMsgDlg = new CMsgDlg(this); /* m_pMsgDlg is a pointer of CMyDialog: public CDialog */
if (m_pMsgDlg->Create(IDD_MSGDLG, tempPtr) == FALSE)
{
MessageBox("no dialog");
}
plz plz help me.
Farrukh
|
|
|
|
|
Try this:
HINSTANCE hsav= AfxGetResourceHandle();
AfxSetResourceHandle(theApp->m_hInstance);
m_pMsgDlg = new CMsgDlg(this);
if (m_pMsgDlg->Create(IDD_MSGDLG, tempPtr) == FALSE)
{
MessageBox("no dialog");
}
AfxSetResourceHandle(hsav);
rechi
|
|
|
|
|
thankiew very much for help.
i tried the solution that u provided.
but the problem is still there.
i found that AfxGetApp() returns 0 always.
i donno whats the problem.
to put into your notice, i will like to tel that i am using the KbBar sample
that comes with MSDN and is also available on this site for downloading.
thanx again.
Byez
Farrukh
|
|
|
|
|
Don't use AfxGetApp() but the singleton theApp , The one and only.
[EDIT]
But first make sure that you wrote AFX_MANAGE_STATE(AfxGetStaticModuleState()); at the beginning of your function.
[/EDIT]
rechi
|
|
|
|