|
Fortunately opinion and fact are two different things.
|
|
|
|
|
If you think this then you have no clue about correct multithreading. BTW, returning to your first reply: have you read my first answer?
|
|
|
|
|
I have done threadding that would make your eyes water.
|
|
|
|
|
I'm not really interested in your threading. BTW, returning to your first reply: have you read my first answer?
|
|
|
|
|
Sounds fairly basic to me, did you think of passing a context to each thread, with the context consisting of the function address to call and the parameters needed?
|
|
|
|
|
You don't need to change the param & return types of the thread function. leave them as it is.
Just imagine the thread function as a platform to launch your test cases - which would be different functions. Just like the post above, I would choose to go with a data structure that takes in all the parameters required to execute the test case. Including the function pointer. If you are bothered about using function pointers you can even have a switch case block that directs the incoming structure-data to the right function using a normal function call. (it's not the best design I'd say, but it still works).
WORD WINAPI Function( LPVOID lpParam)
{
testcaseData ptcdata* = (testcaseData*) lpParam;
ptcData->Data1, data2.. etc
switch(ptcData->tcID)
{
case 0:
TestCase0(...)
case 1:
}
}
And you can use the same Test case index to fill in a Results-vector or list , where it updates the result of the particular test case. The vector can be global or be part of the struct & be protected by a critical section block inside the thread.
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
Hello. I am trying to play a wave stream through WASAPI. I am trying to use the code available in online msdn. Here is what I am trying.
hResult = pAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, 1000000000, 0, pWaveFormatEx, NULL);
if(FAILED(hResult)) return;
UINT nTotalBufferSize = 0;
pAudioClient->GetBufferSize(&nTotalBufferSize);
IAudioRenderClient *pAudioRenderClient = GetRenderClient(pAudioClient);
BYTE* pData = NULL;
hResult = pAudioRenderClient->GetBuffer(nTotalBufferSize, &pData);
hResult = pAudioClient->GetService(IID_IAudioRenderClient, (void**)&pAudioRenderClient);
if(FAILED(hResult)) return;
::memcpy(pData, pDataPCM, nTotalBufferSize);
hResult = pAudioRenderClient->ReleaseBuffer(nTotalBufferSize, 0);
hResult = pAudioClient->Start();
DWORD dwFlags = 0;
while(TRUE)
{
::Sleep(500);
UINT nFramesPadding = 0, nFramesAvailable;
hResult = pAudioClient->GetCurrentPadding(&nFramesPadding);
TRACE("%d\n", nFramesPadding);
}
hResult = pAudioClient->Stop();
I am NOT getting any error but I cannot listen to the buffer as well. So what should I do in the loop to listen to this buffer? Thanks.
This world is going to explode due to international politics, SOON.
modified 2-Sep-13 1:33am.
|
|
|
|
|
What is the difference between the "edit mask" and the "edit template" when using the masked edit control in the MFCPropertyGridProperty control?
See: http://msdn.microsoft.com/en-us/library/bb983599.aspx[^] The documentation is quite sparse for this control.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
Thanks, I didn't think to look there!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Why we use destructors???and what functionality they perform???
|
|
|
|
|
|
Destructor is a function that is automatically called (by the compiler) when an object on the stack goes out of scope or when delete is called on pointer pointing to an object of a class.
Destructors are normally used to perform cleanup on the object.
Destructors along with constructors form an important concept in C++ called Resource Acquisition Is Initialization or RAII - http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization[^]
This concept is used a lot in several C++ libraries like the STL and Boost.
|
|
|
|
|
Destructor - cleans memory occupied by Object.
|
|
|
|
|
No it doesnt.
It is a funciton called when an object goes out of scope and can do anything it likes.
|
|
|
|
|
Destructor is a funtion - cleans memory occupied by Object. when it goes out of scope.
|
|
|
|
|
Because they are automatically called when an object goes out of scope and saves you having to remember to call a kind of 'un_init' function on your object.
|
|
|
|
|
Hello,
I am trying to use CDHtmlDialog in a MFC dialog based project.
What i want to achieve is pretty sample. Have one image, one button and one text box in the HTML page.
And then dynamically change this based on a timer. i.e., there're multiple images in the folder and it will change every seconds. Once the button is clicked, the timer stops and no more image changes. Same time when image changes the text in the text box also should change.
I know this is pretty simple, but for some reason i am not able to make the image even display in the dialog.
I am using Visual Studio 2012 in Windows 7 machine.
Can somebody share some sample code that does this?
I appreciate your help.
Thanks in advance.
|
|
|
|
|
|
Perhaps #1 should update his old article[^].
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
Well spotted.
Veni, vidi, abiit domum
|
|
|
|
|
I have few specific questions
1. When i try to build the sample projects from web in the Visual Studio 2012, it gives the following error --> atlmfc\include\atlwinverapi.h(29): fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.
How to fix this?
2. In the project i created, i am trying to load an image into the DHTML page and that doesn't work. How to load the image into the DHTML page? Also how to change the image in a DHTML page from the MFC code?
2. How can i change the text in a DHTML page from the MFC code?
Thanks in advance.
|
|
|
|
|
Don Guy wrote: This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.
How to fix this? Add a define at the beginning of your stdafx.h file.
Don Guy wrote: How to load the image into the DHTML page? Also how to change the image in a DHTML page from the MFC code? Check the documentation[^], or the article that Soren found.
3. same as 2. Use the features of MFC to set and get dialog data.
Veni, vidi, abiit domum
|
|
|
|
|
I am defining a vector as a private variable of a class Grid. Class Points has only two instance vars that are all ints. Did I initialize constructor correctly and When writing a destructor for Grid do I need to write a destructor for vector like this: ~vecotr() or with delete or using iterator?
class Grid{
public:
Grid(vector<Points> v) : vector<Points>(3, 0) {};
~Grid() {
~vector<Points>(); }
~Grid() {
delete v_points;
}
~Grid() {
for (vector<Points>::iterator it = v_points.begin(),
vector<Points>::iterator it_end = v_points.end(); it != it_end; it++)
}
private:
vector<Points> v_points;
};
Which option should I use and did I initialize constructor correctly?
|
|
|
|
|