Results 1 to 5 of 5

Thread: Need help fast. PLEASEEEEEE!

  1. #1

    Thread Starter
    Hyperactive Member kourosh's Avatar
    Join Date
    Aug 1999
    Location
    Vancouver, British Columbia, Canada
    Posts
    256

    Post

    Hi, I am creating an application which basicly show the name of the .rm files (Real Player) and then the user have to click one and then click the play button to play the file in the real player. Ok this is the problem I used a label to store the compete path to a variable name RPF then I used the shell command to play the path (Which is the label caption) using the shell command. Ok this is the code

    Dim RPF as variant
    RPF = lblmusic.caption
    shell RPF

    But I get a message saying the can not find path, it doesn't understand that RPF is a variable and it seppose to play the path inside the label. I need this program for monday please help me to complete the program I really appreciate if you show me an easy way to do so. I have to explain the codes to my teacher, so you know why I want it to be easy.

    Thanks in Advance

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    OK, there's a couple of things..

    I suspect that your Path stored in the Label contains a Directory Name which has a Space in it, eg. "Program Files", in which case Shell would try to Run the Text upto Program and Treat Files.. Etc as a Command Line. Or, your path doesn't include a File Name.

    2nd, Shell doesn't run Files by Association, this means when you pass it the File with an "rm" extension it will Error.

    What you need to use is the ShellExecute API which will Open a File with its associated Application and also enclose the Path and File name in Quotes, eg.
    Code:
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    
    Private Sub Command1_Click()
        ShellExecute 0, "OPEN", Chr(34) & lblMusic & Chr(34), "", "", 1
    End Sub
    Where lblMusic contains the Full Path and Name of the "rm" File, eg. C:\My Files\Music.rm"

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  3. #3

    Thread Starter
    Hyperactive Member kourosh's Avatar
    Join Date
    Aug 1999
    Location
    Vancouver, British Columbia, Canada
    Posts
    256

    Post

    Thanks alot but the code you provided me with didn't work.


  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    It should work fine as long as lblMusic Contains a Valid Path and File, I tested it with a RealPlayer File.
    Why don't you Post the code you are trying to use and we can take a look.

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  5. #5
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    Some things to look for in a path (On Win32):

    Must Have Back Slashes (\) and not Forward Slashes (/)

    Make sure for the drive letter specification, you are using a colon, and not a semi-colom:
    C:\ - Right
    C;\ - Wrong

    If the file is not an executable (.exe) then you must specify the extension:
    C:\Music\MySong.rm - Right
    C:\Music\MySong - Wrong (if not .exe)

    If there is a space in the path, make sure you include it. (i.e. "C:\My Documents")

    Just take a look at these and hope this might help.

    ------------------
    Tom Young, 14 Year Old
    [email protected]
    ICQ: 15743470
    AIM: TomY10
    PERL, JavaScript and VB Programmer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width