|
hiho@ll
i'm using OnLButtonUp to get the coordinates of a mouseclick
the problem:
OnLButtonUp from MSDN: Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window
so i thought using GetWindowRect and just adding the values point.x+=rect.left AND point.y+=rect.top will convert the relative coordinates to absolute
the problem is
for example if my window is in the middle of the screen and i click on the top of the screen (the absolute y position should be between 0 or 10)
i get an relative point.y coordinate -22!!!!
which means i clicked 22 pixel above my window? but i clicked a few hundred pixels above my window!
so how can i convert the relative coordinates to absolute?
|
|
|
|
|
I think you need to be using ClientToScreen. For example:
CPoint ptScreen = point;<br />
ClientToScreen (&ptScreen);<br />
Hope that helps, 'bod.
|
|
|
|
|
|
ThinkingPrometheus wrote:
so how can i convert the relative coordinates to absolute?
Use Api ScreenToClient() and ClientToScreen() , for more info consult MSDN.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I already designed a dialog to send message to another PC using IP address.I already write the send site code but I do not know how to test it. Izit using cable to connect or...... can someone help me..
|
|
|
|
|
Hello,
You can create a stub process that listens on the port you send the data to. This stub process verifies a certain byte order to arrive.
On your dialog side, determine which data you want to send. This data will be verified by the stub process.
The two processes can only be on the same machine if you send on a different port than the stub process recieves.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
there's no need to connect another PC to test a dialog between two processes (one client and one server). you can just use the local loop :
127.0.0.1 or \\localhost
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Thank God you posted this. Telling someone to create a stub process to test an ip app. I was going to flip if someone had not posted something as simple as testing on the same pc using the localhost.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I do not know how to use the local loop. How to create a stub process and what is stub?
|
|
|
|
|
your server and you client are supposed to discuss through by IP network, aren't they ?
so, instead of using two distinct computer to be able to test, you use the internal IP address, which is 127.0.0.1 .
this works on every machine because it is defined in the IP Protocol standard. this particuliar Address is also recognized under localhost host name, and that's what's been call the local loop.
so, to test your programs, just put them on the same machine, start the server to listen on the localhost on the port it has to, and then run the client(s) which have to connect to the server on its ip address (locahost again)...
understand better now ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
in trying to use the wave class in a program, i had this error message.
I need help on how to resolve it. Thanks
error LNK2001: unresolved external symbol "public: struct tWAVEFORMATEX __thiscall CWave::GetFormat(void)const " (?GetFormat@CWave@@QBE?AUtWAVEFORMATEX@@XZ)
|
|
|
|
|
You probably need to add a source file to your project that will be compiled along with your code or you have to link to a library (see the linker settings).
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
or just missed the header to include...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
This would have caused a compiler, not linker, error.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hum, yes, you're right... sorry
(5 for you )
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Make sure you are including the appropriate .lib file in your Imports
|
|
|
|
|
there's no nee to say again what's been posted just before you...
read the answers before posting a response.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
when we compile & making exe is has no error. but when executing it gives error assertion failed.
plz will u give code for transfer file using tcp from one pc to another in vc++.
|
|
|
|
|
manishgandhi wrote:
plz will u give code for transfer file using tcp from one pc to another in vc++.
File Transfer [^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
manishgandhi wrote:
...it gives error assertion failed.
This is not a whole lot to go on. Perhaps you could provide the code snippet that caused the assertion to fire.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi All,
I want to perform variant comparison without considering case.
i am using VarCmp() function.
and passing flag NORM_IGNORECASE as last parameter to the function
but still i am getting case-sensitive comparison results.
and if i dont pass that parameter, then error comes up saying function does not take 3 parameters.
plz help in this regard if anyone of u knows.
Thanks in Advance,
Abhi
Abhijeet Jadhav
|
|
|
|
|
|
Hi Jose !
Firstly, Thanks For responding to my query.
Below is the code i am using for variant comparison
_variant_t serverVal, clientVal;
// nSize is computed earlier.
// obj1 and obj2 used below are user-defined objects in our application
// and getValue returns the value for given property as a variant type.
for (int nIndx = nSize-1; nIndx >= 0; nIndx--)
{
// other code
::VariantClear( &clientVal );
::VariantClear(&serverVal);
obj1->getValue(property, &clientVal); // getValue returns variant here
obj2->getValue(property, &serverVal);
if (clientVal.vt == VT_EMPTY && serverVal.vt == VT_EMPTY)
continue;
if(::VarCmp(&clientVal, &serverVal, 0, NORM_IGNORECASE )!= VARCMP_EQ )
{
// Not matched - Processing
}
else
{ // Matched - Processing
}
// other code
}
Please let me know in case there is something wrong.
Abhijeet Jadhav
|
|
|
|
|
abhi_code wrote:
if(::VarCmp(&clientVal, &serverVal, 0, NORM_IGNORECASE )!= VARCMP_EQ )
[...]
Try using LOCALE_SYSTEM_DEFAULT or LOCALE_USER_DEFAULT as the locale identifier:
if (::VarCmp(&clientVal, &serverVal, LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE )!= VARCMP_EQ )
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Okey..thanks a lot for your prompt reply.
i'll try with that.
Abhijeet Jadhav
|
|
|
|