|
The I guess you don't like STL. STL uses malloc and free all over the place due to the limitations of new and delete.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Man, you don't miss a trick, do you ? :P
My point remains, that as an end user, I do not call the C library because it confuses things and because I like constructors and destructors. The fact that it's used in a library for specific reasons does not affect my decision.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
pranavamhari wrote:
What is the win32 API equivalent of 'malloc' and 'free' ?
HeapAlloc() and HeapFree() . Neither is better as far as allocating memory goes, however you should always use the CRT functions so it can track you memory usage, find over/under writes, and flag leaks for you.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Michael Dunn wrote:
however you should always use the CRT functions so it can track you memory usage, find over/under writes, and flag leaks for you.
Are you saying this over HeapAlloc(), or over new ? Because I am certain that C++ memory management is tracked by VC in debug mode.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
VC doesn't track memory usage, the CRT does. So if you want to use those memory-tracking features, you need to use malloc /free and new /delete . If you use HeapAlloc /HeapFree directly, you're on your own.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Ah - I thought you were saying malloc is better than new, not the win32 functions.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hello there
I am using an (multithreaded) activex control in my CDialog based app.
When i run my app in debug mode, there are no problems and all is good (the ocx is a release build..and it doesnt change between build types)
But when i build and run my app in Release build, the axtivex control causes my app to crash. (below is part of the stack dump)
CWnd::OnAmbientProperty(....
COleControlSite::XAmbientProps::Invoke(....
COleControl::AmbientBackColor(....
The activex control is used elsewhere here at work, notebly in some VB apps and in a web page - and doesnt make them crash.
Is there a way I can tell my app not to crash or to tell my app to ignore any errors/exceptions this activex control generates?
I've tried using exception catching but its not always possible to wrap up calls to the control as it uses callbacks to tell the app when it's finished.
does anyone have any thoughts/suggestions on how I may be able to make my VC app handle the errors liks VB, IE etc seem to?
regards
Bryce
|
|
|
|
|
Hello,
I would like to support CD burning in my application that supports win9x/2k/xp. I'm considering using ASPI sdk to build the CD burning engine. I only able to find a bit information about this topic on the internet. Do you know more about building CD burning engine with ASPI sdk or some url for this topic?
Thanks,
Hiusing
|
|
|
|
|
I know of no free SDK to burn CD's, except that I heard that XP supports it internally. To support another OS, I believe you'll have to spend a fair bit of money.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
I know of no free SDK to burn CD's, except that I heard that XP supports it internally.
CDRecord/cdrtools by Jörg Schilling (and contributors). Cross-platform and GPL.
I don't know if it still requires ASPI, but I've got some GPL ASPI-emulation code that uses plain SPTI - no need for any Adaptect ASPI "drivers". I'm fairly certain this is quite similar to what's done in CDEx (I believe that's the project name - have a look at SourceForge and you should be able to find it).
|
|
|
|
|
hello kind and generous cpian
is there a method for telling a debug version of an app to fall over if it encounters a first chance exception ?
cheery pip
Bryce
|
|
|
|
|
For VC6.0
start your app in debug mode, this will add a Debug menu to the menubar in DevStudio.
Select Debug -> Exceptions
Select from the list (or add to it) the exception you want to handle, and select "Stop always" radio button.
HTH
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
|
I have a single-line edit control in a dialog-based MFC application. I'm trying to select all the text with ONE mouse click in the edit control, but it doesn't work. I put SetSel(0, -1) function in the OnEnSetfocusMyEdit function, but still it doesn't work. What I am missing?
|
|
|
|
|
One solution is to call SetSel() from the edit object.
editBox.SetFocus();
editBox.SetSel(0, -1);
Kuphryn
|
|
|
|
|
Hi,
Seems like a really stupid one but I'm trying to read email addresses out of around about 100 txt files that have been exported from a database. My plan was to CString.Find() the @ symbol, because only the email addresses have @ symbols in the file, then CString.Find() the space behind it to get the end of the address, then to work backwards and find the first space in front of the @.
My problem is though that if I do bleh.Find("@",0); I always get a return of -1, that there isn't one there. Does anyone know what I've done wrong/need to do to get this fixed?
Thanks
|
|
|
|
|
Have you traced through to make *sure* the address is there ? What does the code look like ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Consider a character if you want to search for one element and a string otherwise.
Find('@'); // 0 is default
Find("string");
Kuphryn
|
|
|
|
|
Hi I am a budding C++ programmer with a question.
I have declared and initialized a 2D array in the header file of my class as such:
char *styles[][2] =
{
/*HTML Start and end tags for styles*/
{"", ""},
{"<b>", "</b>"},
{"<i>", "</i>"},
{"<u>", "</u>"},
{"<!-- ", " -->"},
{"<p>\n", ""},
{"<br>\n",""},
{"", ""},
{"<h1>", "</h1>"},
{"<h2>", "</h2>"},
{"<h3>", "</h3>"},
{"<h4>", "</h4>"},
{"<h5>", "</h5>"},
{"<h6>", "</h6>"}
};
Here are the error messages I get:
error C2059: syntax error : '{'
error C2334: unexpected token(s) preceding '{'; skipping apparent function body
What gives? This is standard syntax is it not? TIA.
|
|
|
|
|
I am moving the initialization to the .cpp file. Hang on...
|
|
|
|
|
plz plz plz help me!!!
i need to change the caption of my check boxes , and tht text for the caption has to come frm a function, that is , it is a character array of an object ..so the caption is different, each time the program is run, according to the object ...stuck on this for hours...HALP!!or my univeristy might become another MIT (as far as suicides r concerned)
sarz
|
|
|
|
|
If you are using MFC, call the SetWindowText() method. It takes a single parameter which is the text to display. If you are using the Win32 API directly, call the SetWindowText() function: the first parameter is the HWND of the control, and the second is the text.
e.g. m_btnCheck.SetWindowText( _T("My checkbox") );
or SetWindowText( hwnd, _T("My checkbox") );
Dave
|
|
|
|
|
|
I have a MFC document that can open 2 files types, but save only one.
Is it possible to make it use a different filter in the save dialog,
since seeing the other file type there would confuse people...
Doesn't look so to me, but I'm hoping someone has done something like this before
|
|
|
|
|
Override the CDocument::DoSave() method, whose default implementation is found in MFC\doccore.cpp. That's where the standard SaveAs dialog box filters are built.
|
|
|
|
|