eliminating windows bg services...

General FreeBASIC programming questions.
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

eliminating windows bg services...

Postby Ophelius » Feb 28, 2006 6:14

is there any way to run a FB application so it automatically halts/pauses all unnessesary bg services? it causes jerkyness for my scolling engine (i.e. when the HD is being accessed by other applications.) ahhh, how i miss the dos age, no jerkyness.
cha0s
Site Admin
Posts: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Feb 28, 2006 8:31

i have not tried playing with threads yet, but it sounds like you need to open a thread and make it "high priority" or something.. i don't know much about winapi, someone else here will know better
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Postby anonymous1337 » Feb 28, 2006 9:22

Look in the Freebasic/examples folder for Threads.bas

You don't need the WinAPI for it Cha0s. FB can make it's own threads.
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Postby Ophelius » Feb 28, 2006 10:21

ok, i read a bit about threads, i have a few questions. Does creating a thread for a function allow that function to be processed in paralel with other functions? If so, wouldn't background processes still interfere? Would I be able to thread my entire program so nothing interferes with it? that wold be nice. I'll need more examples of how to implement threads though, and a bit more about threads in general. Anybody know any good tutorials, preferably for FB?
Mysoft
Posts: 779
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Postby Mysoft » Feb 28, 2006 15:49

you can change the priority of your main program, but be caution with 100% cpu usage, that can cause instability...

in windows...

Code: Select all

#include "windows.bi"
SetPriorityClass(GetCurrentProcess, HIGH_PRIORITY_CLASS)
' and continue with the program


windows have a thing called priority booster that can mix up things, but increasing priority is a good solution, in many cases.
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Postby Ophelius » Feb 28, 2006 20:46

damn, the windows include file conflicts with the allegro include with the BITMAP structure and other things. I might have to rename them all. Unless someone knows another way around this? I've looked into the windows include file and noticed there's probably many of those secondary include files that I don't need in order to use SetPriorityClass. Maybe omiting the ones i don't need will solve this.
cha0s
Site Admin
Posts: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Feb 28, 2006 21:01

try this instead of

Code: Select all

#Include "windows.bi"

do this

Code: Select all

#IncLib "kernel32"

Declare Function SetPriorityClass Alias "SetPriorityClass" (ByVal As Any Ptr, ByVal As uinteger) As Integer
Declare Function GetCurrentProcess Alias "GetCurrentProcess" () As Any Ptr
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Postby Ophelius » Feb 28, 2006 21:39

great, that worked, but it didn't solve the issue unfortunately. The scrolling is still jerky. Maybe it's just my $%#@ computer.
cha0s
Site Admin
Posts: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Feb 28, 2006 21:43

your code *may* be bugged to create this behavior, if you post source, people could test it out and let you know
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Postby Ophelius » Feb 28, 2006 21:55

I don't think it's my source. It's jerky because of random HD accesses Windows makes in the BG. It's smooth when the HD isn't being accessed.
Mysoft
Posts: 779
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Postby Mysoft » Feb 28, 2006 22:38

Ophelius wrote:I don't think it's my source. It's jerky because of random HD accesses Windows makes in the BG. It's smooth when the HD isn't being accessed.


hum.. the HD acess isnt part of your program? well, if you use XP and your ram are above of 256mb, it can be a program that you have installed into your computer that are making those HD acess, but yes, windows have almost highest priority when acess HD, but the access is trough DMA, then the amount of data that you hd are acessing in this random time are big, or the program is in an high priority, you can search for that program in the TASKMGR (ctrl+alt+del), ^^

Return to “General”

Who is online

Users browsing this forum: No registered users and 15 guests