|
At work we use purify, and it works quite good and is a pretty fast solution for finding memory related problems.
I tried boundschecker and its also pretty good, it integrate several error checking capabilities like the thing you mentioned, and more (deadlock detection, call validation, object tracking, .NET analysis ...)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thank you, I will try purify! Is it still being activly developed with new versions?
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
I know that they are currently working on new features in Purify plus
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Do you have any detailed information? Like e.g. release date or supported platforms/IDEs (like VS.NET 2005 e.g.) or new features?
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
Are you saying that BoundsChecker v7.1 is out-of-date?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I do have 7.02 (or something like that) from 2002 and therefore I imply that 7.1 is out of date, too. Additionaly the sales man told me to contact me when new releases are available but I never heard from him again
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
|
I tried the following lines of code on VC++ 2003.NET:
wofstream file;
wstring filename = "whatever.xml"
file.open(filename.c_str(), ios_base::out | ios_base::trunc);
however when compiling I get an error saying that the compiler can't convert from const wchar_t* into const char*. What happened to polymorphism. When I look at the error message I can see that the file variable is correctly a basic_stream using wchar_t but the open function still wants to take a const char*. Isn't this wrong? Is this an incorrect implementation?
I am the handsome one in the crowd.
|
|
|
|
|
This looks like a Unicode problem. Try prefacing the string literal with L .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
AFAIK wofstream::open is actually a call to basic_filebuf::open(const char *_Filename, ios_base::openmode _Mode) (as declared in the file 'fstream'). As you can see it takes a const char* for the file name, I have not found a version that takes a wchar_t.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
hi,
i have small problem on pointers. Suppose i have avariable called 'varA' and i a function called 'modifyvariable'. Now when i write this:
//***********************
void main()
{
int varA;
modifyvariable(&varA);
}
void modifyvariable(int *varB)
{
int temp;
varB = &temp;
}
//************************
Okay. Example: if the address of varA is 25200, and and i pass the address of varA to modifyvariable by writing 'modifyvariable(&varA);', the address 25200 gets copied to the pointer varB. Now if the address of temp is 26200, and i change the value of the pointer varB (which is currently 25200) to 26200 using the code 'varB = &temp;', the address contained within varB does change but the address of varA does not change. how can i change the address of varA to 26200 from the fucntion?
|
|
|
|
|
You need this instead:
void modifyvariable(int **varB)
{
int temp;
*varB = &temp;
}
void main()
{
int varA;
int *p = &varA;
modifyvariable(&p);
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
consider varB has only a destination pointer. So when you change its address, varA itself does not change. I think you need a reference variable. This acts like an alias of the original variable itself.
Another thing, the original sample code has a fundamental bug. This involves the temp local variable. The moment your function returns, the variable goes out of scope and the pointer value set to varB will immediately become invalid. You can check this by tracing through the code.
I Dream of Absolute Zero
|
|
|
|
|
|
Friend i want to detect whether certain path or directory exists or not ? For example i like to know that following path is a valid path:
c:\Program Files\BLAH\BLAH
Please tell me how can i achieve the taks of finding out whether the path is correct OR how can i detect whether some directory exists or not ??
BTW, according to MSDN we can check the existance of direcory using CreateFile() with FILE_FLAG_BACKUP_SEMANTICS flag. But it is not supported in Windows 98.
Imtiaz
|
|
|
|
|
|
bool dirExists
(CString strDirectory)
{
TCHAR* fullPath = _tfullpath (NULL, strDirectory, 0);
if (fullPath == NULL)
return (false);
TCHAR szCurrDir [_MAX_PATH];
_tgetcwd (szCurrDir, _MAX_PATH - 1);
long nStatus = _tchdir (fullPath);
_tchdir (szCurrDir);
free (fullPath);
if (nStatus == 0)
return (true);
return (false);
} /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Try [PathFileExists ] api
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi, all
I added an ActiveX controll of the Window Media Player to my MFC program. I can successfully open the About Box of the Media Play by using its member variable: m_Ctrl.AboutBox();
However, I can't load a wave file and playback the file. When it executed: m_Ctrl.play(), an error message box came up without providing any error message.
Does anyone know the steps of controlling Window Media Player? And also the problem I had?
Thanks for your help !
|
|
|
|
|
I want to add code to a program to force it to run on startup based on a checkbox value. Is there a way to do this without hard coding the registry path (HKEY_......CurrentVersion\Run)? I guess I'm looking for a function that either returns that registry path or a function that automatically adds a value to the registry.
|
|
|
|
|
Just hard code the value, it is not going anywhere.
Use a registry function from CRegKey to get the work done, or one of the registry classes from this website.
|
|
|
|
|
Add this function to your program
void CYourDlg::somefunction()
{
CRegKey key;
LONG status=key.Open(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run");
if(status==ERROR_SUCCESS)
{
key.SetValue("c:\\...youprogrampath.exe","ProgramName");
key.Close();
}else //some error message ;
}
m0n0
|
|
|
|
|
Hi,
I have several (6)points(x,y) and having troubles smoothing the curves of these points. I tried using the PolyBezier function without any luck. I would like to provide the points, and the function to draw the smoothed curves that is very similar to what Excel does. Any ideas?
Thanks
|
|
|
|
|
Ok... I think you are going down the right path with PolyBezier. But you have to think a bit about how beziers work. There's an article here[^] on the subject (ignore the code at the bottom - windows implements that for you!). So each point on the polygon has two bezier handles associated with it... one for the next line segment, and on for the previous. Now what I think Excel does is choose the positions of those bezier handles for you automatically. The two points are in a smooth arrangement - so the the polygon point, and the two bezier handles form a straight line. The distance between the handle and polygon point is chosen in proportion to the length of the line segmet it applies to. With me so far?
Additionally the line formed by the polygon point and the two bezier handles is angled in way to be sort of tangential to the polygons. It seems to take an average between the angle of the first and last segments (whether weigthed by length I'm not sure).
so I think you need to do something like this:
void DrawSmoothedPolygon(HDC dc, POINT *pointlist, int pointcount)
{
const float curvyness = 0.1f;
float prevseglength, nextseglength;
long dx, dy;
long leapfrogdx, leapfrogdy;
ASSERT(pointlist != NULL);
ASSERT(pointcount >= 3);
POINT *curvepoints = new POINT[pointcount * 3 + 1];
curvepoints[0] = pointlist[i];
curvepoints[1] = pointlist[i];
curvepoints[pointcount * 3 + 1] = pointlist[pointcount];
curvepoints[pointcount * 3] = pointlist[pointcount];
dx = (curvepoints[1].x - curvepoints[0].x);
dy = (curvepoints[1].y - curvepoints[0].y);
nextseglength = sqrt(dx*dx + dy*dy);
for(int i = 1; i < pointcount - 1; i++)
{
leapfrogdx = (curvepoints[i-1].x - curvepoints[i+1].x);
leapfrogdy = (curvepoints[i-1].y - curvepoints[i+1].y);
preveglength = nextseglength;
dx = (curvepoints[i+1].x - curvepoints[i].x);
dy = (curvepoints[i+1].y - curvepoints[i].y);
nextseglength = sqrt(pointlist[i].x * pointlist[i].x + pointlist[i].y * pointlist[i].y);
curvepoints[i * 3] = pointlist[i];
curvepoints[i * 3 + 1].x = pointlist[i].x + leapfrogdx / (nextseglength / curvyness);
curvepoints[i * 3 + 1].y = pointlist[i].y + leapfrogdy / (nextseglength / curvyness);
curvepoints[i * 3 - 1].x = pointlist[i].x - leapfrogdx / (prevseglength / curvyness);
curvepoints[i * 3 - 1].y = pointlist[i].y - leapfrogdy / (prevseglength / curvyness);
}
PolyBezier(dc, curvepoints, pointcount * 3 + 1);
delete[] curvepoints;
} Now I'm not sure how well this will work. But it may give you some ideas to start with. Also it doesn't deal with closed curves... I'll leave you to figure those out
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^] - now available in MSWord format![^]
|
|
|
|
|
I have a class exported from a DLL which has a member of type _ConnectionPtr. I am importing the ADO library in the DLL as follows:
#import "msado15.dll" no_namespace named_guids rename("EOF", "adoEOF")
The _ConnectionPtr is defined using the _com_ptr_t<..> template in the ADO library, and since the template definition is not exported I get the above warning when compiling.
If I had a member of a simpler template type in the class, for e.g.:
MyTemplate<int> my_member;
..it would just be a matter of exporting the 'instantiated' template definition in the class definition like this:
<br />
class __declspec(dllexport) CParameters<br />
{<br />
public: ....<br />
protected: ....<br />
<br />
template class __declspec(dllexport) MyTemplate<int>;<br />
MyTemplate<int> my_param;<br />
};<br />
However, i am at a loss on how to proceed with the _ConnectionPtr template definition. The warning i get from the compiler is as follows (m_pConn is the member, CParameters is the exported class):
warning C4251: 'm_pConn' : class '_com_ptr_t<class _com_IIID<struct _Connection,&struct __s_GUID _GUID_00000550_0000_0010_8000_00aa006d2ea4> >' needs to have dll-interface to be used b<br />
y clients of class 'CParameters'
Otherwise, the thing compiles ok and the m_pConn is initialised properly as a connection, but i would like to iron out these warnings.
Any ideas?
|
|
|
|