|
Thanks for the hints. I created the threads as follows:
HANDLE mutexFIXHandle;
HANDLE mutexSetAlertTimer;
HANDLE mutexSetAWAYHandle;
mutexFIXHandle = CreateMutex(NULL, false, NULL);
mutexSetAlertTimer = CreateMutex(NULL, false, NULL);
mutexSetAWAYHandle = CreateMutex(NULL, false, NULL);
Based on first reply I changed this to and will retest:
mutexFIXHandle = CreateMutex(SYNCHRONIZE, false, NULL);
mutexSetAlertTimer = CreateMutex(SYNCHRONIZE, false, NULL);
mutexSetAWAYHandle = CreateMutex(SYNCHRONIZE, false, NULL);
//
// for waitformutlipleobjects
//
HANDLE ghEvents[3];
ghEvents[0] = mutexFIXHandle;
ghEvents[1] = mutexSetAlertTimer;
ghEvents[2] = mutexSetAWAYHandle;
The skeleton of the WaitForMultipleObjects looks like this:
while (1) {
waitRval = WaitForMultipleObjects( 3, ghEvents, FALSE, 2000);
if (waitRval == WAIT_OBJECT_0) {
// process event
ReleaseMutex(mutexFIXHandle);
}
else if (waitRval == (WAIT_OBJECT_0 + 1) ) {
// process event
ReleaseMutex(mutexSetAlertTimer);
}
else if (waitRval == (WAIT_OBJECT_0 + 2) ) {
// process event
ReleaseMutex(mutexSetAWAYHandle);
}
else if (waitRval == WAIT_TIMEOUT) {
//printf("Wait timed out\n");
}
else {
// log something
}
}
|
|
|
|
|
I also needed to do this to get it to compile:
mutexFIXHandle = CreateMutex((LPSECURITY_ATTRIBUTES)SYNCHRONIZE, false, NULL);
mutexSetAlertTimer = CreateMutex((LPSECURITY_ATTRIBUTES)SYNCHRONIZE, false, NULL);
mutexSetAWAYHandle = CreateMutex((LPSECURITY_ATTRIBUTES)SYNCHRONIZE, false, NULL);
|
|
|
|
|
Using (LPSECURITY_ATTRIBUTES)SYNCHRONIZE causes the program to crash. So I'm back to using NULL.
|
|
|
|
|
Hello,
I need to integrate a video player / video API into my MFC / C++ application. It needs to be able to take video data stored as byte arrays in memory and display it in a preview window.
Is DirectShow the appropriate framework to use for this? As far as I have been able to tell, I would need to write a custom source filter which appears to be non trivial.
Is there a simpler way to do this?
Thanks!
|
|
|
|
|
hi my name is akhtar gul <small><pre><code> <a href=""></a><a href=""></a>[<a href="" target="_blank"></a>]</code></pre></small>
|
|
|
|
|
Your first message is pretty hard to comprehend.
|
|
|
|
|
Hi Akhtar,
What is your problem? The name?
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]
|
|
|
|
|
Hi,
I would like to compare some (black& white) images region by region. I want to know how to split an image into many regions with Qt.
franck
|
|
|
|
|
As far as I know, Qt is a GUI framework and not an imageprocessing library. If you're looking for a lot of image processing functions, try OpenCV.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Hello to everyone!
I need some help. How can I control 8 LEDs using parallel port and Turbo C? I have read this article http://www.codeproject.com/KB/cs/csppleds.aspx but it is written in C# language and since I only know C language, I don't know how to program it.
Please help me for the source code in Turbo C. Any help will higly appreciated. Thanks in advance.
|
|
|
|
|
Using following function to load the dll.
HMODULE hUsbLib = LoadLibrary("inpout32.dll");
GetProcAddress(hUsbLib, "Output");
|
|
|
|
|
HI,
Is it possible to draw rect using Normalised coordinates like 0.399567,0.000000,1.000000,0.399369
|
|
|
|
|
GDI+ allows this. Anyway why bother? Simply properly scale the rectagle before drawing it.
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]
|
|
|
|
|
pls let me know how can i do that...
|
|
|
|
|
GDI+ uses floating point coordinates. You just need to use GDI+.
|
|
|
|
|
Let me be more clear...
Suppose i want to draw segments(rect) on a Dialog and the given coordinates of the segemnt is
0.499567,0.000000,1.000000,0.499369 (these coordinates are independent of the width and height of the Dialog Rect) then how to draw the segment with the given coordinates.....
|
|
|
|
|
Do you sometimes read the answers that are given to you ?
|
|
|
|
|
Hi all,
I have made a exe using VS-2008.
I am trying to run that exe on another pc which not having VS-2008 inatalled on it (having OS - win xp with sp3), in my exe i have initialised COM using this code.
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to initialize COM library") );
return;
}
But every time i run my exe on this machine it gives "Failed to initialize COM library".
Do i need to install anything extra on this machine...
Or what other problem there might be?
Can anybody help me in this...
Thanks in advance
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
You should check better the function return value (make your program reporting it). See the documentation for details [^].
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]
|
|
|
|
|
HI,
For the function CoInitializeEx(), dont check for the returned code.
Because if the COM has been initialized on the calling thread, the return code will be failed i.e S_FALSE.
Just call the CoInitializeEx() and proceed to next.
|
|
|
|
|
DurgaDevi_hr wrote: For the function CoInitializeEx(), dont check for the returned code.
Because if the COM has been initialized on the calling thread, the return code will be failed i.e S_FALSE.
Your point is wrong.
In fact, CoInitializeEx() may return S_FALSE the way you depicted. However FAILED(S_FALSE) evaluates to false .
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]
|
|
|
|
|
Did you register COM in the new machine?
Using following function always successes for me.
hr = CoCreateInstance( CLSID_App, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void **) &pUnk );
|
|
|
|
|
Hi,
Im trying to draw text on a button which is placed on a Dialog...using the below code in Onpaint
CWnd* pWnd = GetDlgItem(IDC_BUTTON1);
CDC* pDC = pWnd->GetDC();
CRect rect1(3,5,8,10);
pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
CBrush brush(RGB(0,0,64));
pDC->SelectObject(&brush);
pDC->DrawText(_T("Example"),&rect1,DT_LEFT|DT_SINGLELINE|DT_VCENTER);
CDialog::OnPaint();
but the above code doesn"t reflect the text...
pls correct me...
|
|
|
|
|
Yout cannot do that, that way. See, for instance [^].
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]
|
|
|
|
|
Thanks for ur Reply...but the button control is from Resource not a custom Control....
Is it not possible to draw text on a control which is created from resource..?
|
|
|
|