|
You are absolutely correct.
Many thanks.
|
|
|
|
|
Hi everybody !!
I have drawn several lines between several pairs of points. Each line represents the link between an IP address source and one destination. Its width depends on the traffic between these IPs. I want that if I do R-Button (mouse) on them, they show a TIP.
My problem is how to implement that...I know that I have to use the WM_RBUTTONDOWN...The problem is what do I have to put inside it to know if I am selecting one line or another...I have had a similar problem before buit with rectangles...but it was easy because with a FOR I could go through all the structure CRect and using PtInRect I could know if the point given by WM_RBUTTONDOWN was inside or not a rectangle...But with a LINE? How can I know that?
Thanks you very much
|
|
|
|
|
Hi,
You should save the line equation for each line(Y=aX+b) and when you push the right button of the mouse,you need to place the point arguments in each line equation and check which equation is the right one.
regards,
Eli
|
|
|
|
|
Another method to do this is to use the simple formula that a point lies on the line if the sum of its distances from both ends of line is equal to the length of line. i.e., distance of X from A plus distance of X from B is equal to the distance of A from B (where A and B are the endpoints of line and X is the point at which mouse is clicked). This way you can add a small bias in it as well if you wish to coz clicking exactly on line is obviously not what you want.
Hope it helps.
"I would luv to change the world, but they wont give me the source code"
My Articles
|
|
|
|
|
Hi,
I have an application where an icon is created in the systray when the program is executed . On click of the icon the apllication is launched again.
What i want is tht when the program is executed only the systray icon is shown n the dialog box is not launched. only when i click on the icon the dialog box should be launched..
I am calling the functions to show the icon in the initdialog function,
How do i hide the dialog box so tht it doesnt pop up till i clickon the icon in the systray.
Please someone help me out wid this.
thanks
U get wht u Give
|
|
|
|
|
|
You will have to start you application with your dialogbox as hidden. This[^] article's has the tip to do it.
suhredayan There is no spoon.
|
|
|
|
|
I’m about to move from Visual Studio 6.0 to Visual Studio .NET. I’ve heard that it might be problems when I should copy resources (e.g. a dialog) from one project to another. Any known issues?
_____________________________
...and justice for all
APe
|
|
|
|
|
I am trying to update the text display box when a button is pressed.
If the user presses the button "1" once, then "1" appears on the display. If he presses it again, "11" . Max display length is 10.
Apart from the counter(if n=x, print "1" x-times), is there an efficient way to do this?
-hithesh
|
|
|
|
|
Are you making a calculator ?
Maybe a solution is to store the number in an long integer value. So, initialize it with zero. Each time the button is pressed, take the current number, multiply it by 10 and add the current value (so for example, you already have 123 and the user presses 4, that will give you 1230 + 4 = 1234). And then, each time a button is pressed, you print the result (convert the long int into a string and display it). Also, first you will need to check if the number doesn't contain more (or equal) than 9 digits. What you can do is check like that:
if (Number*10>999999999)<br />
return;
Hope this helps
|
|
|
|
|
Hey, thanks for the reply.
Yes, I am building a calculator. how did u know?
The solution you gave is just what i wanted.
But how do I convert long into string and vice cersa?
thanx
-hithesh
-hithesh
|
|
|
|
|
hithesh wrote:
Yes, I am building a calculator. how did u know?
Hum, in fact this was just a guess but what you were asking for is typical used in a calculator
hithesh wrote:
But how do I convert long into string and vice cersa?
Use the ltoa and atol functions
A little tip also: instead of having one handler function for each number button, you can also use the ON_MESSAGE_RANGE macro. This will give you something like (I don't remeber the exact syntax):
OnNumber(int nButtonId)<br />
{<br />
int Value = nButtonId - IDC_BUTTON0;<br />
<br />
}
|
|
|
|
|
how to retrieve char by char from a string and then append using vc++ code..
plz help me anybody????
|
|
|
|
|
For retrieving char by char:
char* szString = "Test":<br />
char c;<br />
for (int i=0;i<strlen(szString);i++)<br />
{<br />
c = szString[i];<br />
....<br />
}
And what do you mean by 'append' ?? Append to what ? To another string ? If yes, first you must be sure that the other string is large enough (to avoid buffer overflow) and then you can use the same mechanism.
|
|
|
|
|
Hello All,
does anyone know how I can run a MFC Executable as a Windows-service?
It is a program that periodically checks for a file, an if found processes it and writes results to another file, so it has no user interface.
Thanks,
Ronald Wilmink.
|
|
|
|
|
Here is a wrapper application to start you app as service. http://www.codeproject.com/system/xyntservice.asp[^]
But if you want your exe to be registered as service by itself, then you will have to look into samples here in codeproject on how to write a service, and then modify your MFC source code accordingly. Believe its not very difficult.
suhredayan There is no spoon.
|
|
|
|
|
|
Hello All,
does anyone know how I can run a MFC Executable as a Windows-service?
It is a program that periodically checks for a file, and if found processes it and writes results to another file, so it has no user interface.
Thanks,
Ronald Wilmink.
|
|
|
|
|
|
rwilmink wrote:
It is a program that periodically checks for a file...
It would be better to let the OS notify you that the file has been created rather than waste CPU cycles checking for it. See ReadDirectoryChangesW() and FindFirstChangeNotification() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello Everyone,
Can someone please tell a way to force an MDI child / MDI Doc Template to be always on top of other children.
Many Thanks
|
|
|
|
|
Hi all,
I want to load the watermark and logo images run-time for my wizard.
I tried to use this code, but it does not seem to work:
HBITMAP hBmp = ::LoadImage(...);
if (hBmp)<br />
{<br />
m_psh.hbmpWatermark = hBmp;<br />
m_psh.dwFlags |= PSH_USEHBMPWATERMARK;
}
Can someone help me with this one?
Geert
http://geert.yoki.org
|
|
|
|
|
I already fixed the problem.
I thought I must use PSH_USEHBMPWATERMARK or PSH_WATERMARK. But if you want to use a HBITMAP watermark, you have to use both.
Geert
http://geert.yoki.org
|
|
|
|
|
can somebody tell me about how to enter only 6 array ( array[6] ) but will display symmetric matrix in array format ??
is something like the following :
deviced a method for storing a symmetric matric with a view to saving a storage space.
thank you
|
|
|
|
|
The way you display your array is up to you, but there's no intrinsic way to make a single dimension array equal a matrix. You need to define the rules to do that.
Christian Graus - Microsoft MVP - C++
|
|
|
|