|
Nish [BusterBoy] wrote:
Two entirely different things eh?
Nish you should move to Canada, your half way there already
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
Nish [BusterBoy] wrote:
Two entirely different things eh?
Nish you should move to Canada, your half way there already
To be frank, though I understand that there is humor hidden there somewhere, I cannot find it
Will someone throw a light here please?
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Canadians are fond of saying "eh ?"
Check out the movie "Strange Brew" for amusing examples of stereotypical Canadian speech.
|
|
|
|
|
Rick York wrote:
Canadians are fond of saying "eh ?"
Oh! I dont say "eh" too often, but I do write "eh" sometimes. When I talk I replace "eh" with "huh". I think I have three or even four variations of "huh" according to the need of the situation.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
That makes you closer to an american than a Canadian.
There are no small projects - only young ones.
|
|
|
|
|
Like CG, i dunno if you want binary comparison or I guess mathematical if you were checking for sound similarity.
Anywho, if you want binary...why not just use windiff...?
However you probably want sound cuz why would you be specific about wav files and not just generic and say files.
Sounds like the latter would be tricky.
Good luck!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I've created a modal dialogbox using DialogBox(). The dialog has 2 editboxes and I want the text they contain to somehow be returned to the parent, so I can use them. I thought of using the returnvalue of DialogBox(), which is what I specify when I call EndDialog() from within the dialogbox procedure, and let it point so some structure with 2 strings. But is this the correct approach? I also do not want to use global variables.
Any good ideas?
Sprudling
PS! I'm not using MFC; just plain Win32 API stuff...
|
|
|
|
|
1. Make a struct that holds the data (pointers, std::strings, whatever you're using)
2. Use DialogBoxParam() and pass a pointer to that struct as the dwInitParam parameter.
3. In your dialog's window proc, the lParam sent with WM_INITDIALOG is that pointer. Save it with SetWindowLong(hwndDlg, DWL_USER, lParam);
4. Whenever you need to access that pointer again, use GetWindowLong().
--Mike--
#include "witty-sig.h"
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Just add 2 strings to your dialog box class. Either make them public or write accessor functions. After DoModal returns your dialog object is still valid and you get the values via dlg.GetValue1(), dlg.GetValue2().
A vast majority of our imports comes from outside the country.
George W. Bush
|
|
|
|
|
Where do I put the code that should react on pressing enter in a combobox?
The ComboBox is created in MainFrame.
Where should I do the messagemap?
Thanks in advance.
-- Kelthar :: icq9071676 :: http://www.bilbomb.com/ --
|
|
|
|
|
Do it whereever you find the resource id for the combobox in classwizard
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Can anyone tell me what exactly the export definition file is for?? In Visual studio i build this DLL which has a .def file in the workspace and it has two exports defined, everything compiles great. Now when i compile under Mingw i get an error that i dont have a .def file but that one will be created for me, but its got all sorts of functions and weird chars in it and its totally different from the one in VC++. So i tried to just copy the .def file cause its the same DLL and all but then when i try to compile with the .def file in my workspace (Dev-C++) i get some error saying "def file unused since linking not done" or something...
Can someone explain what the .def file is for, and if its even that necessary to include??
Thanks for any help.
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
It has to do with compiler mangling of function names. For example, take the function:
__declspec(dllexport) int __stdcall foo(int a, int b);
The complier mangles the function name into _foo@8 , where 8 is the number of bytes passed as parameters. If you try to link this function with another vendors compiler, it will look for foo (or whatever its compiler might mangle the function name into) instead of _foo@8 , and come to the conclusion that no such function exists in the dll. If you have provided an .def file with the line: "EXPORTS foo", the linker parses the file, and exports foo instead.
I don't know about the additional functions you get (exported from other linked modules?), but you probably need a .def file for the functions you export yourself.
/moliate
|
|
|
|
|
I am making an MFC dialog based application. I need to have edit boxes appear while the program is running. How do i do this?
|
|
|
|
|
Use ShowWindow(SW_SHOW) and ShowWindow(SW_HIDE) to show and hide controls on a dialog.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Use CreateWindow() or CreateWindowEx() with "EDIT" as classname and with the WS_CHILD windowstyle to create the editbox.
Read about CreateWindowEx here.
Sprudling
|
|
|
|
|
Add CEdit member variables to your dialog class and call Create on them when you want to.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Poor bloke. He got three equally accurate, but totally different, answers...
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Hi,
Given: a multithreaded app with a worker threadfunction as below:
UINT TreadFunction(...)
{
Sleep(nDuration);
}
Sleep(nDuration) tries to model a data read operation of unpredictable length from an external device. The read in operation blocks the execution of the thread just like Sleep does. nDuration depends on the actual speed of the device.
Usually, nDuration is < 1 sec, which is quite acceptable for displaying the data afterwards. However, when shi#t happens it might even take up to 1 min for all the data to be read in which is unacceptable because my other threads cannot access the device in the meantime in order to retrieve other kind of data (concurrent access of device is not allowed)
In case of slowed down read I would like to terminate the execution of the above treadfunction after a pre-defined amount of time has elapsed REGARDLESS of the data having been completely read in or not. Of course, partial data could only be displayed in this case.
E.g:
Protection (let's call it so): tread can execute not more than 5 secs.
in 95% nDuration < 5 sec. (Protection does nothing, threadfunc terminates normally, full data is displayed)
in 5% nDuration > 5 sec. (Protection makes the threadfunc terminate prematurely, partial data is displayed)
Do you have an idea how to do that?
Thanks
Pepe
|
|
|
|
|
Hmmm... well, I'm not sure that Sleep is conceptually the same as a blocking fn, but I see your point.
Is there any way to use a non-blocking call, or perhaps set a read timeout on the operation (is this a socket or serial device?)
If not, the only thing I can think of is a TerminateThread issued by a controlling thread when a timer expires - a muchly to be avoided construct. However, if you know that termination is safe (nothing to cleanup) and there's only ever one thread reading (meaning only one timer to set up) it might not be too bad... (no flames please! )
|
|
|
|
|
The serial port is concerned.
Non-blocking calls are not possible because the device manufacturer supplied an ActiveX to be used.
TerminateThread sounds not bad because there is nothing to clean up. I will definitely try it.
But could you please clarify what you meant by setting a read timout?
Thanks for your help.
Pepe
|
|
|
|
|
PPM wrote:
But could you please clarify what you meant by setting a read timout?
Well, on a blocking socket you can use a setsockopt option to specify a timeout for a read or a write operation - not sure how reliable this is in windows, but supposedly works for winsock2. Haven't used it myself, obviously
|
|
|
|
|
TerminateThread is a VERY agressive function and I would aviod using it AT ALL COSTS.
TerminateThread is used to cause a thread to exit. When this occurs, the target thread has no chance to execute any user-mode code and its initial stack is not deallocated. DLLs attached to the thread are not notified that the thread is terminating.
TerminateThread is a dangerous function that should only be used in the most extreme cases. You should call TerminateThread only if you know exactly what the target thread is doing, and you control all of the code that the target thread could possibly be running at the time of the termination. For example, TerminateThread can result in the following problems:
If the target thread owns a critical section, the critical section will not be released.
If the target thread is allocating memory from the heap, the heap lock will not be released.
If the target thread is executing certain kernel32 calls when it is terminated, the kernel32 state for the thread's process could be inconsistent.
If the target thread is manipulating the global state of a shared DLL, the state of the DLL could be destroyed, affecting other users of the DLL.
A thread cannot protect itself against TerminateThread, other than by controlling access to its handles. The thread handle returned by the CreateThread and CreateProcess functions has THREAD_TERMINATE access, so any caller holding one of these handles can terminate your thread.
If the target thread is the last thread of a process when this function is called, the thread's process is also terminated.
The state of the thread object becomes signaled, releasing any other threads that had been waiting for the thread to terminate. The thread's termination status changes from STILL_ACTIVE to the value of the dwExitCode parameter.
Terminating a thread does not necessarily remove the thread object from the system. A thread object is deleted when the last thread handle is closed.
As you can see, using TerminateThread is just asking for problems.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Did you think about asynchronous I/O? It is intended to solve exactly such type of problems.
|
|
|
|
|
Asynchronous I/O is unfortunately not possible because all the communication protocol is packaged up into an ActiveX which cannot be changed.
And the reason for several worker threads is:
1.responsiveness of GUI to be preserved
2.queue requests for other data retrieval during the blocked period of time
The worker threads themselves are meant to play the role of asynchronous calls.
Thanks
Pepe
|
|
|
|