Qbasicnews.com

Full Version: relatively odd problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
ok, so i wrote that music player a while ago, and i tried editing it / fixing a few things, then compiling it, but i got a unknown error (that "try saving it as a .bas" one), so i looked under task manager, and, to my surprise, the program was already running. o.o so i looked at it under spybot s&d, and it said the parent process / origninating process was winlogon.exe. i checked the s&d startup, but it's not configured to run at startup. i definitely didn't run it. i rebooted the machine, and it was still there. i can end the process via task manager and the code will compile fine, but why does it auto-start when windows boots?
what proram was running at startup?
my program... the one i compiled with fbc previously. the compiled .bas file.
What was it called? Post srcs.. etc.
it's called "player.bas", compiled to "player.exe".

Code:
'Simple FMOD test for FB
'by Plasma  [11-16-2004]
'adapted by the unknown qb programmer [1-6-2005] for more support / other cool things
'commands to fmod in comments are for mod/midi format files
'changelog:
'1-6-2005
'-added support for modes, different paths, different extensions
'-more stable

DefInt A-Z
'$Include: 'fmod.bi'

Declare Sub ErrorQuit (Message$)
declare sub menu()

cmdline$=command$
randomize timer
const FALSE = 0
dim Shared Handle As Long, Channel As Integer,musicroot$,songnum#,extensions$,a$,mode#
dim shared num as integer,byt as byte ptr,paused as byte,doid3v2%,override%,playlistpath$,numlines#
paused=-1
if cmdline$<>"" then
   b%=instr(cmdline$,"/d ")
   if b%<>0 then
      ed%=instr(b%+1,cmdline$,"/")
      if ed%=0 then ed%=len(cmdline$)+1
      musicroot$=mid$(cmdline$,b%+3,ed%-b%-3)
   end if
   b%=instr(cmdline$,"/e ")
   if b%<>0 then
      ed%=instr(b%+1,cmdline$,"/")
      if ed%=0 then ed%=len(cmdline$)+1
      extensions$=mid$(cmdline$,b%+3,ed%-b%-3)
   end if
   b%=instr(cmdline$,"/p ")
   if b%<>0 then
      ed%=instr(b%+1,cmdline$,"/")
      if ed%=0 then ed%=len(cmdline$)+1
      playlistpath$=mid$(cmdline$,b%+3,ed%-b%-3)
   end if
end if
if musicroot$="" and playlistpath$="" then
   line input "root folder? (enter for shared docs/my music):",musicroot$
end if
if musicroot$="" and playlistpath$="" then
   musicroot$="c:\documents and settings\all users\documents\my music"
end if
if extensions$="" and playlistpath$="" then
   line input "types to play? (use wildcards, like *.mp3, *.*, etc)(enter=*.mp3):",extensions$
end if
if extensions$="" and playlistpath$="" then
   extensions$="*.mp3"
end if
mode#=1
a$ = chr$(34)
if playlistpath$="" then
   shell "dir "+a$+musicroot$+"\"+extensions$+a$+"/b/s > database.txt"
   open "database.txt" for input as #1
      while eof(1)=0
         input #1, whatever$
         numlines#=numlines#+1
      wend
   close #1
   playlistpath$="database.txt"
end if
do
   cls
   paused=-1
   select case mode#
   case 1
      songnum#=songnum#+1
      if songnum#>numlines# then
         songnum#=1
      end if
   case 2
      songnum#=songnum#+1
      if songnum#>numlines# then
         exit do
      end if
   case 3
      songnum#=int(numlines#*rnd+1)
   case is > 20
      songnum#=songnum#-1
      if songnum#<1 then songnum#=1
      mode#=mode#-20
   case else
      mode#=mode#-10
   end select
   if numlines#=0 then print "empty playlist":print "press any key to exit":sleep:end
   open playlistpath$ for input as #1
   for x# = 1 to songnum#-1
      input #1, whatever$
   next
   line input #1, MusicFile$
   close #1
   tehpos=1
   while instr(tehpos,MusicFile$,"\")>0
      tehpos=instr(tehpos,MusicFile$,"\")+1
   wend
   musicname$=mid$(MusicFile$,tehpos)
   If FSOUND_GetVersion <= FMOD_VERSION Then
      ErrorQuit "FMOD version " + STR$(FMOD_VERSION) + " or greater required"
   End If

   If FSOUND_Init(44100, 32, 0) = FALSE Then
      ErrorQuit "Can't initialize FMOD"
   End If

   'Handle = FMUSIC_LoadSong(MusicFile)
   Handle = FSOUND_Stream_Open(MusicFile$,FSOUND_MPEGACCURATE,null,null)
   If Handle = FALSE Then
      print "Can't load music file " + CHR$(34) + MusicFile$ + CHR$(34) + ", skipping..."
   End if
      
   'FMUSIC_PlaySong(Handle)
   Channel=FSOUND_Stream_Play(FSOUND_FREE,Handle)

   print "now playing: "; songnum#; " : "; musicname$
   print
   FSOUND_Stream_GetNumTagFields(Handle,num)
   for i% = 0 to num-1
      FSOUND_Stream_GetTagField(Handle,i%,tagtype%,naem%,pointr%,length%)
      j%=0
      tagname$=""
      do
         byt=naem%+j%
         tagname$=tagname$+chr$(*byt)
         j%=j%+1
      loop while *byt<>0
      tagdata$=""
      for j% = 0 to length%-1
         byt=pointr%+j%
         tagdata$=tagdata$+chr$(*byt)
      next
      if tagtype%<>2 then print lcase$(tagname$); " : "; lcase$(tagdata$)
      if tagtype%=2 and doid3v2%=1 then
         print lcase$(tagname$); " : "; lcase$(tagdata$)
      end if
   next

   print "any key=advance, m=menu, p=previous, space=pause/unpause, <&>=position, x=exit"
   do
      key$=inkey$
      if key$="m" then menu:if override%=0 then key$="" else override%=0
      if key$="p" then mode#=mode#+20
      if key$=" " then FSOUND_SetPaused(Channel,-paused):paused=-paused-1:key$=""
      if key$=">" then FSOUND_Stream_SetTime(Handle,FSOUND_Stream_GetTime(Handle)+5000):key$=""
      if key$="<" then FSOUND_Stream_SetTime(Handle,FSOUND_Stream_GetTime(Handle)-5000):key$=""
      sleep 100
   loop while key$="" and FSOUND_IsPlaying(Channel)<>FALSE
loop while key$ <> "x"

'FMUSIC_FreeSong(Handle)
FSOUND_Stream_Stop(Handle)
FSOUND_Close
      
End


Sub ErrorQuit (Message$)

  print "ERROR: "; Message$
  FMUSIC_FreeSong(Handle)
  FSOUND_Close
  sleep
  End 1

End Sub

sub menu()
   print
   print
   print "menu"
   print "----"
   print "(1) choose file #"
   print "(2) view current playlist"
   print "(3) new path/parameters"
   print "(4) change mode"
   print "(5) quit menu"
   print "(6) enable id3v2 tags"
   print "(7) change playlist"
   print
   do
      key$=inkey$
      sleep 100
   loop while key$=""
   select case val(key$)
   case 1
      input "#";songnum#
      mode#=mode#+10:override%=1
   case 2
      open playlistpath$ for input as #1
      while eof(1)=0
         linenum#=linenum#+1
         line input #1, file$
         print linenum#; file$
      wend
      close #1
   case 3
      line input "path (enter=keep current):";musicrot$
      if musicrot$<>"" then musicroot$=musicrot$
      line input "extension (use wildcard chars, eg:*.mp3)(enter=keep current):",extensio$
      if extensio$<>"" then extensions$=extensio$
      shell "dir "+a$+musicroot$+"\"+extensions$+a$+"/b/s > database.txt"
      numlines#=0
      open "database.txt" for input as #1
      while eof(1)=0
         input #1, whatever$
         numlines#=numlines#+1
      wend
      close #1
      playlistpath$="database.txt"
      songnum#=1
      mode#=mode#+10
      override%=1
   case 4
      print "(1) loop mode"
      print "(2) one time mode"
      print "(3) shuffle mode"
      do
         key$=inkey$
         sleep 100
      loop while key$=""
      mode#=val(key$):override%=0
   case 6
      d%=doid3v2%
      input "enable? [1/0]:",doid3v2%
      if d%<>doid3v2% then mode#=mode#+10:override%=1 else override%=0
   case 7
      line input "new playlist:",playlistpth$
      numlines#=0
      if playlistpth$<>"" then playlistpath$=playlistpth$
      open playlistpath$ for input as #1
      while eof(1)=0
         input #1, whatever$
         numlines#=numlines#+1
      wend
      close #1
      override%=1
   end select
end sub
(why does fbide clear the clipboard when you close it? argh...)
ok, i think i found what is going wrong...
in my registry, i found this value in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon:
Quote:"System"="c:\\fb\\player.exe"
anyone have any clue what this is / is it ok for me to just delete the value, or do i have to change it to something else?
I'm not sure about WinNT, but I just run msconfig whenever a program adds itself to startup, and manually remove the instance. It sounds like that's all you're doing there. You might wanna check with someone who knows more about WinNT though...
er, i'm running winXP, sp2, not winNT...

and msconfig doesn't show it as being part of the system startup
WinXP == WinNT 5.1