|
Hy all !
Again i have a serious problem with my list control !
This code works , but now i want to do something new and I don t have any ideea how to do it !
If is someoane to help me with my code !
void CMyList::OnOK()
{
UpdateData();
m_list.RedrawItems(0,m_list2.GetItemCount());
CString sRelatia2;
sRelatia = _T("NAME");
m_relatia.GetWindowText(sRelatia);
LVFINDINFO stInfo1 = {0};
stInfo.flags = LVFI_PARTIAL;
stInfo.psz = sRelatia;
int nItem = m_list2.FindItem( &stInfo );
if( nItem != -1 )
{
sSecondColumnText = m_list2.GetItemText( nItem, 1 );
// set the text to the second edit box
m_explicatia.SetWindowText(sSecondColumnText);
}
}
This code find me the item in the second column !
Now i have 2 edit boxes to search in the list control !
And all i want is to find them in list control but :
My list control:
------------------------------------------------
| NAME | City | Country |
________________________________________________
|George |London | England |
|George |NewYork | USA |
------------------------------------------------
I have 3 edit boxes
1) m_name
2)m_City
3)m_rezult
all 3 are CEdit;
first i want to find if in the m_name matches with "NAME" next m_name with "City" and if is find it the "name" and the "City" from both 2 edit boxes i need the country in the m_rezult !
i want to search this :
George (m_name) -> London (m_City) and if exist on the same line :
m_rezult ---> England !!!!!!!!!!!!!!!
and :
George (m_name) -> NewYork (m_City) and if exist on the same line :
i need the rezult :
m_rezult ---> USA !!!!!!!!!!!!!!!
Bravoone
|
|
|
|
|
|
again may list control !
now i have 3 edit boxes ,and 2 i want to search in list control !
this code find 1 item in list control but now i want to find 2 items and 1 result : this is the code :
CString sSecondColumnText;
CString sName = _T("Name");
m_name.GetWindowText(sName);
LVFINDINFO stInfo = {0};
stInfo.flags = LVFI_PARTIAL;
stInfo.psz = sName;
int nItem = m_list2.FindItem( &stInfo );
if( nItem != -1 )
{
sSecondColumnText = m_list2.GetItemText( nItem, 2 );
// set the text to the second edit box
m_explicatia.SetWindowText(sSecondColumnText);
}
now :
0 1 2
---------------------------------------------------
|Name | City | Country |
---------------------------------------------------
|George | London | England |
---------------------------------------------------
|George | NewYork | USA |
--------------------------------------------------
now if in m_name i search for "George" and m_city i search for "London" if is , i need the answer in m_explicatia : "England"
now if in m_name i search for "George" and m_city i search for "NewYork" if is , i need the answer in m_explicatia : "USA"
m_name and m_city i will search in the same time !!!!!!
I don t now how to do it!
Please i need some help !!!!!!!!!!!!
Bravoone
|
|
|
|
|
if you use from a loop for search in lstctrl then in each repeat you can get a new number if it cants find your item
|
|
|
|
|
May be for someone it will be useful function to converting CString to CString with Base64
const char _caMMI[64] = <br />
{ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',<br />
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',<br />
'0','1','2','3','4','5','6','7','8','9','+','/'};<br />
<br />
CString sGetBase64(CString a_sString )<br />
{<br />
CString l_sReturned;<br />
int l_iBlocks = a_sString.GetLength() / 3;<br />
long l_iValue = 0;<br />
for( int l_iBlock = 0 ; l_iBlock < l_iBlocks ; l_iBlock++ )<br />
{<br />
CString l_sTemp = "";<br />
l_iValue = 0;<br />
l_iValue = (char)(a_sString[l_iBlock*3]);<br />
l_iValue<<=8;<br />
l_iValue |= (char)(a_sString[l_iBlock*3+1]);<br />
l_iValue<<=8;<br />
l_iValue |= (char)(a_sString[l_iBlock*3+2]);<br />
<br />
l_sTemp+= _caMMI[l_iValue & 0x3F];<br />
l_iValue>>=6;<br />
l_sTemp+= _caMMI[l_iValue & 0x3F];<br />
l_iValue>>=6;<br />
l_sTemp+= _caMMI[l_iValue & 0x3F];<br />
l_iValue>>=6;<br />
l_sTemp+= _caMMI[l_iValue & 0x3F];<br />
l_iValue>>=6;<br />
l_sTemp.MakeReverse();<br />
l_sReturned += l_sTemp;<br />
}<br />
if( a_sString.GetLength() - l_iBlocks*3 == 2 )<br />
{<br />
CString l_sTemp = "";<br />
l_iValue = 0;<br />
l_iValue = (char)(a_sString[l_iBlocks*3]);<br />
l_iValue<<=8;<br />
l_iValue |= (char)(a_sString[l_iBlocks*3+1]);<br />
l_iValue<<=8;<br />
<br />
<br />
l_sTemp+= '=';<br />
l_iValue>>=6;<br />
l_sTemp+= _caMMI[l_iValue & 0x3F];<br />
l_iValue>>=6;<br />
l_sTemp+= _caMMI[l_iValue & 0x3F];<br />
l_iValue>>=6;<br />
l_sTemp.MakeReverse();<br />
l_sReturned+=l_sTemp;<br />
}<br />
if( a_sString.GetLength() - l_iBlocks*3 == 1 )<br />
{<br />
CString l_sTemp = "";<br />
l_iValue = 0;<br />
l_iValue = (char)(a_sString[l_iBlocks*3]);<br />
l_iValue<<=8;<br />
l_iValue |= (char)(a_sString[l_iBlocks*3+1]);<br />
l_iValue<<=8;<br />
<br />
l_sTemp+= '=';<br />
l_iValue>>=6;<br />
l_sTemp+= '=';<br />
l_iValue>>=6;<br />
l_sTemp+= _caMMI[l_iValue & 0x3F];<br />
l_iValue>>=6;<br />
l_sTemp.MakeReverse();<br />
l_sReturned+=l_sTemp;<br />
}<br />
<br />
return l_sReturned;<br />
}<br />
|
|
|
|
|
If this is supposed to be useful to anyone but yourself, perhaps you could create an article for it, rather than just a post that will go away in a matter of hours. Provide lots of documentation as to what it is and/or isn't supposed to do.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
|
|
Not really a question, but rather signaling a MFC pitfall...
wincore.cpp, approx. line 3152 (Visual C++ 6.0, SP6)
void CWnd::CenterWindow(CWnd* pAlternateOwner)
{
ASSERT(::IsWindow(m_hWnd));
// determine owner window to center against
DWORD dwStyle = GetStyle();
HWND hWndCenter = pAlternateOwner->GetSafeHwnd();
if (pAlternateOwner == NULL)
{
...
Seems to me that pAlternateOwner calls first GetSafeHwnd, then is tested if is NULL...
-- modified at 1:55 Monday 7th August, 2006
|
|
|
|
|
GetSafeHwnd() works fine if pAlternateOwner is null:
HWND CWnd::GetSafeHwnd() const { return this == NULL ? NULL : m_hWnd; } If the this object is NULL , it just returns NULL .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Correct, I didn't checked. Sorry about that.
|
|
|
|
|
Is pAlternateOwner valid?
|
|
|
|
|
Can be NULL or not, but Mike Dunn corrected me. GetSafeHwnd returns NULL if "this" is NULL. A little bit strange to me to have
CWnd *pAlternateOwner = NULL;
HWND hwndAlternate = pAlternateOwner->GetSafeHwnd(); // NULL because pAlternateOwner is NULL
|
|
|
|
|
Cristian Amarie wrote: HWND hWndCenter = pAlternateOwner->GetSafeHwnd();
GetSafeHwnd() is an inline function, so there's nothing to dereference.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello.
In my application I have added a combo box on the toolbar by calling Create()
method.
My requirement is to keep this combo box disabled initially. And after some specific action I want this combo box to be enabled. I can disable it while creating it by passing WS_DISABLE, but the question is how can I enable it after words?
Please reply.
-- modified at 1:46 Monday 7th August, 2006
Rakesh
|
|
|
|
|
m_ComboBox.EnableWindow(0);
|
|
|
|
|
Thanks dude...It worked.
Thanks again.
Rakesh
|
|
|
|
|
Rakesh_Thakur wrote: disable it while creating it by passing WS_DISABLE,
The EnableWindow function enables or disables mouse and keyboard input to the specified window or control.
Are you creating the combo box and have the handle to that window
EnableWindow(hwndCombo,true); will enable the combo box
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi
I should implement functionalities of MS paint ,like I need to identify the regions in a bitmap and then fill the regions with a specified color.
Could any one please provide me with relavant information or links?
The happiest of people don't necessarily have the best of everything; they just make the most of everything that comes along their way.
|
|
|
|
|
Is your purpose?
<br />
include AtlImage.h<br />
HDC hdc=CreateCompatibleDC(GetDC()->m_hDC);<br />
HBITMAP hbit=CreateCompatibleBitmap(GetDC()->m_hDC,100,100); <br />
SelectObject(hdc,hbit);<br />
FillRect(hdc,CRect(0,0,100,100), (HBRUSH)GetStockObject(WHITE_BRUSH) ); <br />
TextOut(hdc,0,0,"test",4); <br />
CImage m_Image; <br />
m_Image.Attach(hbit); <br />
m_Image.Save("D:\\test.bmp"); <br />
DeleteObject(hbit); <br />
DeleteDC(hdc);<br />
|
|
|
|
|
I should implement Hit Testing in a Region.
|
|
|
|
|
So see,a image in 800x600 and a square on thr image
<br />
CImage m_Image;<br />
m_Image.Load("d:\\0.bmp");<br />
m_Image.BitBlt(GetDC()->m_hDC,0,0,800,600,0,0);<br />
<br />
FillRect(GetDC()->m_hDC,CRect(0,0,100,100), (HBRUSH)GetStockObject(BLACK_BRUSH) );
|
|
|
|
|
I am using CxImageLib. I have included all the include file in the directiory tab and copied all the dlls and lib file of that project in to my project. But when i copile and build my project in shows an error...
fatal error C1083: Cannot open include file: 'stdbool.h': No such file or directory
where the #include <stdbool.h> statement is in some library header file.
How to solve this.Please help.
KIRAN PINJARLA
|
|
|
|
|
|