|
See GetFileVersionInfo API function or try this[^]
Pavel
Sonork 100.15206
|
|
|
|
|
Heresy! Codeguru? Heresy!
--
Only in a world this sh*tty could you even try to say these were innocent people and keep a straight face.
|
|
|
|
|
Type "Version Information" in the index tab in MSDN and you will find functions such as GetFileVersionInfo.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
I have been trying to find code that will allow me to make an application that can use an exsisting application to enter in data.
For exmaple:
Based on a clients .ini configuration it will pull their client data like
[vpn]
user=0u812
with their information it will add it into the other application password field box so that the application can be automated.
If anyone can point me in the direction that would help in this matter.
I am not even sure what the commands would be, so I am a little lost in this area.
|
|
|
|
|
There are several solution. A quick solution is file-mapping. A robust solution is COM.
Kuphryn
|
|
|
|
|
Do you by any chance have any links that would help teach me on how to write something like that?
I have been losing my mind on this.
|
|
|
|
|
Code Project has a section for COM.
http://www.codeproject.com/com/
Depending on the natural of your application, COM may be overkill. One reason is the fact that COM programming is highly extensive both design and implementation.
As for file-mapping, consider these Win32 API.
CreateFile()
CreateFileMapping()
MapViewOfFile()
http://www.flipcode.com/tutorials/tut_filemapping.shtml
Kuphryn
|
|
|
|
|
Ahh o.k. great.
now for the next part.
o.k. I have my app load the ini data
[user]
info=this is a test
and want it to paste that information into a different application like
notepad
so that when my app lauched it would paste "this is a test" into the notepad text box.
any cool links to do that.
I am not sure what to search for hwnd?
|
|
|
|
|
ahhh never mind. I found it in the com. LOL
thank you very much for your help!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
Hello everyone,
I am having problems with threads (still). Here is a breakdown.
I create 3 UI Threads every 30 seconds and I create them with the CREATE_SUSPENDED flag set. I then set a few simple variables and resume the thread. When the thread is resumed I check the DWORD value returned by the resume to ensure that the thread was created in suspend mode and properly resumed. Every think is working fine. Inside the thread I am logging every part of the thread to a text file to insure the thread isn’t hanging anywhere within my functions. Again everything looks perfect, I can see the thread start, run the functions and exit. Yet if I let the program run for 30 minutes or longer I can open the task manager and I see that my program has way TOO many threads. It’s like the thread gets created and started but it doesn’t do anything, it just sits there. Anyone have any ideas on what I can do?? I am stuck!
Thanks,
Rob
|
|
|
|
|
Just guessing here, but since these are UI Threads, what messages are being sent to them and what message will eventually cause the thread to exit?
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
I don't send any messages to the thread. I create the thread, set the vars and resume it.. With in the thread I create a socket and try to make a connection to another pc running the same software. If I have an error connecting I PostQuitMessage(0); If it connects I send some info and receive some info, if I receive a bye message I close the socket and post a PostQuitMessage(0).. I log everything to a text file on both machines.. and the networking on both sides works perfect.. I can see everything that the thread is doing and I don't see any problems I can see every thread exit properly on both sides.
The only thing I can think of is that the thread is created and then it resumes but doesn't even go into the InitInstance().. Thats where the logging begins.. If it gets created and never runs InitInstance() I wouldn't see anything bad in the logs..
Rob
|
|
|
|
|
This probably won't fix the problem. OTOH it may make it go away. The general rule that I follow for implementing threads is based on the answer to the question, "Does the thread have to catch Windows messages?" The operative word is catch, not send, cause even a worker thread can send messages. If the answer to that question is yes, then I implement the thread as a UI thread. But if the answer is no, then I implement the thread as a worker thread. Based on the briefest of descriptions that you've supplied, I think your threading should be done within a worker thread. Did you consider this alternative and is there any reason for using a UI thread?
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
Yeah, I have thought of using worker threads instead, the only problem is that my main application has a CAsyncSocket derived class that handles all of the network events.. and I needed to create another derived CAsyncSocket class for my thread.. That way the thread can send and receive on its own and so can the main application.. I also tried to get away from using CAsyncSocket and go straight WinSock.. but I saw the same results and CAsyncSocket is much easier to use.. o-well, I'm sure I will figure out this monster eventually..
Thanks for all the replys!
Rob
|
|
|
|
|
Hey Rob,
It appears as if one of two things are happening:
1. The threads are working fine, except they're not being destroyed. In other words, it only seems like every thread is being destroyed but for some reason, they're still running. Monitor your thread count. It should always be constant -- 0 or 3, right? If it keeps going up then they're not being destroyed.
2. Some threads are working fine and others aren't. This seems like an unlikely scenario, since it doesn't make much sense. Why would it not work consistenly if everything inside the threads is working fine, like you say? So... I don't know what to recommend. I'm just hoping it's something easy, like your PostQuitMessage not getting accross or the thread's not being closed, or something. You do create your threads with m_bAutoDelete set to TRUE, right?
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Hi Alvaro,
Good to hear from you again ... I just put the logging into the constructor and destructor of the thread.. and now I am really stumped.. It appears that every thread I create, start and close are doing exactly that the constructor gets logged and the destruction is logged too.. Yet after 10 minutes or so I see an extra thread associated with my process... WEIRD.. I am using the m_bAutoDelete set to TRUE..
Man I am really confused.. I created a int var called m_nThreadCount and set it to 0.. then each time I create a thread I ++ the count.. after 10 minutes or so I was up to 48 and I had 48 entry’s in the log all constructs had a matching destruct, yet I can see extra threads on my process....
What do you think?
|
|
|
|
|
RobJones wrote:
Yet after 10 minutes or so I see an extra thread associated with my process
How do you see it? Are you using the Task Manager for this? Is there any other section of code that could also be creating threads?
RobJones wrote:
after 10 minutes or so I was up to 48 and I had 48 entry’s in the log all constructs had a matching destruct, yet I can see extra threads on my process....
Again, how do you see these extra threads? And how many are we talking about?
This is all very weird stuff. Another approach you may wanna consider is to create a little test application that just creates 3 threads like you do and destroys them after 30 seconds. In other words, try the divide-and-conquer approach to see if you can isolate the problem. If you still see problems with that code, post it here and I'll test it myself to see if I can figure it out -- slow day today.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Alvaro Mendez wrote:
How do you see it? Are you using the Task Manager for this?
Yep, I'm using the Task Manager to look at the thread count..
Alvaro Mendez wrote:
Is there any other section of code that could also be creating threads?
Nope, I am creating the threads in just one function and that function gets fired by a Timer (Every 30 seconds). I can create a sample application that only does the threads and see what it does... If I still show the same results I'll be sure to post the results and source...
Thanks again!
Rob
|
|
|
|
|
Hello again,
I made a really basic test program and I was able to reproduce the problem.. I only see this problem on non development boxes.. machines with out VC++ installed on them.. and the problem may take a good half hour or so before you see it.. Do you have an email address that I can send you the source? I really appreciate all your help..
Thanks again,
Rob
|
|
|
|
|
I found the problem!
It has to do with your call to SetTimer inside the CMyThread's constructor. When CMyThread is created it's still within the context of the main thread. So the timer is created for the main thread and the WM_TIMER message is never received by the 3 child threads.
You know how I figured it out? I put this statement in the constructor:
TRACE("Starting thread: 0x%x\n", GetCurrentThreadId());
And I noticed that it didn't match the thread ID's in the "The thread 0xblah has exited with code 0" message". Then I commented out all the code that was manually calling OnClosing except the one in the PreTranslateMessage and viola! The threads started piling up.
So I'm sure you know the solution: move the SetTimer down to the InitInstance code. At that point, the thread is already alive and the timer will be created for it.
I'm happy to have helped. It sure was nice to get away from the Java code for a change.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Hello
Im developing a client/server solution and I want to send a database recordset from the server to the client? What is the best way to do it? (The server is using iocp, mfc and odbc)
|
|
|
|
|
How are the client and server communicating? If I were you, I would use HTTP[S] and XML. Just transform your recordset to XML.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Isnt it a quite large overhead for using xml? (in unmanaged c++)?
Transfering data (records) is not the only thing that my server does, so webservices isnt the thing for me. The server talks to a PABX (phone switch), monitors corporation extensions, communicates with the voicemail system etc etc. Transferring data is the smallest part =)
XML sounds nice, but the server will handle a lot of connections and will be in the same machine as 4 other server proccesses, so it cant to much cputime.
|
|
|
|
|
hi, i need to embed QuickTime movie on an ASP page (.mov file on server). i'm scanning thru QuickTime samples now.
can anyone point me to the right direction? i found some QuickTime samples here:
http://developer.apple.com/samplecode/Sample_Code/QuickTime/Basics/CocoaCreateMovie.htm
mainly for desktop apps. i dont know too much about ASP, but i have the feeling that "my code" dont have to stream anything in binary - there must be third party component that does this for u and I'm wondering if QuickTime does this for u with one of their API?
Thanks.
norm
|
|
|
|
|
I have a program running on a friend's Win98SE machine that fails to draw everything completely, however it draws everything fine on my machies Win98 and WinXP. After numerous attempts to isolate the problem, we stumbled onto a very strange occurance.
If the program is renamed, it will run consistently with some names but not other names. There is no pattern to the names and the code does not use the program name in any way.
The question for anyone, is there any possible explanation for this strange behavior. I am pulling out my hair to try and find an answer.
Pat
|
|
|
|