|
The OnList is a menu item that opens a dialog in which I can select smth a i hold that in dlg.m_sel. I want to be able to pass dlg.m_sel to ascultarea.
|
|
|
|
|
tanarnelinistit wrote: I can select smth a i hold that in dlg.m_sel
Please make a little effort on the spelling because I cannot understand (english is not my mother tongue).
When are you opening the dialog ? Before or after spawning the thread ? If it is after, then why don't you simply take this value (dlg.m_sel) and store it into a member variable of CMina_sView ? Then in your thread, as you call the function ascultarea, as it is inside the SAME class, you don't need to pass it to the function. The function can simply get it from the member variable.
I think the problem is that you don't know what you are doing. You probably found some snippet of code to start the thread but you don't understand the mechanics beyond that. Am I right ? Then, I cannot explain you in details because the subject is fairly too large. (And I already provided you with the solution).
|
|
|
|
|
1)I knew I should've studied french a little more in highschool.
2)I started programing in VC++ just one month ago but I've read and understood anything I could in one month.
3) I open the dialog and then I spawn the thread.
|
|
|
|
|
I already explained you the solution 2 times. Once more won't help you to understand it better. After one month of studying C++, it is not a good idea to jump directly to thread manipulation (even more if you didn't know a programming language before).
The only advice I can give you is: start slowly. Try to find a good book or course and start to learn the basics first. Otherwise, you'll screw up everything and you'll be really disgusted for life.
|
|
|
|
|
Ok. Thanks a lot. Although I feel a little bit disapointed now, I got your point.
|
|
|
|
|
See Here[^] maybe it is some helpful to you
|
|
|
|
|
Hi,
I hav a class which derived from the CFileDialog.
I gave OFN_ALLOWMULTISELECT option for that.
I want to update the CfileDialog when I change the file extension. So I override the function OnTypeChange() in that ...
I don't know what is the next..?
How can I update the files displayed on the CFileDialog window, when i change the extension( file type ) ????
I just tried it...!
CFileDialog is not updating that...!
CString szFilter = "AVI Files (*.AVI)|*.AVI|Bitmap Files (*.bmp)|*.bmp|All Files (*.*)|*.*||";<br />
CFileDialog FileSelect( TRUE, NULL, NULL, OFN_ALLOWMULTISELECT, szFilter, this );
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
if there is allocation of some memory in console application and then it quits without deallocation (that is mem leak). Will windows free this leak itself after console application is terminated?
9ine
|
|
|
|
|
yes, but you should really fix the mem leak first
Darka [ Xanya]
"When you're taught to love everyone, to love your enemies, then what value does that place on love?"
|
|
|
|
|
it is supposed to, but it might fail sometimes in tracking such memory... so, good programming practices remain the best : you allocate some memory ; then, YOU delete it before exiting the program.
|
|
|
|
|
yeah, I know, I know. But this should be some kind of advantige for console app if do a lot mem allocation, files handles, then you can allow yourself to get rid of that collection of all those resources and garbagging your code.
Its not the case when you write some class to be perfect without any leaks or handles.
9ine
|
|
|
|
|
why because it is a console application that it couldn't be OOP ?
and what is that way of thinking that console applications should be less well designed than graphical apps...
really, i don't understand your point of view.
|
|
|
|
|
Whats the point, writing additional mem free routines to get rid of allocated ones, as it will be deallocated after console is terminated. It is very well designed and quite large but without deallocation.
How can it be OOP one?
9ine
|
|
|
|
|
9ine wrote: Whats the point, writing additional mem free routines to get rid of allocated ones, as it will be deallocated after console is terminated. It is very well designed and quite large but without deallocation.
This makes no sense. Technically, heap memory will be reclaimed by the OS after the program terminates, but if you fail to free it yourself when you are done with it, then your program will slowly (or not so slowly) eat up more and more memory while it is executing (assuming you are allocating based on some set of events -- and if you are not, chances are that data would be better served on the stack anyway). As far as file handles (and pretty much any kernel object), they will NOT be reclaimed when your program exits. This means that if you open a file and then quit, you may need to restart your computer before you can reopen that file (NOT GOOD!).
The point is, if you allocate memory, you should free it. If you don't, do not submit that code as an assignment nor as production code for any company ... it will be rejected as incomplete.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
oh, kernel objects memory leaks are my favorite ones! never clean them after myself
whats the point allocation during the start of the console for say 1000 strings of 256 bytes long and then leaving the program without deleting them.
9ine
|
|
|
|
|
9ine wrote: It is very well designed and quite large
It is not well designed if it fails to clean up after itself. True, the operating system will clean up most resources allocated by your program after it exits, even when you don't free them yourself. The problem is, it may not free all of them. There are resources in Windows that are not freed automatically when a program exits. This means that your program could leave behind resource allocations that can never be freed without a restart. Dangling allocations could also cause your application to fail the next time you run it. A resource you allocated previously and did not free is no longer available.
The other problem is that, while your program is running, it continually consumes more and more resources. If you don't free them as soon as you are done using them, they are a waste. Those resources aren't available for use by other applications or the operating system.
Software Zen: delete this;
|
|
|
|
|
I am compiling a project which I have modified to allow it to compile for Linux as well as Windows.
All compiles ok, except in VS6, the compiler keeps complaining about missing header files.
The headers it is looking for are the Linux ones which are ifdef'ed out (it is ignoring the ifdefs )
I have turned off precompiled headers, but this doesn't seem to have made any difference...
This seems to be happening in a different 'stage' to the Compiling/Linking, as the executable is created ok.
any ideas?
Thanks...
Stormblade
|
|
|
|
|
which files is it looking for ?
|
|
|
|
|
General linux specific header files, needed to compile the code under linux.
|
|
|
|
|
Storm-blade wrote: which are ifdef'ed out (it is ignoring the ifdefs )
How are you doing that ? Post some code so that we can check.
|
|
|
|
|
<br />
#ifdef LINUX<br />
<br />
#include <sys/time.h><br />
#include <X11/Xlib.h><br />
#include <X11/Xutil.h><br />
#include <X11/keysym.h><br />
<br />
#else // LINUX<br />
<br />
#endif // LINUX<br />
And LINUX is only defined when compiled under linux...
|
|
|
|
|
Just to make a test: comment these preprocessor definition so you are 100 percent sure they won't interfere and recompile. If this doesn't work, then you probably forgot to put some of the include inside preprocessor definitions. If this works, then you probably declared LINUX somewhere and forgot to remove it.
You can also see which file generates the error, so open the file and check the include part to see if everything is correct.
|
|
|
|
|
|
Try build all or/and delete the old build files. Maybe there is an old version with the headers in it.
If it doesnt help compile every file per hand to get the source of the message.:-X
Greetings from Germany
|
|
|
|
|
KarstenK wrote: Try build all or/and delete the old build files. Maybe there is an old version with the headers in it.
Tried that
KarstenK wrote: If it doesnt help compile every file per hand to get the source of the message.:-X
It doesn't seem to be coming from the compiler itself...
(As I said the code compiles and links correctly).
Something else is reading the source files and looking for just the #include's, and is ignoring #ifdef's etc...
I thought it was the precompiled header stuff... but even without that it still does it.
|
|
|
|