|
np, just remember it always tests if it is zero.
|
|
|
|
|
When you run a function see return value if its bool A() you can use for example if (A()) and if(!A())
|
|
|
|
|
Can anybody tell me how to find the system font?
I'm trying to find the font currently associated with a window, MSDN states that if WM_GETFONT returns NULL, then the window is using the system font. But it doesn't tell me how to get a handle to it.
|
|
|
|
|
Nm. I got it sorted. Thanks for the help.
|
|
|
|
|
Well, several days ago I posted a message that the MouseMove was not being captured on a CListCtrl whenever the user was selecting more than one item on a CListCtrl derived class. The replies were basically "it works for me", but no matter how much i tested, it didnt.
The CListCtrl is in large icon view, and I need invalidate a control when the user is selecting various items with the mouse (dragging the mouse).
I'm using this, just to test:
void CMyListCtrl::OnMouseMove(UINT nFlags, CPoint point)
{
if (nFlags & MK_LBUTTON)
ASSERT(FALSE);
CListCtrl::OnMouseMove(nFlags, point);
}
As you could probably test, this is not working. Where can I capture this event?
|
|
|
|
|
This is probably a dumb question and I didn't see your previous post but I'll ask anyway
Is there a ON_WM_MOUSEMOVE() entry in your CMyListCtrl class message map?
Do you get a WM_LBUTTONDOWN message for the control? If so, then maybe the list control has it's
own message loop during dragging operations.
|
|
|
|
|
Yes on both. I think, like you, that the list control has it's own message loop.. but then.. how can I capture this event?
|
|
|
|
|
skullfire wrote: but then.. how can I capture this event?
That would be tough if you want the list control to do its processing at the same time you do
yours. I imagine at WM_LBUTTONDOWN the control is pulling messages straight from the queue
(processing WM_MOUSEMOVE messages) until it receives a WM_LBUTTONUP or when WM_MOUSEMOVE
indicates the button is no longer pressed. You could check if you receive a WM_LBUTTONUP after
a drag operation and possibly handle your stuff there but during the drag I don't think so.
|
|
|
|
|
What could also work for me is if I use an event where I can see if a certain item has changed it's state (LVIS_SELECTED, for instance). Is there an event for this? OnItemChangeState or something?
|
|
|
|
|
From the docs - list view controls WM_LBUTTONDOWN:
"...the list-view control enters a modal message loop until either the button is released or the mouse is moved."
skullfire wrote: What could also work for me is if I use an event where I can see if a certain item has changed it's state (LVIS_SELECTED, for instance). Is there an event for this? OnItemChangeState or something?
LVN_ITEMCHANGING and LVN_ITEMCHANGED are sent to the parent window.
|
|
|
|
|
Damn... that reflect message is called whenever the listCtrl wants to draw itself.. this is no use... this should only be called when an actual state change has occured. Here's my code:
<code>
void CSkinListControl::OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
static int lola = 20;
if( pNMLV->iItem > -1 &&
pNMLV->uChanged & LVIF_STATE && pNMLV->uNewState & (LVIS_SELECTED | LVIS_FOCUSED) )
{
lola--;
}
*pResult = 0;
}
-- modified at 17:34 Wednesday 8th November, 2006
|
|
|
|
|
skullfire wrote: Damn... that reflect message is called whenever the listCtrl wants to draw itself
Hmm. How are you calling OnLvnItemchanged()?
Like this?
BOOL CSkinListControlParent::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR *pHdr = (NMHDR *)lParam;
if (wParam == IDC_LISTCTRL)
{
if (pHdr->code == LVN_ITEMCHANGED)
{
OnLvnItemchanged(pHdr, pResult);
return TRUE;
}
}
return CWnd::OnNotify(wParam, lParam, pResult);
}
void CSkinListControlParent::OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR);
static int lola = 20;
if( pNMLV->iItem > -1 &&
pNMLV->uChanged & LVIF_STATE && pNMLV->uNewState & (LVIS_SELECTED | LVIS_FOCUSED) )
{
lola--;
}
*pResult = 0;
}
|
|
|
|
|
CListCtrl does not have it's own message pump. Can you show your message map and handler?
Steve
|
|
|
|
|
Stephen Hewitt wrote: CListCtrl does not have it's own message pump
The underlying common control handles Windows messages though.
|
|
|
|
|
Mark Salsbery wrote: The underlying common control handles Windows messages though.
Yes, but it's your application's message pump which pumps the messages for it. If the control is on a dialog the dialog's message pump will pump the messages.
Steve
|
|
|
|
|
Right The list view control grabs the mouse move messages during a drag though (during its
handling of WM_LBUTTONDOWN). That's the problem the OP is having.
|
|
|
|
|
There's an article here[^] which might be of help.
Steve
|
|
|
|
|
Nope. This doesn't help since it's not actually starting a drag operation on an item, but on a selection rectangle.
|
|
|
|
|
But your issue is handling the mouse move messages not starting the operation isn't it?
Steve
|
|
|
|
|
Hi everyone,
I want to complie a program but I get this error
"fatal error C1083: Cannot open include file: 'atlapp.h': No such file or directory"
then I download WTL7.0 and I set path of wtl on Tools->Options->Projects->VC++ directories in the end of list I insert C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\wtl70\include
but again I get same error.
Can you help me
Thanks
|
|
|
|
|
What is "atlapp.h" and from where does this file come from ? You need to put this file in your project directory or in one of the include directories.
|
|
|
|
|
You didn't say which list you changed in the VC++ Directories page. Make sure you changed the include path.
|
|
|
|
|
Hi Michael
I saw your article about this problem and you have a link for download wtl on your article I didnt changed any thing I insert it line to(on the enviroment VC++ on the menu Tools->Options->Projects->VC++ directories
we have a list of paths I insert this line C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\wtl70\include to it
but I dont know why it doesnt solve
Thanks
|
|
|
|
|
On the VC++ Directories page, you can change one of several lists (include path, lib path, and so on). Make sure you're changing the include path.
|
|
|
|
|
yeah you right I insert to executable I change to include
Thank you Michael
|
|
|
|