|
One last thing. Can I pass the same pointer to the multipule threads? Basically at the creation of each thread I will pass a pointer to a struct to that thread, which will contain the ipaddress and port number. Then any time i need to pass info to a thread I'll post a message and have that thread check the struct and grab the data.
Does that sound like it might work. Is there a better way to pass info to a thread after the thread has been created?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I got an Assertation error when i try to allocate the memory. I can't understand the problem because the programm works good when my binary tree is little( i mean 6-th level). Actually i got tree object, and i born a child nodes of this tree, when my level exceeds 6 it shows an error... Where can be the problem???
Visual studio shows me the message box with this message:
file: dlgheap.c
line: 1100
expression _CrtCheckMemory()
Who can explain this situation???
|
|
|
|
|
I’d like to run something like this:
CMutex m;
for( int I = 0; I < 100; I++)
{
m.Load( INFINITE );
//”run a thread” that run m.Unload()
}
my problem is that the second time the main loop runs m.Load(INFINITE )
It doesn’t wait to my thread has runed m.Unload();
What have I missed?
_____________________________
...and justice for all
APe
|
|
|
|
|
In the sample code, you instantiate a new CMutex object. How does the thread get access to the mutex?
Kuphryn
|
|
|
|
|
I (for a start made it totaly Global)
_____________________________
...and justice for all
APe
|
|
|
|
|
d00_ape wrote:
What have I missed?
the principle how mutexes are intended to work
A Mutex protects a resource so that only one thread accesses it at a given time.
A Mutex has two states:
- "Free"
- Acquired by one specific thread
Lock tries to acquire the mutex. It succeeds if
- the Mutex was "Free"
- the Mutex was acquired by the current thread
If it succeeds, the mutex is now acquried by the current thread.
To release the mutex, Unlock must be called:
- in the same thread that called Lock
- the same number of times Lock() was called by this thread
Check the other synchronization objects (I think there was a nice tutorial here on CP) which suit your needs better.
we are here to help each other get through this thing, whatever it is Vonnegut jr. boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
peterchen wrote:
To release the mutex, Unlock must be called:
- in the same thread that called Lock
Maybe thats my problem.
I'm tying to release a Global mutex from one of my threads so that the mainthread can continue creating a new thread.
How may I fix that?
Going to read articles on CP - Thanks!!
_____________________________
...and justice for all
APe
|
|
|
|
|
I *think* You could use an event: the main thread waits for it, and the worker thread fires it when appropriate.
However, this is hard to say not knowing all details. And you should be able to make the decision. In my experience, for reliable Multithreaded programming, you have to know "all details" (well, not all, but all your tools)
good luck on the reading
we are here to help each other get through this thing, whatever it is Vonnegut jr. boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
OK Thanks!
_____________________________
...and justice for all
APe
|
|
|
|
|
Is there an alogorithm or code sample where I can upsample a wave file? Ie from 8Khz to 11Khz.
Thanks
|
|
|
|
|
That's math search google, there are many examples.
Don't try it, just do it!
|
|
|
|
|
Hi.
My name is Roxanne and I am a C++ / C# programmer.
In the company that I’m working at, we are programming a business program for the customers and the software have been done in Visual C++ 6.0
I have to create and add to the software a new feature pretty similar to: (LiveUpdates from Norton antivirus or another software that check for softwares updates through the internet), to let the customers get the new software’s updates.
Can anyone help me out with some ideas of how to do it?
If somebody can help with some ideas or examples codes I’d appreciate it.
Thanks
Roxanne
|
|
|
|
|
Where is the problem?
Collect all information about the modules used within your software and it's version numbers.
then you could create a php script on the server to parse these version numbers, and if there are new versions then output the urls of the new files. so the client software calls the .php page with the module names and versions as GET parameters and receives the link list of the new files. then download the files and install them. isn't it easy?
Don't try it, just do it!
|
|
|
|
|
thanks Alexander for your help
What customer wants is this.
When they click at LiveUpdates menu, then a dialog box come out and a progress bar star downloading the bytes of the new updates and when it finish then install it.
Do you have any examples or you know some place that I can find one?
Thanks
Roxan
|
|
|
|
|
Or simply a .txt file on the sever that contains all the version numbers/program names.
Download this and parse it, if there is som newer software then download/install it.
"An expert is a person who has made all the mistakes that can be made in a very narrow field." - Neils Bohr
|
|
|
|
|
I need your help!!!!
The question is that I need implement a scanner option in my app via twain. I must scan documents ith a automatic name (sending by myself).
Anybody can help me how to call a twain?
|
|
|
|
|
I would like to fix the List Control into large icon mode and not display the text for each item below its icon. That's easy. I can use Custom Draw or even simpler, just set the text to "" when I add the item.
Here is my problem: For selection purposes the WCC still considers the space for the label when it does hit testing. I would like that not to be the case but rather limit selection to mouse clicks on the bitmap image only.
After several hours of research I think I can't do this but I wanted to know if anyone had a bright idea.
Thanks!
|
|
|
|
|
Why not use CListCtrl::HitTest (with flags = LVHT_ONITEMICON) to check where the user has clicked and refuse the selection if the hit test fails ?
~RaGE();
|
|
|
|
|
Hi!
In an application I'm making, I would like to be able to play an .asx file. The file just contains an url of the address of a radio station (that's what I want people to be able to hear ). I just want to be able to start and stop the audio. I trust there is an easy way to do this!
I have tried to find an article/tutorial or source code related to this but without much luck.
I would appreciate it if anyone could help me out.
Thanks.
Cheers,
Bail Organa
PS: Sorry for my (very) rusty english.
|
|
|
|
|
Hello,
I want to use string instead of commands
CString myCommand="MessageBox("Hello")";
and with a command I want to execute this command,
Best wisehes,
Thanks.
|
|
|
|
|
huh ? can you explain what you want to do ? ( context if possible )
you can't really...
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
dSolariuM wrote:
CString myCommand="MessageBox("Hello")";
I'm not sure what you expect this to do. If you want to execute the MessageBox() function, just call it like any other function. Can you clarify?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I think he wants to be able to convert text to code. In Visual FoxPro, you can do this. A friend of mine brags about being able to do this in VFP, and not in C++. In FoxPro you can write code like this:
lcString = text1.Value &&user input text into an edit control that equals "MessageBox('hello')"
&lcString && will actually execute the string as code
the '&' in front of the string denotes something in foxpro called 'macro expansion' and will actually use the string as if it were code, so that if you wanted to use it for something like teaching purposes, you could have the student type in a line of code, and execute it at runtime. This is one of the ONLY things I like about vfp. It might not have any very common uses, but I think it's cool to allow the user to execute code (or yourself for debugging purposes, maybe).
Anyway, I've also wondered if there was a way to do this in C++ and it kind of frustrates me to think that a rinky dink language like FoxPro can do something like that, and C++ can't.
Bugs?! What do you mean, 'bugs'? We purposely put those 'Undocumented Features' in the program.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
I haven't used FoxPro since 1991, but I do remember being able to do this. I didn't think much of it at the time, but in retrospect, it is a neat feature.
"Rinky dink" is not a term I'd associate with FoxPro, especially the visual version. I suppose this feature is possible in part because of differences between a compiled language and an interpreted language.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
No, I guess you're right, I just HATE FoxPro. A couple months ago I was forced into learning it because one of our main applications we develop and support is in FoxPro. The program was origininally done in 2.6, but was recently converted to vfp 7. Me and another programmer had to take over this project, which was done on the outside, but still needs modifications, and also add another module.
The IDE itself is buggy. Debugging is a chore. And it lets you compile just about anything without warning or error - it just crashes when it gets to the point where you're accessing a variable that wasn't declared or something like that. I've heard that VFP 8.0 is a LOT better, but I haven't had a chance to look at it.
On a positive note, another thing that can be cool about foxpro is that we have one main application that accesses a bunch of smaller apps. If you make a variable public in one app without releasing it, any other app can have access to that variable without it being declared. But this can also have its drawbacks. The saving grace is that the programmer who originally wrote the program (and is no longer with us) is brilliant and very talented.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|