|
Hi friends,
I have an application built using VC++ 6.0 .
In these we incorporate serial communication using
rs-232 serial port and also thru USB-Serial adapater
Now ny requirement is to put a small delay only when
the application runs thru USB-Serial not when normal serial
communication is used to run the application.
These delay is have to do since the data transfer
thru USB-Serial is faster as compared to normal serial
Now can u please tell me how to find whether the application
is running thru USB-Serial or Normal Serial port.
|
|
|
|
|
Veeresh Hiremath wrote: Now ny requirement is to put a small delay only when
the application runs thru USB-Serial not when normal serial
communication is used to run the application.
These delay is have to do since the data transfer
thru USB-Serial is faster as compared to normal serial
Why do you need to do such a thing ?
That sounds very strange. Your applications (on both sides) should never be dependent on the time needed to transmit the data on the link (it can be unreliable).
Anyway, with windows, you won't be able to have a precision under 10 or 15 msec as windows is not a real-time operating system.
Maybe if you describe more in detail your problem we can help you to find another solution (please, describe it with keeping in mind that we don't know your app and that we cannot see your screen).
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
i use this to get date from date timepicker :
m_datetime .UpdateData();
char *str=new char[100];
m_datetime.GetWindowText (str,10);
AfxMessageBox(str);
now how can i convert this date into mysql format so that iw will store in mysql table;
plz tel me after this code wat code i write
gourav dogra jfjunf
|
|
|
|
|
Extract the numbers based on tokenizing the string by / . In this way you can get the year, month and day in different strings.
Use CString stt;
stt.Format("%s-%s-%s",strYear,strMonth,strDay);
AfxMessageBox(stt);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
gourav456 wrote: i use this to get date from date timepicker :
m_datetime .UpdateData();
char *str=new char[100];
m_datetime.GetWindowText (str,10);
AfxMessageBox(str);
now how can i convert this date into mysql format so that iw will store in mysql table;
I think you have created Control variable..
Try the following:
1)Create Value variable
2)Suppose variable name is m_DateTime then
CString strDate=m_DateTime.Format("%Y-%m-%d"); 3)strDate is resultant Date.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
gourav456 wrote: now how can i convert this date into mysql format so that iw will store in mysql table;
How many times do you plan on asking this same question? It has been answered no less than three times in as many days.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi ,
I need to show the IDC_HAND cursor if the mouse moves over a particular subitem. I wrote the follwoing code. But the mouse cursor is not changing.
Any alternative please.
void CList::OnMouseMove(UINT nFlags, CPoint Point)
{
//Get the mouse position
const MSG* pMessage;
pMessage = GetCurrentMessage();
ASSERT(pMessage);
CPoint pt;
pt = pMessage->pt; // get the point from the message
// see if the point falls onto a list item
LVHITTESTINFO lvhitTestInfo;
lvhitTestInfo.pt = pt;
int nItem = m_List.SubItemHitTest(&lvhitTestInfo);
int nSubItem = lvhitTestInfo.iSubItem;
if (nItem >= 0 && lvhitTestInfo.iSubItem > 0)
{
int m_nSubItemHit = lvhitTestInfo.iSubItem;
if ( lvhitTestInfo.iSubItem == 8)
{
SetCursor(hCursor);
} }
}
Thanks
Raji
|
|
|
|
|
RajiRaghu wrote: //Get the mouse position
const MSG* pMessage;
pMessage = GetCurrentMessage();
ASSERT(pMessage);
CPoint pt;
pt = pMessage->pt; // get the point from the message
Why r u taking the mouse point in this method when the point is passed to the function....?
Replace ur code with the below one..
void CList::OnMouseMove(UINT nFlags, CPoint Point) <br />
{<br />
<br />
LVHITTESTINFO lvhitTestInfo;<br />
<br />
lvhitTestInfo.pt = Point;<br />
<br />
int nItem = m_List.SubItemHitTest(&lvhitTestInfo);<br />
int nSubItem = lvhitTestInfo.iSubItem;<br />
if (nItem >= 0 && lvhitTestInfo.iSubItem > 0)<br />
{<br />
int m_nSubItemHit = lvhitTestInfo.iSubItem;<br />
if ( lvhitTestInfo.iSubItem == 8)<br />
{<br />
SetCursor(hCursor); <br />
} }<br />
}
nave
|
|
|
|
|
Not working.
The hand cursor is changing on different place. Not in the list control.
Any solutions please
Thanks
Raji
|
|
|
|
|
This is the code that i have used for checking.. This code works correctly..it changes the cursor to IDC_HAND when the mouse is over the subitem number 1.
void MyList::OnMouseMove(UINT nFlags, CPoint point)
{
static HCURSOR hCursor = LoadCursor( 0, IDC_HAND );
LVHITTESTINFO lvhitTestInfo;
lvhitTestInfo.pt = point;
int nItem = SubItemHitTest(&lvhitTestInfo);
int nSubItem = lvhitTestInfo.iSubItem;
if (nItem >= 0 && lvhitTestInfo.iSubItem > 0)
{
int m_nSubItemHit = lvhitTestInfo.iSubItem;
if ( lvhitTestInfo.iSubItem == 1)
{
SetCursor(hCursor);
}
}
CListCtrl::OnMouseMove(nFlags, point);
}
nave
|
|
|
|
|
I think better is to handle the cursor in OnSetCursor... What do you think?
- NS -
|
|
|
|
|
Consider a solution in which you handle the WM_SETCURSOR notification. Within the OnSetCursor handler, obtain the mouse coordinates with GetCursorPos , make a test and call SetCursor to set your cursor, then return TRUE . Otherwise, call the parent OnSetCursor handler and return its value.
Hope it will work.
|
|
|
|
|
You forgot to convert the points (pMessage->pt) to client coordinates, because they are in screen coordinates.
- NS -
|
|
|
|
|
hello everyone:
In a window service, I want to create a dummy window for receiving some messages from other exe. Is it possible?
Thanks.
-Freehawk
|
|
|
|
|
|
How do i capture the key event in a split window. I have a MFC SDI window which contain two splited window. One derived derived from CFormView to create a control planel, other renders a opengl scene. i am not able to capture key events (up and down) from my Mainframe. Please help
Sandip
|
|
|
|
|
Capture it in your CFormView's WM_KEYDOWN and WM_KEYUP.
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|
|
I mean if u enter some data after clicking enter then it should perform some action say displaying messageBox
anyone please help me to get of the problem
-- modified at 7:28 Wednesday 7th June, 2006
|
|
|
|
|
can u be more specific
nave
|
|
|
|
|
sree_as wrote: in edit box i want to activates the directions key in my keyboard.
See the Following properties of EDIT CONTROL
Multiline
AutoHScroll
AutoVScroll
Want return
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
I mean if u enter some data after clicking enter then it should perform some action say displaying messageBox.
SO i need keystrokes
|
|
|
|
|
Derive a class from CEdit and make the object of this class as member variable of the edit control.
Overide the WM_KEYDOWN message in the new class and then u can trap the enter key fro that funtion...
nave
|
|
|
|
|
Thank u naveen.
please give me rough coding.actually my domain is java but unfortunately i czme to Vc++ one month so please give me
rough code,
|
|
|
|
|
here i have derived a class from the CEdit say EditCtrlEx . Then using the class wizard i mapped the WM_KEYDOWN message( this will create a stub function with name void EditCtrlEx::OnKeyDown( UINT uChar_i, UINT uRepCnt_i, UINT uFlags_i )
inside this write
void EditCtrlEx::OnKeyDown( UINT uChar_i, UINT uRepCnt_i, UINT uFlags_i )
{
CEdit::OnKeyDown( uChar_i, uRepCnt_i, uFlags_i );
if( VK_RETURN == uChar_i )
{
AfxMessageBox( _T("Enter clicked ));
}
}
Remeber to give the Want-Return style to the edit ctrl
nave
|
|
|
|
|
thank u very much.
i done it but the editbox but not responding when we click enter.
anyway thanks for ur code
|
|
|
|