|
how to use CCryptMD5Hash??
|
|
|
|
|
|
I am receiving between 40 and 50 bytes from a some asynchronous serial equipment at 9600 baud. I am suppose to receive this data within 50 milliseconds after it being sent. When I compare the two timestamps it is more than 80 milliseconds.
I am currently using a thread to read the data and do the timestamp immediately.
Any ideas how one could configure the COMMTIMEOUTS optimally to reduce the delay.
Maybe I need to look at something else in my program. Any ideas.
Thanks
Cheers
|
|
|
|
|
Timers under windows and external hardware aren't things that play particularly nicely from my experience. Some fairly obvious suggestions are:
Make sure that you are using a high resolution timer QueryPerformanceCounter() rather than timeGetTime(). timeGetTime() only has a resolution of 10ms, but it can be even worse than that in some situations.
If you are sleeping in you polling thread, don't expect to wake up on time if you call Sleep(), delays can be out by huge ammount from a hardware perspective - 200ms for a sleep of 10ms is quite likely.
If you aren't sleeping, check to make sure that the CPU isn't being choked by your polling thread or another thread being a hog. It might not cause problems now, but it may down the track.
Solutions depend on the application - how time critical is time critical? Is it better to lose data and stay on time? Or do you always need to get every byte? One of the projects I'm working on at the moment is using MaRTE[^] a real time embedded operating system. In the past we have designed custom hardware to cache data to ensure that the PC always keeps up. It's a case of requirement specifications dictatating software design very tightly
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Thanks for your input. It is appreciated.
I do use a QueryPerformance counter to check the time.
Timing and the data is critical.
Other instruments that sends synchronous data at 19200 baud are received at less than 50ms. Unfortunately the instrument in question is the only one that sends asynchronous data at 9600 baud.
I will check out the threads in the mean time.
Thanks again
|
|
|
|
|
Hi all,
How can I detect in runtime whether the AGP slot is empty or not?
|
|
|
|
|
Hi,
When you run this tool handle.exe from http://www.sysinternals.com/ntw2k/freeware/handle.shtml
you will see the names of the MMF sections, for eg:
\BaseNamedObjects\C:_Documents and Settings_test_Local Settings_History_History.IE5_MSHist012004050420040505_index.dat_49152
1. I want to know how handle.exe gets this name from? Is is available from some standard API or its just the path name with '\' replaced with '_'? Its unlikely, as what is 49152 about?
2. I could open this MMF section with OpenFileMapping and could walk through using the memory address. Is there a way to obtain the size of this MMF section? We dont know the file name for this section so that I can use GetFileSize.
3. Any good articles that discusses MMF?
Thanks
-fl
|
|
|
|
|
|
when i run my program via VC++ (by pressing F5) a specified function (OnSize) is called while when i run it outside of VC++ it isn't!!!
i checked it by writing something in a file.
please give a technical answer, i've examined all ordinary cases.
|
|
|
|
|
I can give you 3 possible solutions.
1) Do a complete rebuild.
2) Is your file closed? if that doesn't work try to flush it first.
3) Set a Beep command
If these don't work, I don't know it either. (but sometimes I have the same problem and these always worked)
Good Luck
|
|
|
|
|
Hai,
I am quet new to Visual Studio. I want to write my database programs using the Dialogue Box forms instead of Single/multiple Documents forms.
It is queit is easy to do it using documents. But I dont like the forms. I prefere using Dialogue Boxes to write Database programs.
How I can I access the Database when using dialogue Boxes.
Lloyd.
|
|
|
|
|
Wisdom2004 wrote:
How I can I access the Database when using dialogue Boxes.
How you present the data has no bearing on how you access the data. In either case, derive a class from CRecordset .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I have downloaded the source code of windows 2000.
How can I compile them? Whitch tool may I use?
thanks.
Hi guys. I'm a very man. Do you like fat men?
|
|
|
|
|
Where did you get that?
Maxwell Chen
|
|
|
|
|
Don't care, don't want to know. I never want to see a single line of OS code that isn't legitimately in the public domain, purely to avoid a situation later where MS hit anyone who has 'remembered' so much as that single line.
If you admit to having read it, how do you prove you aren't using (copyrighted) code from it, for example?
The fat man is either raving, or stupid to even post that question, in my opinion.
Steve S
|
|
|
|
|
I can not believe that you told the truth.
|
|
|
|
|
ahahah; nice try.
vote : 1. that's all you need !
TOXCCT >>> GEII power
|
|
|
|
|
I doubt that it is the entire code. IIRC some service pack code was stolen at one time.
Anyway bad choice of question for an open forum!
Ant.
|
|
|
|
|
I wrote a simple win32 application using VC6.0. In the below are my codes. Can you tell me why this program always quit with an error? Thank you for your help!
LRESULT CALLBACK mainWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
switch (uMsg)
{
case WM_CREATE:
return 0;
case WM_PAINT:
hdc=BeginPaint(hwnd, &ps);
TextOut(hdc, 0, 0, "I love you.", 15);
EndPaint(hwnd, &ps);
return 0;
case WM_SIZE:
return 0;
case WM_CLOSE:
DestroyWindow(hwnd);
return 0;
case WM_DESTROY:
return DefWindowProc(hwnd, uMsg, wParam,lParam);
default:
return DefWindowProc(hwnd, uMsg, wParam,lParam);
}
return 0;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
HWND hwndMain;
WNDCLASS wndClass;
MSG message;
hinstance=hInstance;
int nRet;
if(hinstance)
{
wndClass.style=0;
wndClass.lpszClassName="MainWindow";
wndClass.lpszMenuName="MainMenu";
wndClass.lpfnWndProc=mainWndProc;
wndClass.hInstance=hinstance;
wndClass.hCursor=LoadCursor(NULL, IDC_ARROW);
wndClass.hIcon=LoadIconhinstance,
"icon1.ico");
wndClass.hbrBackground= (HBRUSH)GetStockObject(WHITE_BRUSH);
wndClass.cbClsExtra=0;
wndClass.cbWndExtra=0;
}
RegisterClass(&wndClass);
hwndMain=CreateWindow( "MainWindow", "Test main",
WS_OVERLAPPEDWINDOW | WS_HSCROLL |
WS_VSCROLL, // vertical scroll bar
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
(HWND)NULL,
(HMENU)NULL,
hInstance,
NULL);
if(!hwndMain) return false;
ShowWindow(hwndMain, SW_SHOWDEFAULT);
UpdateWindow(hwndMain);
do
{
nRet=GetMessage( &message, hwndMain, 0, 0 );
if(!nRet)
{
break;
}
if(nRet==-1)
{
//log the error
return 0;
}
else
{
TranslateMessage(&message);
DispatchMessage(&message);
}
}
while(1);
return message.wParam;
}
|
|
|
|
|
Just fix:
<br />
LRESULT CALLBACK mainWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
HDC hdc;<br />
PAINTSTRUCT ps;<br />
switch (uMsg) <br />
{ <br />
case WM_CREATE: <br />
return 0; <br />
case WM_PAINT: <br />
hdc=BeginPaint(hwnd, &ps);<br />
TextOut(hdc, 0, 0, "I love you.", 15);<br />
EndPaint(hwnd, &ps);<br />
return 0; <br />
case WM_SIZE: <br />
return 0; <br />
case WM_DESTROY:
PostQuitMessage(0);<br />
return 0 ;<br />
}<br />
return DefWindowProc (hwnd, message, wParam, lParam) ;<br />
}<br />
|
|
|
|
|
Hi,
I am a newbee to programming using c/c++. I want to find out total memory occupied by a linked list in the memory. What is the easiest way to find it out.
|
|
|
|
|
I am not sure, but... how do you think:
std::list<T> foo;<br />
foo.size() * sizeof(T) + sizeof(foo);
Maxwell Chen
|
|
|
|
|
what sort of list ? list<> ?
or a simple array ?
for an array, you should have a trailing NULL at the end, to get the size (unless you already know the size you allocated).
for a list<> you get the nember of elements in the list that you multiply this by the size of an element, plus the size of the list object itself.
TOXCCT >>> GEII power
|
|
|
|
|
(1)list constructed ,what is its elements type? ie:list<int> ,list<string>,list<char> ..
(@) if list<int>,by sizeof(int) ,i can know the byte occupied by the type in your computer,then setting a varible , by iterator i can know the elements numbers in list.by this ,i can know the list occupied the byte number in member
but if list<string>,the case will be a little trouble,you need check out the words numbers in every string,the left solving way are similar the above
|
|
|
|
|
I want to develop a tool which is similar with test automation tool. This tool launches a cmd window and writes some command lines in that window. Now I am able to get cmd window handle, but I don't know how to write the lines. Could anyone help me and I will appreciate it. Here is the code I have done.
WinExec("cmd.exe", SW_SHOW);
CWnd* pDeskWnd = CWnd::GetDesktopWindow();
CWnd* pPrevWnd = pDeskWnd->GetWindow(GW_CHILD);
while (pPrevWnd)
{
CString s;
pPrevWnd->GetWindowText(s);
if (s.CompareNoCase("C:\\WINDOWS\\System32\\cmd.exe") == 0)
{
if (pPrevWnd->IsIconic())
pPrevWnd->ShowWindow(SW_RESTORE);
pPrevWnd->SetForegroundWindow();
pPrevWnd->GetLastActivePopup()->SetForegroundWindow();
CWnd* pCmd = pPrevWnd->GetActiveWindow();
// CPoint id = pPrevWnd->GetActiveWindow();// GetDlgCtrlID();
// pPrevWnd->SetDlgItemText(id, "A command");
/* CDC* pDC = pPrevWnd->GetDC();
pDC->TextOut(0, 100, "A command I want to issue ");*/
return;
}
pPrevWnd = pPrevWnd->GetWindow(GW_HWNDNEXT);
}
|
|
|
|