|
BianChengNan wrote: does anyone knows why? There is probably a bug in your code. You need to provide a snippet of the code and full details of the exception if you want a better suggestion.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
thanks for your tip. code looks like following.
bool isRangeShape(__in CRange& oRange)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CShapeRange oShpRange = oRange.get_ShapeRange();
long lCount = oShpRange.get_Count();
if (lCount > 0)
{
return true;
}
return false;
}
modified 8-Aug-12 21:37pm.
|
|
|
|
|
I don't know why it works fun again. (but I think it should work fun!)
thanks for your help!
|
|
|
|
|
How to Decrypt file in C# that Encrypted in C using same Rijndael Algorithm?
|
|
|
|
|
Using the Rijndael algorithm implemented in C# (Microsoft gently provides it: "Rijndael Class"), of course.
Veni, vidi, vici.
|
|
|
|
|
Hi, dear all,
I have a license check exe file with only one argument.
CString exe = getCurrentProjectPath(); //e.g, C:\Temp
CString pwd = "12345"
CString exeString = exe + " \"" + pwd + "\"";
system(exeString);
everything works fines with above codes.
But if I put double quota between exe, I get "filename, .... syntext is incorrect".
CString exeString = "\"" + exe + "\" \"" + pwd + "\"";
But if I don't put exe data in a quota, if the path has space, it also cannot work.
How should I solve this issue? Thanks!
|
|
|
|
|
CString exeString = (CString)"\"" + exe + (CString)"\" \"" + pwd + (CString)"\"";
EDIT:
Added space between quotes.
The difficult we do right away...
...the impossible takes slightly longer.
modified 7-Aug-12 17:24pm.
|
|
|
|
|
Richard, thanks for your reply.
I try using double quota around all the arguments, not work.
If you have multiple arguments that all are in double quota, you need to use "call".
The following line works fine.
CString exeString = "call \"" + exe + "\" \"" + pwd + "\"".
|
|
|
|
|
You might find it better to use one of the exec() [^] functions.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
|
Then you should change the subject on your question and put a SOLVED at the end or at the beginning.
And it would be nice that you would put the answer/solution there too.
|
|
|
|
|
Hi,
I have one dialog box. I have picture control on that dialog. I'll draw two masks on the canvas using OnMouseMove functionality. one mask is completed, another one is incomplete mask (only a line drawn using pen). When I remove/delete the completed mask, incomplete doesn't get deleted but its not visible. How to show the line after removing the completed mask in MFC.
Anybody have any idea regarding this.?
Thanx in advance.
Regards,
|
|
|
|
|
mbatra31 wrote: How to show the line after removing the completed mask in MFC.
draw the line again?
|
|
|
|
|
Do you draw the stuff from a WM_PAINT handler? Because you should do so!
|
|
|
|
|
Hello everybody,
i am having n-number of points like p1(x,y), p2(x,y), p3(x,y), .... pn(x,y). All points lie on a single line.(either a curve or a straight line). i would like to find, using those points, whether that line is straight or not straight.
i googled and tried some of the methods given in examples, (straight line equation, finding if collinear) but those are not working fine even for straight line also.
i am using visual studio 2008 with win32 (not MFC).
Any ideas ?
Thanks in advance,
A. Gopinath.
|
|
|
|
|
The problem is one of mathematics not programming; once you find the mathematical solution, converting it to C/C++ is the easy part.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hello Richard,
Yes, i know its a mathematics question, i tried here so that someone can help me.
Thanks for the reply.
Regards,
A. Gopinath.
|
|
|
|
|
One way would be by using slope. Find the slope of the line corresponding to the first two points (y-coord of p2 - y-coord of p1) / (x-coord of p2 - x-coord of p1).
Find the slopes of the lines corresponding to all other points (with respect to the first point), say (y-coord of pk - y-coord of p1) / (x-coord of pk - x-coord of p1), where k varies from 3 to n.
All of these slopes should be within a reasonable tolerance band. And, since all of these lines pass through p1, they all would lie on the same straight line if they fell within the tolerance band.
The above would not work if the x-coordinates of p2 and p1 are the same (because denominator would be zero). In that case, you choose a point whose x-coordinate is unique as the reference point.
Not sure whether this is the most efficient way, but it certainly a way of achieving what you want.
|
|
|
|
|
Hello Amarnath,
yes, i tried this method also, but iam getting like 0.000002 or something like difference which fails the condition checking. rounding off will solve the solution ? is that right method?
Regards,
A. Gopinath.
|
|
|
|
|
You mean, that your slope value is 0.000002? This means that your line is almost horizontal. Your tolerance values would have to be at least 1/1000 or 1/10000 of your "average" slope value. Then, it would indicate that these points are on a straight line. (You need to use a "double" type to store these numbers, and a "float" may not suffice).
By the way, what is the purpose of this exercise? That purpose would in some sense determine the method of straight-line detection.
|
|
|
|
|
Hello,
i will try using "double" type. actually this is related 3D project, need to find straight line or not.
Thanks again,
A. Gopinath.
|
|
|
|
|
- Take the first and last points to build the 3D law of their straightness
- Define the fluctuation radius as "allowed error"
- All other points must lie in the "pipe" =>
=> any point projection onto the law(1) may not be greather as the radius(2)
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
One more way would be by using the cross product. Take two points, say p1 and p2 as reference. Consider the vector p1-p2. Now, take a point pk, and hence that vector p1-pk. Find the cross product of these two vectors (p1-p2 and p1-pk). That cross product should be near zero (all three components of the cross product) if the points are collinear. Repeat this for all points pk (k belonging to the set 3 to n).
modified 7-Aug-12 8:10am.
|
|
|
|
|
|
Thanks Albert,
hereafter i will use this page to ask questions related.
Regards,
A. Gopinath.
|
|
|
|