Click to See Complete Forum and Search --> : How To keep track of our window


gaurav_gupta81
June 15th, 2005, 10:19 AM
Actually i'm using API's of skype which is a VOIP application and helps in building other application using their API's.
Now I build an application using their API's and through my application I called their application i.e through simply passing SendMessage() function and getting their response from COPYDATASTRUCT structure in WM_COPYDATA message.

now my problem is that my application can't close automatically after that time as control has been lost from that, but if i move mouse over my application window or make its window up, it get close after that time,
So i want to know that is there any method through which i'm able to keep track of my application even if control passes to other application.

Please reply me, its urgent

golanshahar
June 15th, 2005, 10:36 AM
it sound like your app is stuck in the GetMessage() loop and when event comes it waking up....if you have the GetMessage() try to use PeekMessage instead, but this is just a shut in the dark, you need to give more details or even send your project for reveiwing.

if i helped dont forget to rate :-)
Cheers

gaurav_gupta81
June 16th, 2005, 03:36 AM
Hi golashahar,
thanks for yor relply, but it doesn't work. It actually now get struck in loop and doesn't come out of it, which makes the CPU usage upto 100%.

Now I'm going to explain you in more details,

while(counter>=1)
{

COPYDATASTRUCT oCopyData;
string test="Call ";
test.append(Row[0]);
oCopyData.dwData=0;
oCopyData.lpData=test.begin();
oCopyData.cbData=test.length()+1;
SendMessage( skhwnd, WM_COPYDATA, (WPARAM)hwnd, (LPARAM)&oCopyData);
activeflag=1;
}

This is the loop through which we are calling from numbers taken from database, see active flag which gets set now.

Now we are going to check that is the call in progress then only timer starts, current status will contain the information coming from skype through COPYDATASTRUCT in the WM_COPYDATA message.

if((progressflag==0) && stricmp(currentStatus.begin(),"inprogress")==0)
{
progressflag=1;
finishFlag=1;
sndPlaySound("C:\\sound.wav",SND_FILENAME | SND_ASYNC);
strt=clock();
}

Now here strt will contain the time stamp of that time,

In the default message switch i'm checking this code

if(activeflag==0 && progressflag==1)
{
end=clock();
elapsed_time=end-strt;
if(((int)elapsed_time/1000)>=10)
{
progressflag=0;
SendMessage(hwnd,WM_COMMAND,104, NULL); // which will stop the call
break;
}

So now please suggest me the appropriate answer.
Hope now you will go through details.

Thanks in advance.

Regards,
Gaurav

it sound like your app is stuck in the GetMessage() loop and when event comes it waking up....if you have the GetMessage() try to use PeekMessage instead, but this is just a shut in the dark, you need to give more details or even send your project for reveiwing.

if i helped dont forget to rate :-)
Cheers

golanshahar
June 16th, 2005, 04:11 AM
can you send the project so i will review it? its hard to understand it that way.

Cheers

gaurav_gupta81
June 16th, 2005, 08:24 AM
Thanks,

I got the solution by using timer functions i.e SetTimer() and creating a Call back function for that timer.
Any way thanks alot for help.

Regards,
Gaurav