|
Follow the link below, you will know why there is loss in precision:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_why_floating_point_numbers_may_lose_precision.asp
To solve the problem, there is a free library called MAPM which can help you to calculate precisly:
http://www.tc.umn.edu/~ringx004/mapm-main.html
Hope that it can help.
|
|
|
|
|
The problem solved itself!
I've changed computer (from Celeron 800 MHz to Celeron 2GHz),
and the equation doesn't affects the results!
Anybody knows the reason?
I heard something about bugs in FPU of P300-1000...
Anyway, thank you very much for links, Hing.
They are very useful for me.
|
|
|
|
|
Hi!
I'm looking for a special algorithm, either a one ready-to-use or at least a description of how to begin:
Say I have a image file (.jpg), I want to analyze what color/s has/have the biggest potion - say I have an image with many gray tones, then I want to get the RGB value of this gray color, or an average of the most used gray tones in the picture.
I hope my question was clear enough
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The easiest way is to build a histogram - count how many appearances each color has.
|
|
|
|
|
why dont you add the r, g and b values of every pixel and compare the sum?
Don't try it, just do it!
|
|
|
|
|
There are some small programs of examining bitmaps at www.flounder.com, you'll need to convert them to .bmp first.
If nothing else, they may give you a good start.
Good luck!
INTP
|
|
|
|
|
Thanks, I will try some of your suggestions
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hallo!
I'm a beginner with MFC... can somebody tell me how can I read 3 parameters from a *.txt into a Class.
//actually it would be 3 points of an triangle and I would load the co-ordinates of Points from the file
<br />
typedef int Point[2];<br />
<br />
class Point : public CObject<br />
{<br />
public:<br />
<br />
<br />
Points(){};<br />
<br />
Pont SummPoints[5];<br />
int PointNumm;<br />
bool TriangleTest (Pont a, Pont b, Pont c) <br />
{<br />
double long1 = sqrt((a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]));<br />
double long2 = sqrt((a[0]-c[0])*(a[0]-c[0]) + (a[1]-c[1])*(a[1]-c[1]));<br />
double long3 = sqrt((c[0]-b[0])*(c[0]-b[0]) + (c[1]-b[1])*(c[1]-b[1]));<br />
if (long1>= (long2+long3)) return false;<br />
<br />
}<br />
};
Muad-Dib
mailto:adamo_piar@freemail.hu
Made in Hungary
|
|
|
|
|
do this :
<font style="color:blue;">int</font> i1, i2, i3;
ifstream my_file("c:\\folder\\my_file.txt");
my_file >> i1 >> i2 >> i3;
my_file.close();
according that your file look something like 125 21 31
TOXCCT >>> GEII power
|
|
|
|
|
Hello all,
Yet again another CPropertyPage question
I have these two propertypages which aren't identical but, however, contain some identical controls (that said, same message handlers and code).
So, instead of doubling my code by writing the same code in each CPropertyPage class I thought of two possibilities on how to only need to code it in one place (and hence making it easier to manage both pages):
1. Make an ordinary baseclass which both property pages derive from. Then each property page class has implemented the message handlers and simply call the base class' implementation.
2. Make a baseclass derived from CPropertyPage and implement message handlers for the shared controls. What I'm unsure about here, is if each property page knows how to correctly call the base class message handlers (is that even possible?).
Looking forward to some suggestions
|
|
|
|
|
Halloko wrote:
What I'm unsure about here, is if each property page knows how to correctly call the base class message handlers (is that even possible?).
the right base class will be called, you can put the common code in the base class derived from the CPropertyPage.
The common code should be generic and should not depend on specific propertypage control.
You need to handle the event in the derived class only and call the baseclass method that you have implemented to do the job that you want to do.
I dont know how much this would be applicable to you, but then i tried.
Regards,
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
Mr.Prakash wrote:
You need to handle the event in the derived class only and call the baseclass method that you have implemented to do the job that you want to do.
So, what you're saying here is that I should have a base class which implements the different events but NOT the message handlers since each derived class should include those and then call the appropriate base class?
I was hoping it would suffice just to declare the message handlers in the base class and the framework would automatically route events to the base class without any work in the derived classes.
Did I understand you correctly?
|
|
|
|
|
Halloko wrote:
I was hoping it would suffice just to declare the message handlers in the base class and the framework would automatically route events to the base class without any work in the derived classes.
Technically,what you are trying to do, should work. But you might have one problem... Data Access.
Methods in the baseclass cannot access member variable in the derived class,
Plus for the events to work for the controls in both derived property page,they should have same IDC_XXX value.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
Mr.Prakash wrote:
But you might have one problem... Data Access.
Methods in the baseclass cannot access member variable in the derived class,
This shouldn't be a problem since, as I told you earlier, the controls are shared between both property pages and therefore have the same IDC_ etc.
Therefore the member variables for each control etc. will reside in the base class and not be specific to each page (that's the whole idea anyways )
So, you think this should be possible? Well, how about I have a go at it :p
|
|
|
|
|
Halloko wrote:
So, you think this should be possible? Well, how about I have a go at it
sure, I think you should try it out with one control only and understand all the complexity involved with the solution.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
The hWnd of the instance of my OCX Control is always 0x00000000! So I am unable to PostMessage() withing my control.
Nothing works... Even GetActualParent() as posted in the MSDN...
If anyone has encountered anything similar, or have an idea to get around this, please reply back as I'm stuck over this for more than 24 hours now! confused:
Thanks,
Nirav Doshi
|
|
|
|
|
I assume that you call GetsafeHWnd()in OnCreate(LPCREATESTRUCT lpCreateStruct) function or after it is called and not in Constructor as many times I do
|
|
|
|
|
Hi Pradeep,
Pradeep Maskeri wrote:
I assume that you call GetsafeHWnd()in OnCreate(LPCREATESTRUCT lpCreateStruct) function or after it is called and not in Constructor
Thanks for your reply!
My OCX is a wrapper for a hardware device - And doesn't need to create any window. So, I'm not handling WM_CREATE!
Now, if you make a similar OCX using MFC, and put it in a VB Form... Then try to debug the OCX code by making the VBClient.EXE with your OCX embedded in the VB Form, you can see that the OCX control's HWND is ALWAYS 0x00000000!
But if you insert the control in the ActiveX Test Container or another VC++ (MFC) client app, and then you debug your OCX code, you will see the OCX control's HWND has a legitimate value.
This is the problem, I have! (
- Nirav
|
|
|
|
|
Oh! It is windowless.
So this may help http://www.kbalertz.com/Feedback_153582.aspx
I hope sincerely
|
|
|
|
|
hi,
i am trying to retrieve user account information from the registry. Does any one know about any MFC or some other technique to get the users and their respective information like their account details, privilages etc.
thanks
|
|
|
|
|
No idea abt any MFC . but you can use following functions...
GetUserName()
NetUserGetInfo()
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
hi
i am writing a program in VC++ for reading and displaying any size bmp image in a window using gl library....anybody help me out with full code and i appreciate ur help....
thanks..
|
|
|
|
|
Hi,
In my server application in VC++,i create and execute a particular process .
when this process is running,i want to excute another process as background without
interupting the current process.How do acheive this.If to use CreateProcess()
then how to get it.Pls help
If createprocess needs to be in separate thread ,then how to acheive this.
Pls can anyone get me some sample code snippets for this.
Thnks in advance
Ram
|
|
|
|
|
cberam wrote:
If createprocess needs to be in separate thread ,then how to acheive this.
There is no need for any separate thread to use CreateProcess(); It will return immediately after creating the new process.
check following:
A newbie's elementary guide to spawning processes
[^]
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
Hi,
Thanks for the reply.When the "CreateProcess" is invoked,the current process is interrupted for few seconds.which i don't want to happen.That's why i want to start
in a separate thread or as a background process.Pls do help
Thnks in advance
Ram
|
|
|
|