|
Hello together!
I run a hexapod / stewart platform, which receives its position data from a computer that acts as a server. I have put up a direct LAN connection (100Mbit/s) between this host and the computer on which we will run all the simulation software for our project. I want to transmitt the new position data (36 bytes)every 5 or better every 2 ms. Therefor I planed to use UDP and I used some code I found here. By now the packets I sent only arrive seperately if I transmitt the packets with 100Hz. A higher pulse seems not possible. I already changed the MTU to 70....
If you please have any hint...
Thanks a lot and kind regards.
Oli
|
|
|
|
|
kletteroli wrote: By now the packets I sent only arrive seperately if I transmitt the packets with 100Hz.
Huh? And if you send them faster they arrive how? Why change the MTU? You should easily be able
to send this data using UDP (even TCP).
Something's up in your communication code.
|
|
|
|
|
I want to add items between two dates.I used CTime class to find the two dates(current and past). i want to add the list of url's i opened that range of time.Everything is fine but how can we make the condition on times for ex: for or while or if etc
|
|
|
|
|
CTime has normal add and compare operators, so you can loop on a CTime the same way you would do with an integer.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
CTime CurTime = CTime::GetCurrentTime();
CString sTime1,sHour,sTime2;
sTime1.Format("%d/%d/%d",CurTime.GetYear(),CurTime.GetMonth(),CurTime.GetDay());
sTime2.Format"%d/%d/%d", .......);
m_time1.SetWindowText(sTime1);
m_time2.SetWindowText(sTime2);
if(sTime1 > sTime2)
{
//Do something
//lets say m_time3.SetWindowText("Real time");
}
UpdateData(FALSE);
Bravoone
|
|
|
|
|
I have converted file time to system time using the function,
FileTimeToSystemTime(&suURL.ftLastVisited,&st);
Now can i get the time in CTime from the above line.I am able to display the string value for that particular systemtime.otherwise how can we convert CString to CTime.
Thanks
|
|
|
|
|
radhika28 wrote: otherwise how can we convert CString to CTime.
If the time is in a standard format, use COleDateTime::ParseDateTime() . The CTime class is too limiting.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is there a VC++ equivalent to the Visual Basic "CStr" keyword?
dharani
|
|
|
|
|
You may use CString::Format for this purpose.
|
|
|
|
|
For s = 1 To 10
rec(s) = " #" & CStr(rs2(0)) & CStr(rs2(1))
msg4 = msg4 & rec(s)
rs2.MoveNext
Next s
how can i convert this in VC++?
dharani
|
|
|
|
|
For s = 1 To 10
rec(s) = " #" & CStr(rs2(0)) & CStr(rs2(1))
msg4 = msg4 & rec(s)
rs2.MoveNext
Next s
where rs is a recordset which has only two columns..
dharani
|
|
|
|
|
dharani_3d wrote: rec(s) = " #" & CStr(rs2(0)) & CStr(rs2(1))
What does, rs2(0),rs2(2) would return ?
Say its returning int.
In that case,
you use.
CString sTemp;
sTemp.Format(_T("%d%d"),rs2(0),rs2(1));
|
|
|
|
|
There's not a direct replacement for it because CStr() returns a different value depending on the type of value sent to it. For example, it might return True/False if the value is Boolean , or a short date if the value is a Date .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello everybody,
Is there any possiblity to declare a variable as a Variant and a Variant array?
for example in VB, we can declare
Dim rec(80) As Variant //array
Dim msg As Variant
Is there any possibility to declare like this Visual C++?
Likewise in VB,
'msg' which holds some variant value and I can display it in text box.
Text1.Text = msg3
How can I display the variant value in edit box?
Please reply me.. thanks in advance.
Dharani
|
|
|
|
|
dharani_3d wrote: Is there any possiblity to declare a variable as a Variant and a Variant array?
SAFEARRAY and VARIANT are its replacement in VC++.
dharani_3d wrote: Dim rec(80) As Variant //array
Dim msg As Variant
Is there any possibility to declare like this Visual C++?
Likewise in VB,
'msg' which holds some variant value and I can display it in text box.
Text1.Text = msg3
How can I display the variant value in edit box?
I'm not sure, but in VB variants are used for representing array.
So, its char array in terms of C++.
So you can use char array or CStringArray as its VC eqvivalent.
|
|
|
|
|
Dear All
I have to monitor a printer, and for that I have to use FindFirstPrinterChangeNotification and FindNextPrinterChangeNotification APIs. For this I have written the code, which is below. Some problems that i am facing with this code are also stated below (after the code). It will be great you can shed some light on the issues I am facing. It will be of great help.
void StartNotifications(void)
{
HANDLE hPrinter = NULL;
PRINTER_NOTIFY_OPTIONS * p_NotifyOptions = NULL;
PRINTER_NOTIFY_OPTIONS_TYPE arr_NotifyOptionsType[2];
PWORD pPrinterFields;
WORD arrJobFields[100];
HANDLE hwndNotify = NULL;
DWORD dwChanged = 0;
int i;
FILE * pFile;
TCHAR * pBuf;
DWORD * adwData;
TCHAR arrBuf[50];
pFile = _tfopen(_T("C:\\PrinterNotifications.txt"), _T("a+"));
if(pFile)
{
MessageBox(NULL, _T("Opened"), _T("File Status"), MB_OK);
}
PRINTER_NOTIFY_INFO * p_OutPut = NULL;
if(OpenPrinter(_T("\\\\NECHCLSTDC\\HP LaserJet 4345 mfp PCL 5e"),
&hPrinter, NULL))
{
i=0;
arrJobFields[i++] = JOB_NOTIFY_FIELD_PRINTER_NAME;
arrJobFields[i++] = JOB_NOTIFY_FIELD_MACHINE_NAME;
arrJobFields[i++] = JOB_NOTIFY_FIELD_PORT_NAME;
arrJobFields[i++] = JOB_NOTIFY_FIELD_USER_NAME;
arrJobFields[i++] = JOB_NOTIFY_FIELD_NOTIFY_NAME;
arrJobFields[i++] = JOB_NOTIFY_FIELD_DATATYPE;
arrJobFields[i++] = JOB_NOTIFY_FIELD_PRINT_PROCESSOR;
arrJobFields[i++] = JOB_NOTIFY_FIELD_PARAMETERS;
arrJobFields[i++] = JOB_NOTIFY_FIELD_DRIVER_NAME;
arrJobFields[i++] = JOB_NOTIFY_FIELD_STATUS_STRING;
arrJobFields[i++] = JOB_NOTIFY_FIELD_DOCUMENT;
arrJobFields[i++] = JOB_NOTIFY_FIELD_PRIORITY;
arrJobFields[i++] = JOB_NOTIFY_FIELD_POSITION;
arrJobFields[i++] = JOB_NOTIFY_FIELD_START_TIME;
arrJobFields[i++] = JOB_NOTIFY_FIELD_UNTIL_TIME;
arrJobFields[i++] = JOB_NOTIFY_FIELD_TIME;
arrJobFields[i++] = JOB_NOTIFY_FIELD_TOTAL_PAGES;
arrJobFields[i++] = JOB_NOTIFY_FIELD_PAGES_PRINTED;
arrJobFields[i++] = JOB_NOTIFY_FIELD_TOTAL_BYTES;
arrJobFields[i++] = JOB_NOTIFY_FIELD_BYTES_PRINTED;
arr_NotifyOptionsType[0].Type = JOB_NOTIFY_TYPE ;
arr_NotifyOptionsType[0].pFields = arrJobFields;
arr_NotifyOptionsType[0].Count = 20;
pPrinterFields = (PWORD)malloc(2 * sizeof(WORD));
pPrinterFields[0] = PRINTER_NOTIFY_FIELD_PRINTER_NAME;
pPrinterFields[1] = PRINTER_NOTIFY_FIELD_AVERAGE_PPM;
arr_NotifyOptionsType[1].Type = PRINTER_NOTIFY_TYPE ;
arr_NotifyOptionsType[1].pFields = pPrinterFields;
arr_NotifyOptionsType[1].Count = 2;
p_NotifyOptions = new PRINTER_NOTIFY_OPTIONS;
p_NotifyOptions->Count = 2;
p_NotifyOptions->Version = 2;
p_NotifyOptions->pTypes = arr_NotifyOptionsType;
p_NotifyOptions->Flags = PRINTER_NOTIFY_OPTIONS_REFRESH;
if((hwndNotify = FindFirstPrinterChangeNotification(hPrinter,
PRINTER_CHANGE_ALL, 0, p_NotifyOptions)) != INVALID_HANDLE_VALUE)
{
while(hwndNotify != INVALID_HANDLE_VALUE)
{
if(WaitForSingleObject(hwndNotify, INFINITE) == WAIT_OBJECT_0)
{
FindNextPrinterChangeNotification(hwndNotify, &dwChanged,
(LPVOID)p_NotifyOptions, (LPVOID*)&p_OutPut);
for (int i=0;(i<p_output->Count) && ;i++)
{
pBuf = (TCHAR*)(p_OutPut->aData[i].NotifyData.Data.pBuf);
adwData = p_OutPut->aData[i].NotifyData.adwData;
switch(p_OutPut->aData[i].Type)
{
case JOB_NOTIFY_TYPE:
{
//printf("\tジョブ通知(no.%d, id:%d)...", i,
p_OutPut->aData[i].Id);
switch(p_OutPut->aData[i].Field)
{
case JOB_NOTIFY_FIELD_PRINTER_NAME:
_fputts(_T("Printer Name "), pFile);
_fputts(pBuf, pFile);
_fputtc(_T('\n'), pFile);
break;
case JOB_NOTIFY_FIELD_MACHINE_NAME:
_fputts(_T("machine Name "), pFile);
_fputts(pBuf, pFile);
_fputtc(_T('\n'), pFile);
break;
case JOB_NOTIFY_FIELD_PORT_NAME:
_fputts(_T("Port Name "), pFile);
_fputts(pBuf, pFile);
_fputtc(_T('\n'), pFile);
break;
case JOB_NOTIFY_FIELD_USER_NAME:
_fputts(_T("User Name "), pFile);
_fputts(pBuf, pFile);
_fputtc(_T('\n'), pFile);
break;
case JOB_NOTIFY_FIELD_NOTIFY_NAME:
_fputts(_T("Notify Name "), pFile);
_fputts(pBuf, pFile);
_fputtc(_T('\n'), pFile);
break;
case JOB_NOTIFY_FIELD_DATATYPE:
_fputts(_T("Data Type "), pFile);
_fputts(pBuf, pFile);
_fputtc(_T('\n'), pFile);
break;
case JOB_NOTIFY_FIELD_PRINT_PROCESSOR:
_fputts(_T("Print Processor "), pFile);
_fputts(pBuf, pFile);
_fputtc(_T('\n'), pFile);
break;
case JOB_NOTIFY_FIELD_PARAMETERS:
_fputts(_T("Parameters"), pFile);
_fputts(pBuf, pFile);
_fputtc(_T('\n'), pFile);
break;
case JOB_NOTIFY_FIELD_DRIVER_NAME:
_fputts(_T("Driver Name "), pFile);
_fputts(pBuf, pFile);
_fputtc(_T('\n'), pFile);
break;
case JOB_NOTIFY_FIELD_DEVMODE:
// DEVMODE
break;
case JOB_NOTIFY_FIELD_STATUS:
if(adwData[0] & JOB_STATUS_PAUSED)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("Paused"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_ERROR)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("Error"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_DELETING)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("Deleting"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_SPOOLING)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("Spooling"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_PRINTING)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("Printing"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_OFFLINE)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("Offline"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_PAPEROUT)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("PaperOut"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_PRINTED)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("Printed"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_DELETED)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("Deleted"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_BLOCKED_DEVQ)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("Blocked DevQ"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_USER_INTERVENTION)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("User Intervention"), pFile);
_fputtc(_T('\n'), pFile);
}
if(adwData[0] & JOB_STATUS_RESTART)
{
_fputts(_T("Status = "), pFile);
_fputts( _T("Restart"), pFile);
_fputtc(_T('\n'), pFile);
}
break;
case JOB_NOTIFY_FIELD_STATUS_STRING:
{
_fputts(_T("Status String= "), pFile);
_fputts( pBuf, pFile);
_fputtc(_T('\n'), pFile);
}
break;
case JOB_NOTIFY_FIELD_DOCUMENT:
{
_fputts(_T("Document = "), pFile);
_fputts( pBuf, pFile);
_fputtc(_T('\n'), pFile);
}
break;
case JOB_NOTIFY_FIELD_SUBMITTED:
//SYSTEMTIME
break;
case JOB_NOTIFY_FIELD_START_TIME:
memset(arrBuf, _T('\0'), 50);
_stprintf(arrBuf,_T("Start Time: %d:%d\n"), adwData[0]/60,
adwData[0]%60);
_fputts(arrBuf, pFile);
break;
case JOB_NOTIFY_FIELD_UNTIL_TIME:
memset(arrBuf, _T('\0'), 50);
_stprintf(arrBuf,_T("Until Time: %d:%d\n"), adwData[0]/60,
adwData[0]%60);
_fputts(arrBuf, pFile);
break;
case JOB_NOTIFY_FIELD_TIME:
memset(arrBuf, _T('\0'), 50);
_stprintf(arrBuf,_T("Field Time: %d: %d\n"), adwData[0]/60,
adwData[0]%60);
_fputts(arrBuf, pFile);
break;
case JOB_NOTIFY_FIELD_TOTAL_PAGES:
memset(arrBuf, _T('\0'), 50);
_stprintf(arrBuf,_T("Total Pages: %d\n"), adwData[0]);
_fputts(arrBuf, pFile);
break;
case JOB_NOTIFY_FIELD_PAGES_PRINTED:
memset(arrBuf, _T('\0'), 50);
_stprintf(arrBuf,_T("Pages Printed: %d\n"), adwData[0]);
_fputts(arrBuf, pFile);
break;
case JOB_NOTIFY_FIELD_TOTAL_BYTES:
memset(arrBuf, _T('\0'), 50);
_stprintf(arrBuf,_T("Total Bytes: %d\n"), adwData[0]);
_fputts(arrBuf, pFile);
break;
case JOB_NOTIFY_FIELD_BYTES_PRINTED:
memset(arrBuf, _T('\0'), 50);
_stprintf(arrBuf,_T("Bytes Printed: %d\n"), adwData[0]);
_fputts(arrBuf, pFile);
break;
}
break;
}
case PRINTER_NOTIFY_TYPE:
{
}
break;
}
}
}
}
}
else
{
DWORD dwError = GetLastError();
dwError += 0;
}
}
else
{
DWORD dwError = GetLastError();
dwError += 0;
}
}
I dumped the notification data in a file, and had the following
observations:
1. I never received any Status notification for any type of Print job,
i.e be it in EMF format or RAW format. In case of Status String, the
notification was there, but the pBuf was empty. So, how do we receive the status info?
2. In case of print job with EMF data type, the Total Pages and Printed
pages data was received correctly. Same case for Total Bytes and
Printed Bytes.
3. In case of print job with RAW format, Total pages was received with
correct values, but Printed Pages was always recieved with the value 0.
Total Bytes was OK, but at the end of the print job, the Total Bytes
and Printed Bytes were different, the latter being lesser then former.
So, it doesn't help in determining that whether a print job is finished
or not.
Thanks in advance.
Pankaj
|
|
|
|
|
Hello,
is here an sample how to show the caret as an hourglass?
In my project is an filter function, that filters items from a CGridCtrl,
and i like to show the caret as an hourglass during this filtering!
Thanks for any help!
break;
|
|
|
|
|
Use CWaitCursor class.
e.g
void CMyClass::foo()
{
CWaitCursor cursor;
cursor.Restore();
}
|
|
|
|
|
Ignore this answer. It was wrong!
Sorry.
I give myself a 1.
-- modified at 9:26 Friday 15th December, 2006
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Restore is meant for restoring wait cursor, if its been changed.
Sometime , during lengthy operations, it get changed to some other cursor.
This function restores it back to wait cursor. I think you misinterpreted its functionality.
kakan wrote: So the cursor automaticly gets restored when the CWaitCursor goes out of scope.
, Original cursor gets restored in this case.
|
|
|
|
|
OK, my mistake, I didn't know that. Sorry.
I will remove my post in a couple of minutes (to give you time to read this.)
Kakan
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
kakan wrote: OK, my mistake, I didn't know that. Sorry
Everybody does that, sometime.
|
|
|
|
|
kakan wrote: I give myself a 1.
Come on ! I give you 5 for this.
|
|
|
|
|
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Hello,
thanks wery much for help! Works.
And i have a next question, sometimes i see applications with rotate hourglass, how do they this,
or placed on an litle dialog, e.g, with message like "wait " and on the same litle dialog is
an rotate hourglass!?
thanks
break;
|
|
|
|
|