|
You can look at ptAction in NMITEMACTIVATE .
|
|
|
|
|
thanks now i using this and it works.
please check its correct way to do this or not
LPNMITEMACTIVATE pia = (LPNMITEMACTIVATE)pNMHDR;
CPoint point(pia->ptAction);
UINT uFlags;
int nItem = m_List.HitTest(point, &uFlags);
if (uFlags!=8)
{
AfxMessageBox("Double Click");
}
|
|
|
|
|
Why not just use the item and subitem fields to discover whether it's the checkbox column as Hans explained in his initial answer?
I must get a clever new signature for 2011.
|
|
|
|
|
For that, is there any separate column for check boxes in list control with LVS_EX_CHECKBOXES style? Please correct me if i am wrong.
|
|
|
|
|
I'm not sure, I (foolishly) assumed the checkbox could be added to any column. My bad
I must get a clever new signature for 2011.
|
|
|
|
|
Its ok. No separate column for check box, assuming that the questioner is using List control with LVS_EX_CHECKBOXES style.
|
|
|
|
|
Thanks, obviously a feature I need to check out at the earliest opportunity.
I must get a clever new signature for 2011.
|
|
|
|
|
Use CListCtrl::GetItemRect and ptAction member of LPNMITEMACTIVATE structure.
void MyDlg::OnDblClick(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMITEMACTIVATE pNMIA = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
int nItem = -1;
int nSubItem = -1;
if (pNMIA)
{
nItem = pNMIA->iItem;
nSubItem = pNMIA->iSubItem;
}
if (nItem >= 0 && nSubItem >= 0)
{
CRect rect;
m_list.GetItemRect(nItem, &rect, LVIR_LABEL );
if(pNMIA->ptAction.x < rect.left)
{
MessageBox("Double Clicked on CheckBox");
}
}
*pResult = 0;
}
Another alternative is CListCtrl::HitTest() function.
modified on Monday, February 28, 2011 6:56 AM
|
|
|
|
|
|
Hi everyone ! Can you give an help hand , please ? I need an source code of GetComboBoxInfo function from here[^]
Why ? Because I use that function in a project that I need compile on Windows NT SP6 , and there I don't have this function ... thank you very much .
|
|
|
|
|
Unless someone else has something to say, you're out of luck.
Interactions like this with controls are all done through messages, like SetWindowText() is an alias for PostMessage(WM_SETTEXT) , and it appears that GetComboBoxInfo() is an alias for CB_GETCOMBOBOXINFO[^], which as that MSDN page says is only implemented on Windows XP and later.
If this query message is not supported by the control on your platform then you are going to have a hard time getting the internal state.
Not sure if it will work, and if it will it is probably not a good idea, but you might be able to update the common control library from something like Windows XP, which should have all features of NT, plus more by copying and pasting.
|
|
|
|
|
Then perhaps you give me an alternative for this issue :
I need to have ComboBoxInfo.hwndList handle for the follow function :
void CComboBoxExt::PreSubclassWindow()
{
CComboBox::PreSubclassWindow();
COMBOBOXINFO ComboBoxInfo;
ComboBoxInfo.cbSize = sizeof(ComboBoxInfo);
GetComboBoxInfo(m_hWnd,&ComboBoxInfo);
m_List.SubclassWindow(ComboBoxInfo.hwndList);
SetProp(ComboBoxInfo.hwndList, WndPropertyComboBoxEx, this);
fNextListProc = (WNDPROC)SetWindowLong(ComboBoxInfo.hwndList, GWL_WNDPROC, (LONG)WinProcForList);
}
and implementation of WinProcForList is here :
LRESULT CComboBoxExt::WinProcForList(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
CComboBoxExt* pInstance = (CComboBoxExt*)GetProp(hWnd,WndPropertyComboBoxEx);
ASSERT(pInstance != NULL);
if(msg == LB_FINDSTRING)
{
TRACE("Replacing LB_FINDSTRING with LB_FINDSTRINGEXACT when looking for: \"%s\"\n", (LPCTSTR)lParam);
msg = LB_FINDSTRINGEXACT;
}
return CallWindowProc(pInstance->fNextListProc, hWnd, msg, wParam, lParam);
}
any help or hint I will very appreciated !
|
|
|
|
|
In fact , I try to deturn LB_FINDSTRING from dropdown list into LB_FINDSTRINGEXACT , and there must be an solution that function for Windows NT ...
|
|
|
|
|
i have two root object,each object contains many members but i take up only one string member(m_strTitle) as reference to merge two object and it also contains one vector (holds pointer of object ) to hold all children of object ..... any best algorithm other than linear comparison ?
example:
two objects are
m_objSource ( pointer of classObj )
m_objGuest (pointer of classObj )
structure of classObj is
{
CString m_strTitle;
...............
.............
vector <classobj*> m_vectChildFolder;
}
modified on Monday, February 28, 2011 2:13 AM
|
|
|
|
|
Hi guys... I want to show a shadow bitmap as a transparent in my application..
I have used alphablend() to do that.
m_blendfunc.BlendOp = AC_SRC_OVER;
m_blendfunc.BlendFlags = 0;
m_blendfunc.SourceConstantAlpha = 0;
m_blendfunc.AlphaFormat = AC_SRC_ALPHA;
I have changed the alpha transparency value as per intensity vaue. ( its a scrollbar value in my
application from which shadow will intense accordinagaly )
m_blendfunc.SourceConstantAlpha = int( m_intensity * 2.55 );
In OnPaint I have written..
AlphaBlend( hmemdc, prc->left - m_shadowPosX + Border, prc->top + m_shadowPosY + Border,
prc->right - prc->left + borderRatio, prc->bottom - prc->top + borderRatio,
hSrcDc, 0, 0, bmp.bmWidth, bmp.bmHeight, m_blendfunc );
In ReplaceColor() I have supplied shadow bitmp handle.. here _coldcolor and _cNewColor are used to
calculate a new color based on the current color( but I don't want that )..
void CPipWnd::ReplaceColor( HBITMAP &_hBmp, COLORREF _cOldColor, COLORREF _cNewColor,
bool _selectRange )
{
if ( _hBmp )
{
HDC hbufferDC = CreateCompatibleDC( NULL );
if ( hbufferDC )
{
HGDIOBJ hpreviousBufferObject = SelectObject( hbufferDC, _hBmp );
HDC hdirectDC = CreateCompatibleDC( NULL );
if( hdirectDC )
{
BITMAP bm;
GetObject( _hBmp, sizeof( bm ), &bm );
BITMAPINFO RGB32BitsBITMAPINFO;
ZeroMemory( &RGB32BitsBITMAPINFO, sizeof( BITMAPINFO ) );
RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
RGB32BitsBITMAPINFO.bmiHeader.biWidth = bm.bmWidth;
RGB32BitsBITMAPINFO.bmiHeader.biHeight = bm.bmHeight;
RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
UINT * ptPixels;
HBITMAP hdirectBitmap = CreateDIBSection( hdirectDC, ( BITMAPINFO* )&RGB32BitsBITMAPINFO,
DIB_RGB_COLORS, ( void** )&ptPixels, NULL, 0 );
if ( hdirectBitmap )
{
HGDIOBJ hpreviousObject = SelectObject( hdirectDC, hdirectBitmap );
BitBlt( hdirectDC, 0, 0, bm.bmWidth, bm.bmHeight, hbufferDC, 0, 0, SRCCOPY );
_cOldColor = COLORREF2RGB( _cOldColor );
_cNewColor = COLORREF2RGB( _cNewColor );
for ( int i = ( ( bm.bmWidth * bm.bmHeight ) - 1 ); i >= 0; --i )
{
if( _selectRange )
{
{
COLORREF clrRef = COLORREF( ptPixels[i] );
clrRef = COLORREF2RGB( clrRef );
BYTE r = GetRValue( _cNewColor );
BYTE g = GetGValue( _cNewColor );
BYTE b = GetBValue( _cNewColor );
BYTE *ptr = reinterpret_cast<BYTE*>( &clrRef );
ptr[0] = *ptr;
ptr[1] = r;
ptr[2] = g;
ptr[3] = b;
ptPixels[i] = clrRef;
}
}
else
{
if ( ptPixels[i] <= _cOldColor )
ptPixels[i] = _cNewColor;
}
}
SelectObject( hdirectDC, hpreviousObject );
if( _hBmp )
{
DeleteObject( _hBmp );
_hBmp = NULL;
}
_hBmp = hdirectBitmap;
}
DeleteDC( hdirectDC );
}
SelectObject( hbufferDC, hpreviousBufferObject );
DeleteDC( hbufferDC );
}
}
}
My shadow bitmap (.bmp) is 24 bpp as well.I have to take alpha value of that bitmap pixels and have to
add this value in the alpha channel of the new color..
But In line
COLORREF clrRef = COLORREF( ptPixels[i] );
I am getting 0 value. Is there any mistake in the code..
Pls help me so that I can take correct alpha value of every pixels of bitmap image .
modified on Monday, February 28, 2011 4:34 AM
|
|
|
|
|
Your question is very difficult to read. Please use the edit button and put your code snippets between <pre></pre> tags so it is formatted and readable.
I must get a clever new signature for 2011.
|
|
|
|
|
hello friends, i am pursuing my degree and i am in my final semester.
I need to know how every file is stored on a disk i.e. if a application want to access any file i.e. any video,audio,document file, is there a common way, how every file stored on the disk.
|
|
|
|
|
Sure, we'll be glad to help.
Tell us what you've found so far, and we'll go from there.
|
|
|
|
|
gateway23 wrote: is there a common way, how every file stored on the disk.
Yes, every file is merely a stream of bytes (or bits) and can be accessed in exactly the same way. The difficulty is knowing how to interpret each byte to make sense of the information. However, I doubt if that knowledge is of any use to you; perhaps it would be better if you explained exactly what problem you are trying to solve.
I must get a clever new signature for 2011.
|
|
|
|
|
This is a vague question and I get the impression that if I knew exactly what you're asking:
- I probably wouldn't know the answer.
- An explanation would take more space than available here.
Steve
|
|
|
|
|
Greets,
How can I tell programatically, Is gdi+ already started? Is there a function for this?
Thanks...vmars316
|
|
|
|
|
You could try calling one of the GDI+ functions and checking if it returns GdiplusNotInitialize .
|
|
|
|
|
I have a CButton derived class. I would like this class to handle the click event itself. What should I put in my message map for the button class? ON_BN_CLICKED doesn't work.
|
|
|
|
|
ON_BN_CLICKED just wraps a WM_COMMAND message. You probably want to catch WM_LBUTTONUP messages.
|
|
|
|
|
goorley wrote: I would like this class to handle the click event itself.
use ON_CONTROL_REFLECT() message map.
BEGIN_MESSAGE_MAP(CMyBtn, CButton)
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
END_MESSAGE_MAP()
void CMyBtn::OnClicked()
{
}
TN062: Message Reflection for Windows Controls
|
|
|
|
|