|
I don't know of a prepackaged way, but you should do it with a bit of programming.
1/ Make a resource only dll, and create the VERSIONINFO in it the way you'd like.
2/ Make a small program to merge the version resource into the MC created one - Have a look at BeginUpdateResource, UpdateResource, EndUpdateResource for the MC one, and FindResource et al for the versioninfo one.
3/ Add the mergeres.exe program to your custom build steps.
I didn't say it would be eeeeasy....
Iain.
|
|
|
|
|
What and where is mergeres.exe?
|
|
|
|
|
It's the program you write for yourself in step 2...
Iain.
|
|
|
|
|
Hi
In one of my application crashes sometime.
I used _CRTDBG_MAP_ALLOC and _CrtMemState() to set set points in various location of application and compared to find the leak. Sometime it alerts for memory leaks and sometimes not.
Could any way to locate the exact file/line which creates the problem?
Also I like to know can I use the _CRTDBG_MAP_ALLOC in AIX platform, or any equivalent?
Thanks
Krishnakumar
|
|
|
|
|
Do you want to find why your app crashes or find memory leaks?
Mamory leaks don't necessarily cause crashes...
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I want to find why my applicaiton is failing. But my primary investigation there some code which are free() memory which are not properly allocated. I used Visual studio 6.0 debugger to do so.
So anything which helps to point out from which location/line/file the problem occurs will be helpful.
thanks
Krishnakumar
|
|
|
|
|
|
krishnakumar75 wrote: I used _CRTDBG_MAP_ALLOC and _CrtMemState() to set set points in various location of application and compared to find the leak. Sometime it alerts for memory leaks and sometimes not.
Where you do checkpoints can effect the results. You need to make sure no allocations that
aren't freed are made between checkpoints.
I prefer to use a static class object so I can catch all leaks (except possibly any in other
static objects) that occur over the lifetime of the app.
I use this in one (usually the main) source module:
#ifdef _DEBUG
class _MemStateCheck
{
public:
CMemoryState oldMemState, newMemState, diffMemState;
_MemStateCheck();
~_MemStateCheck();
};
_MemStateCheck::_MemStateCheck()
{
oldMemState.Checkpoint();
}
_MemStateCheck::~_MemStateCheck()
{
newMemState.Checkpoint();
if( diffMemState.Difference( oldMemState, newMemState ) )
{
TRACE( "************************\n" );
TRACE( "Memory leaks Detected\n" );
TRACE( "************************\n" );
diffMemState.DumpStatistics();
diffMemState.DumpAllObjectsSince();
}
else
{
TRACE( "************************\n" );
TRACE( "No memory leaks Detected\n" );
TRACE( "************************\n" );
}
}
_MemStateCheck MemCheckObj;
#endif //#ifdef _DEBUG
For MFC apps, I include this at the top of every source (cpp) file (under any #include lines):
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
To get file/line numbers for malloc, you should use _malloc_dbg instead of malloc (it will use the regular malloc in non-debug builds):
void *p = _malloc_dbg(128, _NORMAL_BLOCK, __FILE__, __LINE__ );
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
One more item - if you're coding in C++ and using malloc(), you might consider switching to
using new and delete instead!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I've created a custom control (a la article by Chris) to display a region of a bitmap. The control has vertical and a horizontal markers manipulated with the OnLButtonDown/OnLButtonUp/OnMouseMove handlers. The control is placed in a dialog. Now I'd like to add OnKeyDown support. Unfortunately, the dialog traps the WM_KEYDOWN message and just advances to the next control!
How do I get the WM_KEYDOWN message to the custom control?
Regards,
Kylur
|
|
|
|
|
Have a look at WM_GETDLGCODE / ON_WM_GETDLGCODE. That should answer your questions!
Iain.
|
|
|
|
|
Thanks! Exactly what I needed.
|
|
|
|
|
Hi all,
I am using CDynamicAccessor, CTable and other OLEDB API for database programming. I have a problem while inserting date field.
I am reading the date field from text file and the format of date is "M/d/yyyy". If System date format (Control Panel > Regional and Langauage Options) is "d/M/yyyy", then GetValue(Ordinal) retrieves NULL (in case of date greater than 12).
How to retrieve date field whatever may be the format of system date?
Thanks.
|
|
|
|
|
I'm in the unfortunate position of having to interact with mscorlib ( the .NET core library ) via COM. So I used regasm to generate a tlb of mscorlib and included the headers into my project. The headers build just fine in the debug build of the application, but the release build blows up with errors like this:
error C2628: '$S73' followed by 'void' is illegal (did you forget a ';'?)
error C2628: '$S74' followed by 'void' is illegal (did you forget a ';'?)
error C2628: '$S75' followed by 'void' is illegal (did you forget a ';'?)
(which as a result leads to a whole lot of other errors)
Which correspond to the following:
struct __declspec(uuid("b36b5c63-42ef-38bc-a07e-0b34c98f164a"))
/* dual interface */ _Exception;
struct __declspec(uuid("bca8b44d-aad6-3a86-8ab7-03349f4f2da2"))
/* interface */ _Type;
struct __declspec(uuid("35d574bf-7a4f-3588-8c19-12212a0fe4dc"))
/* dual interface */ IDictionaryEnumerator;
I haven't done anything that would introduce syntax errors into this file. Has anyone seen anything like this before?
I'm using Visual C++ 6 (I know I know. It's not my decision).
Thanks,
Stephen
-- modified at 10:02 Tuesday 19th June, 2007
I'm constantly improving every aspect of life. Not just my music, my rhymes but every facet requires its due attention to shine.
|
|
|
|
|
The __declspec extension to support uuid may have been added after VC++6. I certainly never used it way back when. I don't have any docs capped at VC6 so I can't confirm it.
I'd use the old style
<br />
const IID IID_ISomeControl = {0x2212DD08,0x71C8,0x409d,{0x8A,0x50,0x96,0x66,0x12,0x16,0x6E,0xA8}};<br />
instead.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Actually, the problem was that another header file was doing:
#define _Exception void
and that was causing the compiler to freak out.
Thanks,
Stephen
I'm constantly improving every aspect of life. Not just my music, my rhymes but every facet requires its due attention to shine.
|
|
|
|
|
Matthew Faithfull wrote: The __declspec extension to support uuid may have been added after VC++6.
VC6 supports the uuid attribute of __declspec .
Otherwise it wouldn't be possible to use __uuidof() and I've used that one a lot.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hello All,
i have dialog base application and I am try to create richeditctrl in oninitdiaog function follows :
m_RichEditCtrl.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|ES_MULTILINE, CRect(10,10,100,200), this, 1);
but it doesn't show on dialog box
what i have forget please anyone tell me....
thanks
|
|
|
|
|
Hi,
Should work fine but...
Did you remember to enter AfxInitRichEdit2() in the InitInstance of the application?
Rolando
|
|
|
|
|
i forget this but now i have called this function but still it is now showing
what can be a problem?
|
|
|
|
|
Make sure you are calling the AfxInitRichEdit2() function at the begining of the application and not within OnInitDialog();
Also, did you declare m_RichEditCtrl as a CRichEditCtrl?
I tested this using VS 2005 version 8.0.50727.762 (SP.050727-7600) and your code was copied and pasted into the OnInitDialog without changes. All I then did was declare m_RichEditCtrl as a CRichEditCtrl.
Other than this I do not know what else to tell you. Hope this helps.
Rolando
|
|
|
|
|
Hello Guru
I am making an application for reading .txt file from Hard Hisk and
copy this file to folder and save it name in database.
In this program i can read data from hard drive and copy the file to
folder and also save its name in database.
Whenever i create a file in folder .(Its create successfully but
when try to reading contant of old file and writing new one an
assertion occor.
my code for that function is below.
CString str;
int ids;
CFileDialog Obj(TRUE);
if(Obj.DoModal() ==IDC_BUTTON3)
{
m_Upload = Obj.GetFileName();
}
str.Empty();
str = Obj.GetPathName();
SetDlgItemText(IDC_EDIT1,str);
///////////////////////////////////////////////////////////////////
/* reading file data from disk */
/////////////////////////////////////////////////////////////////
CString strLine = "";
CString buffer = "";
CStdioFile fileObj,filewrite;
CString fname;
fileObj.Open(str, CFile::modeRead | CFile::shareDenyWrite);
fname = fileObj.GetFileName();
// MessageBox(fname);
while(fileObj.ReadString(strLine))
{
fileObj.ReadString(strLine);
// fileObj.WriteString(fname);
buffer += strLine + "\r\n";
}
fileObj.Close();
// MessageBox(buffer);
SetDlgItemText(IDC_EDIT3,buffer);
fileObj.Open("c:\\UserFolder\\" + fname + ".txt",CFile::modeCreate,NULL);
Its run up to here successfully.
Its create a blank file in folder .
Now i am writing above code like this ( simple reading data from old file and writing it to new one an assertion occor . The code is below.
CString str;
int ids;
CFileDialog Obj(TRUE);
if(Obj.DoModal() ==IDC_BUTTON3)
{
m_Upload = Obj.GetFileName();
}
str.Empty();
str = Obj.GetPathName();
SetDlgItemText(IDC_EDIT1,str);
///////////////////////////////////////////////////////////////////
/* reading file data from disk */
/////////////////////////////////////////////////////////////////
CString strLine = "";
CString buffer = "";
CStdioFile fileObj,filewrite;
CString fname;
fileObj.Open(str, CFile::modeRead | CFile::shareDenyWrite);
fname = fileObj.GetFileName();
// MessageBox(fname);
while(fileObj.ReadString(strLine))
{
fileObj.ReadString(strLine);
// fileObj.WriteString(fname);
buffer += strLine + "\r\n";
}
fileObj.Close();
// MessageBox(buffer);
SetDlgItemText(IDC_EDIT3,buffer);
/*//////////////////////Copying file to another folder//////////////////////////*/
str.Empty();
fileObj.Open(str,CFile::modeRead);
while(filewrite.ReadString(strLine))
{
filewrite.WriteString(fname);
buffer += strLine + "\r\n";
}
fileObj.Open("c:\\UserFolder\\" + fname + ".txt",CFile::modeCreate,NULL);
How can i write content of old one to new one.
Any one Please told me .
Regard's
Kaushik
|
|
|
|
|
Hi,
Rather than reading the contents of the txt file to a buffer and then create and write it to the new file why not just do both at the same time?
<br />
CStdioFile fSrc, fDest;<br />
<br />
...<br />
<br />
while (fSrc.ReadString(strLine))<br />
{<br />
fDest.WriteString(strLine);<br />
}<br />
<br />
fSrc.Close();<br />
fDest.Close();<br />
Also, in your code you are missing the first line of the text file.
while(fileObj.ReadString(strLine)) <-- moves file pointer to next line<br />
{<br />
fileObj.ReadString(strLine); <-- reads next line. 1st line is gone!!<br />
...<br />
}
Finally, unless you are making changes or scrapping the text file for any data why not use the ::CopyFile function?
Hope this helps!
Rolando
|
|
|
|
|
I would agree strongly with using CopyFile unless there is some compelling reason not to. NTFS files can include information on file streams that you wouldn't see by simply opening, reading and writing. While this would be rare, it can happen.
Also, you would be setting permissions on the new file to those of the user running your program. This *may* be what you want, but not necessarily.
I'm sure there are other reasons I can't think of right now.
Iain.
|
|
|
|
|