doing nothing?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

Hi all,

Here's my problem:
I've set up a WindowCallback procedure and now the prog is only waiting for it
to be called.
So the main prog is just doing nothing.

My Question now is: What is the best way of doing that, to take of not so much system recources.

I've done something like this:

Code: Select all

Repeat
  Sleep_(1)
ForEver 
But is there some better way?

Thanks,

Timo

--

A debugged program is one for which you have not yet found the conditions that make it fail.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Kendrel.

Have you tried WaitWindowEvent() ?! I had kinda same problem the first day i used PB... have a closer look in the docs, it might help you!

regards,

Kendrel
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

But I don't wait for eny event!
I just want the prog to do nothing, without using much resources.

Timo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by scurrier.

try a delay(1) or sleep_(1) this should free your system
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

I think Franco posted an example of an API based app, with GetMessage_() and so on, I think you may use that. But WaitWindowEvent() works Ok, too, why use Forever? You won't wait for #PB_EventCloseWindow either?

Bye,

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

Thanks El_Choni,
GetMessage_() works fine.

The prog just waits for a Message send by PostMessage_(), and then processes it.
So there will be no purebasic Events. (That's why i used ForEver)

Anyway, problem solved now, thanks all,

Timo

--

A debugged program is one for which you have not yet found the conditions that make it fail.
Post Reply