Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

can any one help me

raniarania Member Posts: 35
hy every body
i develop a program that first open a file than i want that opened file to run (that file is an audio file that run on windows media player or any suitable program) i use the command

WinExec("complete path of windows media player", sw_show);

this command call the windows media player but still when it run need to enter the file name another time
is this any solution to use the filename that is openned already without retyping again
please can anyone help me
many thanks in advance
regards
rania

Comments

  • chick80chick80 Member Posts: 349
    : hy every body
    : i develop a program that first open a file than i want that opened file to run (that file is an audio file that run on windows media player or any suitable program) i use the command
    :
    : WinExec("complete path of windows media player", sw_show);
    :

    I think you should also pass the name of the media file to WinExec, like this:

    [code]
    WinExec("c:windowswmplayer.exe filename.wav", sw_show);
    [/code]

    Hope this helps
    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • raniarania Member Posts: 35
    well many thanks for your help
    but that represent a special case(taking into consideration that filename is variable) any time i change the file name i have to edit in the the program and i have to open many file(i have not know their path when i edit the program )so is their a command to open generally without knowing the file name (in program.dsw)and work with [filename] as a variable representing the complete path of the file

    char filename[50];
    WinExec(e:\windowsmedia.exe filename,sw_show);

    please if you get it tell me.
    many thanks again
    rania
  • chick80chick80 Member Posts: 349
    That's not a problem!
    You have 2 ways to do this:

    1) pass the filename to your program's command line (exactly what you do with Media Player command line...) and then you can read it in the lpCommanLine parameter of WinMain

    2) Implement an "Open File" dialog box with the GetOpenFileName command. Check for Common Dialog boxes on MSDN to find more about this.

    Hope this helps
    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _________ < http://forcoder.org /> free video tutorials and ebooks about \ Visual Basic .NET JavaScript C++ C# PHP Python Delphi Scratch Perl R Visual Basic PL/SQL C Java Assembly MATLAB Go Swift Objective-C Ruby Scheme Prolog Lisp Transact-SQL Fortran Clojure COBOL F# LabVIEW ML Awk Ada Julia Hack Bash Rust FoxPro Logo Apex Crystal D Alice VBScript Erlang Dart Scala Lua ABAP Kotlin SAS \ ___

Sign In or Register to comment.