|
Richard,
I'll get back to you on this one. The section of code in question is "broken".
I hope you are right and I had something else doing the deed.
But I checked elsewhere and really did not pull the silly idea of Beep terminating the thread out of my hat. Of course now I cannot find the source!
Right now I think the Beep is run in its own thread and what I saw in debug was message terminating that thread.
Thanks for your help.
Vaclav
|
|
|
|
|
The problem is you never give us all the information necessary to try and offer suggestions. You stated earlier that Beep() terminates a thread, but now you cannot find the source. So we have no way of even guessing what your code may be doing.
Veni, vidi, abiit domum
|
|
|
|
|
Hi,I read some articles, some say enum constant not ocuupy storage in memory, some say it does.
I wonder, for example, enum Weekday {sun,mon,tue,wen,thu,fri,sat}, then where is the Weekday be stored at?
And I want to declare a enum consant like:
enum XXYY {xx1=100,xx2=3000,yy1=4500,yy2=32}, is that ok? or
have to define: enum XXYY { xx1=32,xx2=100,yy1=3000,yy2=4500}?
|
|
|
|
|
The enum members can have any int value. All of them can have the same value, they can have random order.
The only two "rules" that you have to know: If you don't define the value of the first enum member then its automatically 0. If you don't define the value of any of the other non-first enum members then their value is automatically the value of the previous member + 1. Using enums to declare constants in header files (even inside classes) is a good old trick. If you use the enum just to define constants then you dont have to give a name for the enum itself:
enum {
val0 = 5,
val1 = 1,
val3 = 4,
};
EDIT: The weekday enum itself is just a type. A type doesn't occupy any memory. If you declare/define a variable of that enum type then the variable occupies some memory, the same amount as an int variable:
Weekday wd;
void func()
{
Weekday w;
enum Weekday ww;
}
class C
{
private:
Weekday m_Weekday;
};
|
|
|
|
|
Hi all. I am trying to compile open source CamStudio project. I have been able to compile the project with no errors. But when I run it in debug mode, it gives 2 debug assertions.
1 - Debug Assertion Failed: ..... \atlmfc\include\afxwin1.inl Line: 24
2 - Debug Assertion Failed: ..... \src\mfc\docsingl.cpp Line: 219
3 - Unhandled Exceptions.
Now if I keep ignoring them, it runs the project. I can record my desktop, my voice etc. What could be the cause for these debug assertions and how to remove them. Thanks.
|
|
|
|
|
Django_Untaken wrote: What could be the cause for these debug assertions Anything at all. You need to look at the code in order to find out what they are complaining of, and use your debugger to try and resolve them. However, since this is open source you would be better asking the question at the site where you got the code from.
Veni, vidi, abiit domum
|
|
|
|
|
Hello all,
I am using CDHtmlDialog to create a simple MFC app. I want my app to do the following things.
Load images by using the MFC code to the DHTML page.
Change texts in the DHTML page using the MFC code.
Capture DHTML button cicks inside the MFC code and based on that change the images & texts.
For the 1 & 2 i am planning to do that inside a TIMER or Thread and dynmically change them for user.
I am able to make a simple app, but what am struggling with is changing the images & texts in DHTML page from the MFC code.
Can someone tell me how to do that?
A sample app or code will be great.
Thanks in advance.
|
|
|
|
|
|
No profile, 7 messages, a name like 'Don Guy' and English is not your native language?
Go on, stop pretending to be American in order to get your quesitons answered. Tell us who you really are.
modified 3-Sep-13 9:52am.
|
|
|
|
|
Hi,
i need to create multithreaded environment in my Unit-testing activity. For that i need to create multiple threads which can handle methods individully. And these mthods having different parameters & return types. So as per requirement i'm trying to create thread by using CreateThread().HEre the the thread can handle mehtod like in this format "DWORD WINAPI Function( LPVOID lpParam )
"
Hence my questrion is that , how can we create thread using C++ to hadle method having 'different type of method parameter' & 'method return type' as well.
Please help me soon. Thanks
|
|
|
|
|
pk jain wrote: how can we create thread using C++ to hadle method having 'different type of method parameter' & 'method return type' as well. You don't; you create function calls to call different functions/methods. Running such calls in different threads may or may not be necessary, depending on the test environment.
Veni, vidi, abiit domum
|
|
|
|
|
I can help you in threading because your problem is simple, I would do this with a task object queue (threadpool) but do you think you need multithreading for this? You are calling different methods of objects from different threads within the same process? You can test only threadsafe methods that don't interfere with each other this way. I would rather do this with multiprocessing instead of multithreading. You start several processes each of them performing a different test. This way each process has only one main test thread but these main/test threads dont interfere with each other because they are isolated in separate processes. Sometimes multiprocessing is the winner especially when you are using a non-threadsafe library. So why do you want to use multithreading?
|
|
|
|
|
And these funcitos he is tesing are going to run in seperate processes are they? How likely is that? Perhaps they do share data and use mutexes to manage this and the entire POINT of testing is to make sure they work in the SAME process? Ever thought of that?
|
|
|
|
|
Thanks again for your comments. Have you finished reading my post? The last question tries to find out the intentions of OP. Most of the well written modular multithreaded applications are built up from single threaded components containing the least possible locks and synchronization points between threads that work with separate instances of these single threaded modules. Since the components are usually single threaded most of the test cases are also single threaded and test the functions of a module. It's okay to create a few test cases to test the multithreaded interactions and synchronization points but this won't be the majority of the test cases. Parallelization of test cases within a single threaded component can be achieved safely only with multiprocessing. Actually I've worked on systems that were developed with lots of test cases and some of these systems were multithreaded and some of these were well designed at the same time.
|
|
|
|
|
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?
|
|
|
|
|
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.
|
|
|
|
|