Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a program wait for a com call

Status
Not open for further replies.

skiflyer

Programmer
Sep 24, 2002
2,213
US
I have a com class which uses IBackgroundCopyCallback, and it all works great... the only problem I'm having is I have to open up a messagebox for it to work, otherwise my program shoots right out... what I want is some way to keep the program alive while waiting for the com call, then the com call calls the function which exits the program... so I guess what I need is a way to keep the program alive and wait, and then the opposing function which shuts it down, or just allows control to flow or whatnot.


Currently this program is running in a dos window (I want to move it to the systray, but am going to wait until I figure everything out first.. however I'm wondering if this might be an issue easier handled there than here...)

I'm using VC++ and I'm basically new to the visual environment... any directionality would be greatly appreciated.

-Rob
 
I'm playing with SetTimer() right now, and it works dandy in debug mode, but bombs the whole computer in regular running (not release, just not stepping through it)... more importantly than slowing the computer though, it just doesn't wrap things up properly... I've tried 1000 and 10000 for the value, if I replace or add an AfxMessageBox, it runs great.... perhaps there's a way to make an invisible message box and automatically click it?

-Rob
 
When a COM call comes in, if the server is not running, COM will start the server. The server will die if no client is connected to it ( when the reference count is zero). Does your program do something that does not fit with this model?
 
What I thin Skiflyer is talking about is that he/she has a a program that creates a com object, makes a call to a component, calls the meathod but because there is no msgloop the program just drops out. Sounds like you need to put some type of loop in there. Since the interface is going to fire off an event I'd say just impliment a standarg message loop and have it shut down the program (if that is what you want to do) after that event is fired off.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top