|
Personally I'd go the RegisterClass route. There have been times I've used a custom control using straight Win32, no MFC or classes. It'll make your control usable than just MFC, you could use it from VB, Delphi, Python, who knows what else.
Joel Lucsy
|
|
|
|
|
Hy guys,
I'm building an application (Visual C++) that has to write the results of elaboration on a CD-ROM using the ISO9660 format (praticly creating the ISO-image and after burn a CD-R!!).
I know that in WindowsXP this operation is integrated inside the OS (or better the OS use automaticly the SW layer relative to burn CD)but in my case I'll use Windows2000.
Anyway,I suppose that will be necessary to include a library or buy a SDK but unfortunatly I have no ideas about where and how find it and eventually some explaination to how use it.
Someone have some suggests for me,please.
Thanks in advance
Andrea
|
|
|
|
|
Read all you can about the ISO format, cause you might have to code everything yourself. There are lots of open source rojects where you can learn about CD-ROM image creation.
Finally there are a few CD-ROM writing libraries and SDK like www.padus.com and others that might help you.
|
|
|
|
|
Hi,
I'm using GDI+ in my MFC based application and create GDI+ classes on the fly using the new operator as follows:
Bitmap* mybitmap = new Bitmap(320,24);
The above line compiles fine if I build the application in release mode, but in debug mode, compiler (VC++6.0 w. SP5, latest platform sdk) fails with:
error C2660: 'new' : function does not take 3 parameters
That is because of mfc's debug definitions on top of the file:
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif
and DEBUG_NEW is defined in afx.h as:
#define DEBUG_NEW new(THIS_FILE, __LINE__)
So, what exactly is wrong with calling a constructor with parameters? Does the "debug" version new operator handle the case incorrect or am I making a terrible mistake somewhere?
Any help would be appreciated.
P.S: Bitmap(320,200) is the same as Bitmap(320,200,PixelFormat32bppARGB) and neither case it didn't compile.
|
|
|
|
|
http://www.codeproject.com/vcpp/gdiplus/gdiplusspeed.asp#xx81095xx
Read the thread "Can't create bitmaps with new"
|
|
|
|
|
I found if you comment out the line #define new DEBUG_NEW it will work just fine. You just won't have any indications that you're leaking memory.
Joel Lucsy
|
|
|
|
|
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.
|
|
|
|