|
If the external event uses an interrupt on the PC, the scheduler is irrelevant.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
And how does the interrupt awake your user space thread?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You retrieve the CPU performance counter in the ISR and write the time to file or through a shared memory queue or something of the like.
It should also be pointed out that waking a thread is usually done on less than a thread quanta. However, without a real-time kernel extension, even if your thread is highest priority, this signaling is not deterministic. But, as I said, if you store the actually counters in the ISR, this isn't an issue.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
So you've to write some kernel mode code or am I wrong?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Yes.
Or you get a real-time extension for XP (like RTX from http://www.intervalzero.com/[^])
(I've never needed this degree of precision in XP, but if I did, I'd be inclined to use a micro-controller and something like eCOS on it to do the timings and then send the results to XP via serial port.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Joe Woodbury wrote: I've never needed this degree of precision in XP, but if I did, I'd be inclined to use a micro-controller
The same I would do.
Thank you for enlightening.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Get an IO card which provides events or callbacks via a library when a given input changes state. One I used called NextMove (overkill for your needs) had the first 3 or 4 inputs using interrupts. Try Amplicon (I think) or similar for an IO card.
|
|
|
|
|
Dear All
// Fetches the MAC address and prints it
static void GetMACaddress(void)
{
IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information
// for up to 16 NICs
DWORD dwBufLen = sizeof(AdapterInfo); // Save memory size of buffer
DWORD dwStatus = GetAdaptersInfo( // Call GetAdapterInfo
AdapterInfo, // [out] buffer to receive data
&dwBufLen); // [in] size of receive data buffer
assert(dwStatus == ERROR_SUCCESS); // Verify return value is
// valid, no buffer overflow
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; // Contains pointer to
// current adapter info
do {
PrintMACaddress(pAdapterInfo->Address); // Print MAC address
pAdapterInfo = pAdapterInfo->Next; // Progress through
// linked list
}
while(pAdapterInfo); // Terminate if last adapter
}
can anybody just walk through my code and here i am staticaly allocting the memory for the storing the adpater information for upto 16 NIC card...
but if i want to get and enumerate all the MAC addresses on my PC...
the above code will give upto 16 card so what to do next...
plz help me....
Regards
sunny
|
|
|
|
|
|
Hey
ya it will generate link list...but my problem is how to allocate memory if more than 16 cards in the system.......
Regards
Sunny
|
|
|
|
|
Don't hard code the 16. From the link I gave you:
pOutBufLen [in, out]
A pointer to a ULONG variable that specifies the size of the buffer pointed to by the pAdapterInfo parameter. If this size is insufficient to hold the adapter information, GetAdaptersInfo fills in this variable with the required size, and returns an error code of ERROR_BUFFER_OVERFLOW.
Take a look at the sample code in the link and see how they do it.
|
|
|
|
|
Hi,
I have written following code in my MFC code to display Radio Button on my dialog.
CButton myButton;
myButton.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON,
CRect(50,40,80,70),this, 1);
But Dialog is not showing Radio button.Can anyone help me.
|
|
|
|
|
There are a number of things that could be the reason. Definitively know from your post we cannot.
My advice is that you learn how rendering is done in Windows OS which will enable you to determine your specific problem.
|
|
|
|
|
What function is this code in? My guess would be that myButton is going out of scope and being destroyed just after it's been created.
|
|
|
|
|
Thanks for your reply.Previously myButton is local variable in OnInitDialog function. I have changed it to member variable and I have allocated memory.It is working fine and it is displaying Radio Button.
I have changed this to Push Button. I need to add Event Handler to this Button.Can any one help me.
modified on Thursday, March 26, 2009 12:17 AM
|
|
|
|
|
you need to derive the new class from CButton and add the event handler in that class
|
|
|
|
|
I am in a loop, reading from an RS232 port. There are times when i receive an exception with a system message that says:
"The I/O operation has been aborted because of either a thread exit or an application request"
// read a byte from port
while (!m_bExit)
{
// reset flag variables
dwBytesRead = 0;
// read
bRC = ReadFile(m_hCommPort, pDataBuff, 20, &dwBytesRead, NULL);
dwError = GetLastError();
if (!bRC)
{
if (ERROR_HANDLE_EOF != dwError || ERROR_TIMEOUT != dwError)
{
LPVOID SysMsg;
// reterieve system message
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&SysMsg,
0,
NULL );
// show system message
ZeroMemory( m_szBuffer, sizeof(m_szBuffer) );
wsprintf(m_szBuffer, TEXT("ReadRS232Data() over %s: ReadFile(), %s"), m_Port, (LPCTSTR)SysMsg);
LocalFree(SysMsg);
return 0;
}
}
Has anyone ever found a solution to this or know what would cause this error? Cause once this happens you cannot read from the port until it is out of this conditions which seems to just happen on its own.
Thanks in advance for any help or direction.
|
|
|
|
|
LCI wrote: I am in a loop
That sounds uncomfortable.
LCI wrote: or know what would cause this error
What is the number returned from GetLastError?
|
|
|
|
|
led mike wrote: That sounds uncomfortable.
|
|
|
|
|
I do not log the number that returns, but the related message is :
"The I/O operation has been aborted either because of a thread exit or an application request."
BTW, i cannot reproduce. I just know when it happens.
|
|
|
|
|
Hi All
How can i Use AfxmessBox through Catch(exception)?Plz help me
i have code like this
try{
}
catch(exception er)
{
AfxmessBox(er)
}
Plz help me
|
|
|
|
|
By calling exception::what() maybe ?
try
{
}
catch(exception er)
{
AfxmessBox(er.what());
}
|
|
|
|
|
|
Cedric Moonen wrote: AfxmessBox(er.what());
New Api i think ... I think this must be AfxMessageBox()
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Yeah, but I just copy/pasted his code
Programmers are lazy you know...
|
|
|
|