|
Hi all,
I get cursor position through this:
<br />
CRect my_rectangle;<br />
POINT my_point;<br />
<br />
mylistobject.GetSubItemRect( 1, 2, LVIR_LABEL, my_rectangle );<br />
GetCursorPos(&my_point);<br />
if ( my_rectangle.PtInRect(my_point)==TRUE )<br />
}<br />
MessageBox("I got it !!!");<br />
}<br />
I'm not able to get to the MessageBox function because something went wrong... I don't know how to know if a point from GetCursorPos is into a Rectangle.
Thanks in advance.
MaestroProgramador.Com
Researching today for the future.
Investigando hoy, para el futuro.
|
|
|
|
|
From memory GetCursorPos() returns the point in screen coordinates and GetSubItemRect() is in client coordinates, so you need to convert one to the other. See ScreenToClient() and ClientToScreen().
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thank you so much... I didn't notice that point !!!!
MaestroProgramador.Com
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
hi can someone tell me exactly what a shallow copy
does it or is it a refrence
is it good or bad to use
|
|
|
|
|
Say you have a structure that looks like this:
struct
{
int x ;
char* p ;
} ;
If you copy an instance of this structure, the int will copy fine since it is a simple data type but the char* pointer causes problems.
If you just copy the value of p over (a shallow copy), you will have two instances of your structure that have a pointer to the same string. This causes problems when cleaning up - who has responsibility for free'ing the string? You don't want to do it twice.
A deep copy does an intelligent copy - it will make copies of the structure's data members where necessary. In this case, it will allocate a new block of memory and copy the string data over.
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.3 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
bhangie wrote:
what a shallow copy does
The copy is shallow when only the pointer is copied:
void ShallowCopy(int* a)
{
int* b;
b = a;
}
The copy is deep when the value at which the pointer points is copied:
void DeepCopy(int* a)
{
int* b;
*b = *a;
}
bhangie wrote:
is it good or bad to use
Depends on the situation. If a shallow copy is deleted, the original pointer no longer points to the expected data, which of course can be disasterous.
That's one reason to implement copy constructors in C++, to ensure member pointers are copied correctly.
--
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
Hello All,
I am new to this Forum and need some details. I plan to Study C++ , can anyone suggest a good book to get a good working Knowledge of teh Language.
I am Studying in a College, and staying in a Hostel, so my resources are limited, I can access a Computer terminal 24 Hrs, but won't have access to Visual C++, Can anyone suggest the next best alternative, that is free for Download and can help me in my Objective ????
I know that this section might not be the best place to ask this query, But i need advice immediately. I'd be grateful if anyone can pass on any info regarding this. Looking forward to hearing from you all.
Regards,
Ajit
|
|
|
|
|
|
Thanks for the Response. Any idea of the next best alternative to Visual package to execute these programs.
Regards,
Ajit
"Insanity is my Birth Right!!!!"
|
|
|
|
|
|
How to use the source code run in visual c++ after download from this website?
|
|
|
|
|
Double-click the .dsw file and build the application (menu Build ).
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
How to laod a bitmap over a button?Also i want to change the bitmap when I click the button...
Boby
boby
|
|
|
|
|
u can use speen button or bitbtn! look at it's proerties and change..
|
|
|
|
|
You should insert your bitmaps into your resource file and then load them into your code. CButton class has its own functions for loading bitmaps from resources.
MaestroProgramador.Com
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
hi boby
u can use the CIconicButton class or CRolloverButton class for this task.
u can find this class form codeproject site
|
|
|
|
|
Hi All,
I need to detect the mouse/keyboard clicks on one windows application so that I can send the same to another identical application running on another pc and have it do the same stuff.
I am having trouble figuring out how to monitor events on an application externally from another application (meaning I can't modify the code of the application whose events I want to monitor).
Any ideas or advice. Need HELP!! Thanks.
Regards,
Zahid
|
|
|
|
|
Look for "Hooking" or "Hooks".
Hosam Aly Mahmoud
|
|
|
|
|
I am using SQL SERVER 7.0 with OLE DB connection, i can display and add arabic text to the database, but when i try to run sql command to query arabic text i got no results, with out arabiic it is working.
Sinan Swedani
|
|
|
|
|
Can guarantee that 0 or -1 will not to be a threadid in my applicaton in any version of windows??
John
|
|
|
|
|
|
Do you know if a new thread always has bigger id value than a thread created earlier? Thanks.
[Edit]Just verified on my XP, the answer is no.[/Edit]
My articles and software tools
|
|
|
|
|
Since I don't have the NT source handy, I can't say. But if true, that's an internal implementation detail that you should not even consider relying on.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
|
This was what I was thinking but I was not sure about that. I have never noticed an application with a thread id of 0 but if I assume this and I am wrong in the highly unlikely case that the thread had an id of 0 the program would crash.
John
|
|
|
|