|
You have to improve your search skill.
While searching for "serial port" (keyword) related articles in CodeProject "MFC/C++" category, I got 49 articles.
Maxwell Chen
|
|
|
|
|
He said me that he dosent find any good articles in codeproject about serial port?
|
|
|
|
|
See here.
"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
|
|
|
|
|
in a Dialog OnPaint() message:
//-------------------------------
void TheDlg::OnPaint()
{
CPaintDC dc(this);
//============================
dc.SetPolyFillMode(WINDING);
CPen penRed(PS_SOLID,1,RGB(255,0,0));
CBrush brhRed(RGB(255,0,0));
CPen*pPenOld=dc.SelectObject(&penRed);
dc.BeginPath();
dc.Rectangle(10,10,100,100);
dc.EndPath();
CRgn rgn;
rgn.CreateFromPath(&dc);
dc.FillRgn(&rgn,&brhRed);
dc.SelectObject(pPenOld);
//================================
but I can see Nothing be drawn, what is wrong? how to correct code above to see the Rectangle?
|
|
|
|
|
When you run these code you see a red rectangle,right? now whats problem?
|
|
|
|
|
It works in our tests. Are you sure your dialog client area is not covered by a child window?
|
|
|
|
|
I am using Win98 for developing, may it not wor on the OS?
|
|
|
|
|
Hi All,
I need to know how to use XmlTextWriter and XmlTextReader classes in VC++. I just gone thru an article in CodeGuru (It's here[^]).
I want to know how to use that program snippets in my VC++.net 2005.
How to include the required header files and dlls?
Kindly suggest me to achieve this.
Thanks in advance,
Sarvan AL
|
|
|
|
|
|
|
Hai,
pls help me to find a solution.
Display the dialog Not in a Moving state.it should be fixed.
|
|
|
|
|
Uh ?
What is a Moving state ?
|
|
|
|
|
Wild stab in the dark; the OP wants to prevent the dialog from being moved on screen.
(Why would you want to do this? it's inconsistent with other apps and will irritate users; maybe that's why )
If this is the case, handle WM_NCHITTEST, and return HTBORDER instead of HTCAPTION. In addition, you will want to handle WM_SYSCOMMAND, and ignore SC_MOVE requests.
Ithangyew.
Steve S
Developer for hire
|
|
|
|
|
Steve S wrote: the OP wants to prevent the dialog from being moved on screen
Wow, I didn't understand that at all (I was thinking of something much more complicated ).
|
|
|
|
|
Occam's razor. The best a man can get
Steve S
Developer for hire
|
|
|
|
|
Steve S wrote: Occam's razor.
Err, what's that ?? Never heard about that before
|
|
|
|
|
I think my answer got lost.
It's usually simplified to mean "The simplest explanation is usually the correct one."
see http://en.wikipedia.org/wiki/Occam's_Razor[^] for more. Last modified: Wednesday, August 09, 2006 10:42:58 AM --
|
|
|
|
|
Hai
How to Display the Dialog not in a Moving state? it should be fixed.
Dont Move here and there? how it is possible? pls help me.
|
|
|
|
|
How can I remove spaces from my string ? i don t now how ? how ?The spaces become from the database and when i loaded ... in list ctrl ....?
How can i : FindItem in the second column and the 3- column ...etc.?
Because my string searches only in the first column and GetItemText from second column , 3 column etc . this is my code the code from yesterday is not good for me :
void CMyList::OnOK()
{
UpdateData();
m_list2.RedrawItems(0,m_list2.GetItemCount());
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 )
{
// the item is in the list control
CString sSecondColumnText = m_list2.GetItemText( nItem, 1 );
// set the text to the second edit box
m_rezult.SetWindowText( sSecondColumnText );
}
}
Only this code works !
I remind you :
0 1 2
----------------------------------
| Name | City | Country |
-----------------------------------
-----------------------------------
| George | London | England |
-----------------------------------
|George | NewYork | USA |
-----------------------------------
|George | Madrid | Spain |
-----------------------------------
all i want is to find in my list the country from example from my both edit boxes : m_name (sName) , m_city (sCity) , m_rezult(sRezult)
Please help me with my code ....!!!!(The data are from a database fox pro and have spaces when i loaded )is works only with (LVFI_PARTIAL) and is not so good!
I promise you when i finish my program i will loaded on codeproject !
and will be very usefull for many things !
Thanks for your help ! And i will wait your answer because i dont now how to continue i will try something but ...
Bravoone
|
|
|
|
|
When you read your string then in the loop use from CString::Find for search spaces in your string and use CString::Delete for delete spaces from string
|
|
|
|
|
I think the better place to remove unneeded spaces is the point where you get strings from database and insert them in list control. Use the Trim member of CString to remove leading and trailing spaces. For instance:
CString text = ...
text.Trim();
myListControl.InsertItem(..., text);
If you need to reduce the internal spaces, then also try this:
while(text.Replace(_T(" "), _T(" ") != 0);
See also: http://www.codeproject.com/script/comments/forums.asp?msg=1609094&forumid=1647&mode=all&userid=13134#xx1609094xx[^]
I hope this helps and your problem will be finally solved.
|
|
|
|
|
ok i remouve spaces !... works ! but my same problem remain how to find in the other columns FindItem column 1,2 how ? when i find this ,my problems , i thing ... will be solved !
My code find only in first column (0) and give me the text from others all i wanth is to search in others columns 1,2 ...
???????
Bravoone
|
|
|
|
|
Maybe you should try this:
CString sName, sCity, sCountry;
m_name.GetWindowText(sName);
m_city.GetWindowText(sCity);
sCountry.Empty();
for(int nItem = 0; nItem < m_list2.GetItemCount(); ++nItem)
{
CString const sFirstColumnText = m_list2.GetItemText( nItem, 0 );
CString const sSecondColumnText = m_list2.GetItemText( nItem, 1 );
if( sName == sFirstColumnText && sCity == sSecondColumnText)
{
sCountry = m_list2.GetItemText( nItem, 2 );
break;
}
}
m_result.SetWindowText(sCountry);
I hope this will give you some ideas.
|
|
|
|
|
Thanks but nothing is working i have tried everyting ! my code remaine the same !
Please someone help me !
void CMyList::OnOK()
{
UpdateData();
CWaitCursor wait; // Display a wait cursor
int x = m_list.GetItemCount();
for (int j = 0; j < x; j++) // For each item in the list
{
CString strWord;
strWord = m_list.GetItemText(j, 0); // Get the word
strWord.TrimLeft(); // Remove leading spaces
strWord.TrimRight(); // Remove trailing spaces
// Overwrite the old word with the new trimmed word
m_list.SetItemText(j, 0, strWord);
}
CString sName = _T("Name");
m_name.GetWindowText(sName);
LVFINDINFO stInfo = {0};
stInfo.flags = LVFI_STRING;
stInfo.psz = sName;
int nItem = m_list.FindItem( &stInfo );
if( nItem != -1 )
{
// the item is in the list control
CString sSecondColumnText = m_list.GetItemText( nItem, 1 );
// set the text to the second edit box
m_rezult.SetWindowText( sSecondColumnText );
}
}
----------------------------------
| Name | City | Country |
----------------------------------
| George| London| England |
-----------------------------------
|George |NewYork | USA |
-----------------------------------
for ex :
all i whant is to find if george - London - England exist !
or
all i whant is to find if george - NewYork - USA exist !
m_name , m_city , m_rezult ! m_rezult <----- Country!!!!
Bravoone
|
|
|
|
|
There's nothing wrong with the code you've shown. This works fine:
BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_list.InsertColumn(0, "Name", LVCFMT_LEFT, 100);
m_list.InsertColumn(1, "City", LVCFMT_LEFT, 100);
m_list.InsertColumn(2, "Country", LVCFMT_LEFT, 100);
int nItem = m_list.InsertItem(0, "George");
m_list.SetItemText(nItem, 1, "London");
m_list.SetItemText(nItem, 2, "England");
nItem = m_list.InsertItem(1, "George");
m_list.SetItemText(nItem, 1, "New York");
m_list.SetItemText(nItem, 2, "USA");
return TRUE;
}
void CMyDlg::OnOK()
{
CString strName;
LVFINDINFO stInfo = {0};
m_edit.GetWindowText(strName);
stInfo.flags = LVFI_STRING;
stInfo.psz = strName;
int nItem = m_list.FindItem(&stInfo);
if (nItem != -1 )
AfxMessageBox("Found It!");
} You must have something else wrong.
"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
|
|
|
|