MSFN Forum: [VB6] Read Playlist from ini - MSFN Forum

Jump to content



  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

[VB6] Read Playlist from ini Rate Topic: -----

#1 User is offline   Synapse 

  • *Previously Bi0haZarD*
  • PipPipPipPipPip
  • Group: Members
  • Posts: 980
  • Joined: 29-July 04

Posted 20 November 2004 - 02:23 PM

Answer has been found.. nevermind...


ok.. kinda simple.. but i can't figure this out...

on form_load i have my program read from an ini file then if "list" = "[NOT FOUND]" I need it to not add it to my listbox... heres the code that i have so far... i want to make it simpler and not put If then statements all the way down...

list = INITool1.GetFromINI("Track1", "Location", App.Path & "\settings.ini")
playlist.AddItem list
list = INITool1.GetFromINI("Track2", "Location", App.Path & "\settings.ini")
playlist.AddItem list
list = INITool1.GetFromINI("Track3", "Location", App.Path & "\settings.ini")
playlist.AddItem list


so lets say... if for Track2 the user didn't put anything in it.. so it returns the string "[NOT FOUND]" but Track3 has something. If i use something like a Do Until event, it will stop on Track2.. insted of reading track 3 and so on..

any ideas?
Thanks


My Solution...
For i = 1 To 20
list = INITool1.GetFromINI("Track" & i, "Location", App.Path & "\settings.ini")
If list = "[NOT FOUND]" Then
'do nothing and don't add to the list
Else
playlist.AddItem list
End If
Next i
End Sub

This post has been edited by Bi0haZarD: 20 November 2004 - 05:57 PM



#2 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 November 2004 - 07:42 AM

Wouldn't just parsing the dir and read in all files be simpler than an ini? That way no configuration just run it.

#3 User is offline   Synapse 

  • *Previously Bi0haZarD*
  • PipPipPipPipPip
  • Group: Members
  • Posts: 980
  • Joined: 29-July 04

Posted 22 November 2004 - 10:39 AM

If i just parse the folder for all .mp3's then it will come back into my listbox as "c:\my music\rock\metallica\Metallica - Master of puppets.mp3" and with an ini i can let the user pick the name of the song.. so insted of seeing the complete path they can set it to say "Metallica - Master of Puppets" it just makes it look a bit cleaner..

this is for my Unattended Audio Player btw.. so thats why i only have it support 20 MP3's since that should be plenty, and whoever makes the CD can set the names of the tracks and it'll look better ;)

#4 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 November 2004 - 04:29 PM

Ok I wasn't telling you how to do it just suggesting ideas. But thats possible also to strip file path returning only name. Or even load the dir to a File1 filter out .exe
Still waiting to try your next version

EDIT: One other idea maybe, After file is played delete it from dir?
Then If I used it at different place it would start next

This post has been edited by maxXPsoft: 22 November 2004 - 04:33 PM


#5 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 November 2004 - 04:46 PM

The reason I was suggesting remove the ini is 'INITool1.GetFromINI'
I think thats a separate exe isn't it?

#6 User is offline   Synapse 

  • *Previously Bi0haZarD*
  • PipPipPipPipPip
  • Group: Members
  • Posts: 980
  • Joined: 29-July 04

Posted 22 November 2004 - 05:00 PM

I know ;) Suggestions are always welcome. and yea, i could always strip out the path to get more of a play all files in the folder.

I don't see what the point of having it delete the file upon finishing the song would be. this unattended player is to go into the $OEM$ folder so it gets copied to the hard drive and played.. then at the end of the installation if you have your install.cmd (or whatever file) to delete the c:\install folder it deletes the songs and player off the hard drive. if the files were to stay on the CD, it would proably slow down the installation of your applications since it would constantly have to read from the CD. and it wouldn't be able to delete the songs from the CD.

#7 User is offline   Synapse 

  • *Previously Bi0haZarD*
  • PipPipPipPipPip
  • Group: Members
  • Posts: 980
  • Joined: 29-July 04

Posted 22 November 2004 - 05:02 PM

maxXPsoft, on Nov 22 2004, 03:46 PM, said:

The reason I was suggesting remove the ini is 'INITool1.GetFromINI'
I think thats a separate exe isn't it?

no its a OCX Control file, i haven't tested to see if i have to bundle it.. i hope i don't since it would mean putting it in the system32 folder by putting it in "$OEM$\$$\System32"

#8 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 November 2004 - 05:13 PM

ahhh,
Yep very possible to use it will need to be included. I have seen a tool called initool.exe and was wondering, I have all my ini modding done by a .bas file included within my app. I searched for years for the right ini thing and came across this after trying nearly all.

Do you have a link to that ocx I can check it out?

Yeah this probably wouldn't play at User.cmd is reason I was thinking of delete file after play, then at runoncex start again new, I been experimenting play mp3's at different points with my app, still a work in progress...

#9 User is offline   Synapse 

  • *Previously Bi0haZarD*
  • PipPipPipPipPip
  • Group: Members
  • Posts: 980
  • Joined: 29-July 04

Posted 22 November 2004 - 05:22 PM

its very simple, although the people that made it aren't around anymore this guy has a very easy to follow instructions.

http://www.martin2k....vb6/tips/x6.php

you got a link to that bas file.. i really don't want to have to include an OCX. i want to make this as stand alone as possible.

#10 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 November 2004 - 06:09 PM

Sorry was uploading my new version UnattendXP then had to search.
I've done some modifying to this myself adding a couple features if you want it then MSG me and leave email and I'll send.

WriteToIni
Dim MyX As String, MyY As String
    MyX = Me.Top
    WriteToIni AddBackslash(App.Path) & "UnattendXP.ini", "ABOUT", "MainX", MyX

GetFromIni
   MyX = GetFromIni(AddBackslash(App.Path) & "UnattendXP.ini", "ABOUT", "MainX")


Get and save as IniMod.bas
Get the last post by Inverso, this has proved to be the easiest least confusing ini routine I have ever had. :thumbup and I have tried them all

#11 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 November 2004 - 06:12 PM

The AddBackslash routine which is great :thumbup
Just add it in the Public Functions seection of the inimod.bas
Public Function AddBackslash(strPath As String) As String
'Receives the App.Path and returns a path containing backslash
'USAGE:  SomePath = AddBackslash(App.Path) & "YourFile.xxx"
  If Right$(strPath, 1) <> "\" Then
    AddBackslash = strPath & "\"
  Else
    AddBackslash = strPath
  End If
End Function


#12 User is online   Tarun 

  • Area 5 Investigator
  • Group: Super Moderator
  • Posts: 2,991
  • Joined: 27-January 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 November 2004 - 06:28 PM

For i = 1 To 20
list = INITool1.GetFromINI("Track" & i, "Location", App.Path & "\settings.ini")
If list = "[NOT FOUND]" Then
'do nothing and don't add to the list
Else
playlist.AddItem list
End If
Next i
End Sub


Just a minor tweak, but you might want to try...

For i = 1 To 20
    list = INITool1.GetFromINI("Track" & i, "Location", App.Path & "\settings.ini")
        If list <> "[NOT FOUND]" Then
            playlist.AddItem list
        End If
    Next i
End Sub


#13 User is offline   Synapse 

  • *Previously Bi0haZarD*
  • PipPipPipPipPip
  • Group: Members
  • Posts: 980
  • Joined: 29-July 04

Posted 22 November 2004 - 06:48 PM

@maxXPsoft
its ok, I was making dinner. lol

ooh! i like this A LOT! thanks.

#14 User is offline   Synapse 

  • *Previously Bi0haZarD*
  • PipPipPipPipPip
  • Group: Members
  • Posts: 980
  • Joined: 29-July 04

Posted 22 November 2004 - 06:57 PM

Tarun, on Nov 22 2004, 05:28 PM, said:

Just a minor tweak, but you might want to try...

heh, revised that this mornin, was tired as hell when i coded it and didn't get around to changing it. thanks for pointing it out :D

#15 User is online   Tarun 

  • Area 5 Investigator
  • Group: Super Moderator
  • Posts: 2,991
  • Joined: 27-January 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 November 2004 - 07:59 PM

What methods do you use to compile? I personally use Compile to P-Code, as it removes a lot of needless data from your application, literally cutting the size in half and doubling the speed.

#16 User is offline   Synapse 

  • *Previously Bi0haZarD*
  • PipPipPipPipPip
  • Group: Members
  • Posts: 980
  • Joined: 29-July 04

Posted 22 November 2004 - 08:27 PM

for UAP 1.0 i just did naitive code, but for 2.0 i'll probably do P-Code


also, i've been looking into this program...
http://www.bitarts.com/fusion.htm

#17 User is online   Tarun 

  • Area 5 Investigator
  • Group: Super Moderator
  • Posts: 2,991
  • Joined: 27-January 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 November 2004 - 08:54 PM

Next time you do a compile, try out P-Code. You'll be surprised with the results. *Checking out Fusion*

#18 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 23 November 2004 - 08:13 AM

Fusion ****
399 if you buy. This poor man will have to do without..

lol Might be surprised if you go back through Components after you been working on something almost a year and remove the unneeded ones and the size is reduced by half. I just done that to my UnattendXP app. I guess I added them experimenting with different things.

Just compiled to P and yep size was reduced nearly half but Tarun what are the advantages/disadvantages? I don't have MSDN installed right now to do help, gave that up several year's ago as I found best answer's come from I-net mostly.

This post has been edited by maxXPsoft: 23 November 2004 - 08:15 AM


#19 User is online   Tarun 

  • Area 5 Investigator
  • Group: Super Moderator
  • Posts: 2,991
  • Joined: 27-January 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 23 November 2004 - 10:56 AM

Compiled vs. Interpreted Applications

See Also

By default, applications created in Visual Basic are compiled as interpreted or p-code executables. At run time, the instructions in the executables are translated or interpreted by a run-time dynamic-link library (DLL). The Professional and Enterprise editions of Visual Basic include the option to compile a native code .exe. In many cases, compiling to native code can provide substantial gains in speed over the interpreted versions of the same application; however, this is not always the case. The following are some general guidelines regarding native-code compilation.
  • Code that does a lot of primitive operations on hard-typed, nonstring variables will yield a maximum ratio of generated native code to displaced p-code operations. Complex financial calculations or fractal generation, therefore, would benefit from native code.

  • Computationally intensive programs, or programs that shuffle a lot of bits and bytes around within local data structures, will gain very visibly with native code.

  • For many programs, especially those doing a lot of Windows API calls, COM method calls, and string manipulations, native code will not be much faster than p-code.

  • Applications that consist primarily of functions from the Visual Basic for Applications run-time library are not going to see much if any advantage from native code, because the code in the Visual Basic for Applications run-time library is already highly optimized.

  • Code that involves a lot of subroutine calls relative to inline procedures is also unlikely to appear much faster with native code. This is because all the work of setting up stack frames, initializing variables, and cleaning up on exit takes the same time with both the p-code engine and generated native code.
Note that any calls to objects, DLLs or Visual Basic for Applications run-time functions will negate the performance benefits of native code. This is because relatively little time is spent executing code — the majority of time (usually around 90–95%) is spent inside forms, data objects, Windows .dlls, or the Visual Basic for Applications run time, including intrinsic string and variant handling.

In real-world tests, client applications typically spent about 5% of their total execution time executing the p-code. Hence, if native code was instantaneous, using native code for these programs would provide at most a 5% performance improvement.

What native code does is to enable programmers to write snippets of code or computationally intensive algorithms in Basic that were never possible before because of performance issues. Enabling these "snippets" to run much faster can also improve the responsiveness of certain portions of an application, which improves the perceived performance of the overall application.

For More Information To learn more about native-code compilation, see "Compiling Your Project to Native Code" in "More About Programming."

Source: MSDN Online Library

In my experiences everything within the application was much faster. I even found that my programs would load faster and respond faster as well. When compiling to P-Code you basically remove the checks and other items of that nature from the application that get "stuck in" during compiling.

#20 User is offline   Synapse 

  • *Previously Bi0haZarD*
  • PipPipPipPipPip
  • Group: Members
  • Posts: 980
  • Joined: 29-July 04

Posted 23 November 2004 - 12:05 PM

OUCH! i didn't see the 399 price tag.. lol. guess i'll be doing without it too lol

I just compiled 2.0 into native and P-code to test the diffrences.. and since UAP is so small it seemed to load the same, sizes were a bit smaller, Native was 32KB, P-Code was 26K

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy