|
to check if the mouse is outside a CWnd, have a look at TRACKMOUSEEVENT ( with TME_LEAVE ) and _TrackMouseEvent .
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
hmm.. i'm using mfc, that's some winapi stuff.. i never merged both things, tough i know that mfc is over winapi. How could i manage those messages if i can't see them in classwizard?
|
|
|
|
|
you can use it with MFC with no problem; the _TrackMouseEvent will generate a WM_MOUSELEAVE event/notification
ON_MESSAGE(WM_MOUSELEAVE, OnMouseLeave)
void CView::OnMouseMove( UINT nFlags, CPoint point )
{
if ( ! ( nFlags & MK_LBUTTON ) )
{
if (!m_bTracking)
{
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.hwndTrack = m_hWnd;
tme.dwFlags = TME_LEAVE;
m_bTracking = (_TrackMouseEvent(&tme) == 1 )? true: false;
}
}
}
LRESULT CView::OnMouseLeave(WPARAM wparam, LPARAM lparam)
{
m_bTracking = false;
return 0;
}
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi, your code seems like it's going to work, but i don't quite understand it. I added the message and the OnMouseLeave function. That's ok. What i can't understand is what's inside your OMouseMove function.
what i basically want to do is this:
void CAreaPizarra::OnMouseMove(UINT nFlags, CPoint point)
{
if ((nFlags == MK_LBUTTON) && (mouse is inside))
{
do_one_thing();
}
else
if ((nFlags == MK_LBUTTON) && (mouse is outside))
{
do_another_thing();
}
would you mind explaining me what you did in your function so i can add it in this code?
thanks!
|
|
|
|
|
|
have a look at this[^], it can be very interesting for you...
TOXCCT >>> GEII power
|
|
|
|
|
i've solved it with:
ClientToScreen(&this->m_RectArea);
ClipCursor(this->m_RectArea);
Now, how do i unclip the cursor?
Those lines are in OMouseMove, while the lbutton is clicked.
I want to unclip it in OnLButtonUp
how could i do it?
thanks!
|
|
|
|
|
set a flag (a bool) into your class for example.
otherwise, i don't really understand... sorry...
TOXCCT >>> GEII power
|
|
|
|
|
With ClipCursor(Rect); , the mouse is trapped in that rect.
what should i call if i want the mouse to be free!.. so that i can move it over all the screen of my monitor?
something like ClipCursor(desktop) or something like that?
|
|
|
|
|
ClipCursor(NULL) did the job
thanks for reading the question!
|
|
|
|
|
|
Hi, i'm drawing in a 'CWnd derived' custom control. I want to know which message handles the following event:
When i'm moving the mouse over the control i click the button to insert points over a list. How do i know, when i'm still clicking the left mouse button, that the mouse has 'left' the area. I'm still clicking, but outside the area.
I want to know that, because when you stop clicking the mouse button, a cpoint -1,-1 is sent to the list, so a lineTo isn't drawn to that point.
I get the rect with Getclientrect, but i can't validate with that.
any ideas?
thanks!!
|
|
|
|
|
Hello everyone
I am using CreateCompatibleBitmap to create bitmaps of my list of worksheets. The problem is, when I hit around 20 bitmaps in a loop, the CreateCompatibleBitmap call begins to fail. I have traced into the MFC function calls and I discovered that the memory allocation on the HEAP has reached its limit for creating more resources.
Has anybody ever seen this before??
If not, does anybody have any suggestions??
Thank you for you help
IGeorgeI
George W
Software Developer
www.zsystems.ca
|
|
|
|
|
I've seen it when the bitmaps are very large, or leaked. I would try to structure the code so that I didn't need more than one bitmap at any given time, making sure to properly deselect them from any CDC , if appropriate. And, of course, calling DeleteObject , either directly or by having the dtor of the CBitmap invoked.
|
|
|
|
|
How big are the bitmap sizes?
I used CreateCompatibleBitmap often in code I work with, and have not come across this issue. I very interested in what the bitmap sizes are, that cause the heap to fill up.
thanx
|
|
|
|
|
Hello.
I'm doing a small drawing application, which is multi-client.
I've implemented a pen. When you press the button and keep the mouse pressed you insert CPoints in a list, and i create a string with the points and send it with the socket.
The problem is, that i'm sending many points a second (i send in OnMouseMove) and the other user receives them, but sometimes not in order.
For example i send a,b,c,d,e,f and the user receives a,b,d,c,e,f.
How could i solve that? i tought of a buffer of ten points, so when ten points are written, a string with points is sent, to avoid the order problem.
i am sure somebody has had this problem before (or something similar).. what could i do?
thanks!!!
|
|
|
|
|
I suggest sending the array of points when the user releases the mouse.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
My suggestion would be this:
try to monitor the sent string and when the client reveives something just send it back and check what he has reveived. If it is the correct string pass on to the next if not send the client a string telling him that he should wait for another string.
This might make even more lag but at least you will know you got it right.
gabby
|
|
|
|
|
well, i should have explained the scenario better. It's a jabber client, something like msn messenger. I send the strings to the server, and the server sends the strings to the other client.
that's why i have the order problem. Every point is sent, so there are no errors when i send them.
javi's idea is fine i think.
|
|
|
|
|
Is it possible to capture the "network cable unplugged" event that appears in a balloon tip on the notification area in Windows NT 5+?
I tried by making a thread to monitor the appearance of the balloon, but I cant get it to work.
Is there a better way of doing this??
Bikram Singh
|
|
|
|
|
Rather than bother with a tooltip that may or not may not be available, go directly to the source.
On a WAN (e.g., VPN), you can use SENS, specifically the ISensNetwork interface. If it is a LAN, you'd need to use WSAIoctl(SIO_ADDRESS_LIST_CHANGE) .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks !
I managed to get it working, by using IP Helper functions.
I dont understand COM sinks very well, so I'm avoiding ISensNetwork for now...
Bikram Singh
|
|
|
|
|
Hello Everyone
I am trying to automate a database update (that involves some business logic) using a windows service. The constraints are that
1. I cannot write the service in .NET
Hence I opted to write the service as a C++ executable.
In the service, I have a call using ODBC API (ExecuteSQL method) to a SQL Server Stored procedure just before the call to Sleep method.
The problem is that the call to the stored proc to be executed does NOT work. But the Service installs/uninstalls/starts/stops fine.
If I strip off the code for the service and just run the ODBC part of it, it works fine.
I would like to know if there are issues that need to be taken into account if I make a ODBC call in an NT Service.
I will greatly appreciate any inputs on this.
Thanks
Anand
|
|
|
|
|
By default, a windows service is using the "local system" account, which does not have access to user settings (registry keys, odbc data sources, etc.). It is likely that your odbc data source is a "user" source instead of a "system" source. You need to configure it to "system" data source and you probably have to reboot the machine afterwards.
Good luck.
My articles and software tools
|
|
|
|
|
Hi All,
Need help regarding stored procedure concept using CDatabase & Crecordset database classes. I am working on MFC
application which supports all major RDBMS databases(SQL Server, MySQL, Oracle & MS-Access). I have to process thousands of records from a file and do insert operations.
Right now, this is what I am doing
1. Read one record from a file. Parse it and prepare query.
2. Executing it by using cDatabase's ExecuteSql() function.
But it is taking very long time to process thousand's of records. Every time database has to process the query and prepare an execution plan. That's the reason why I need to solve this problem by using stored procedures which should work with all the databases.
I appreciate if someone could help me in this regard.
Thanks,
Sridhar
|
|
|
|