Howdy, Stranger!

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

Categories

Command line

prtsoftprtsoft Member Posts: 6
Ok...i got Kylix 2 OE. I want to use the TextBrowser example to view HTML files. I want it to run when I select *.htm* The only problem is that i can't read the command line...can someone help...... THNX!


=:@)

Comments

  • ManningManning Member Posts: 1,621
    : Ok...i got Kylix 2 OE. I want to use the TextBrowser example to view HTML files. I want it to run when I select *.htm* The only problem is that i can't read the command line...can someone help...... THNX!

    Use ParamCount to find out how many parameters there are, and then use ParamStr(x) where x is the number of the parameter you want to retrieve. ParamStr(0) is the path and filename of the current binary, so the actual parameters start at 1.
  • dumpsterHumperdumpsterHumper Member Posts: 6
    Can you please include an example...I'm new at this... :)

    Thnx!

  • ManningManning Member Posts: 1,621
    : Can you please include an example...I'm new at this... :)

    Well this code will put the command line parameters into a single string variable. It is untested, but should work.

    [code]
    if (ParamCount > 0) then
    S := ParamStr(1);
    if (ParamCount > 1) then
    for I := 2 to ParamCount do
    S := S + ' ' + ParamStr(I);
    [/code]
  • CoolWriterCoolWriter Member Posts: 72
    Ok, thats pretty good. But a different question comes from me: How can we set this "HTML Editor" as a default text editor with Delphi code. Imagine that a Settings form. By using this form users can set their default text editor to this "HTML editor". How can we do this?
    (Note: I'm not a native English speaker. So I have some difficulties on telling my question to you. Sorry for that...)
  • CoolWriterCoolWriter Member Posts: 72
    Somebody helps...

  • ManningManning Member Posts: 1,621
    [b][red]This message was edited by the Manning at 2002-6-6 7:12:45[/red][/b][hr]
    : Ok, thats pretty good. But a different question comes from me: How can we set this "HTML Editor" as a default text editor with Delphi code. Imagine that a Settings form. By using this form users can set their default text editor to this "HTML editor". How can we do this?
    : (Note: I'm not a native English speaker. So I have some difficulties on telling my question to you. Sorry for that...)
    :

    All that information is kept in the registry. Here are the entries my movie player has:

    [code]
    HKEY_CLASSES_ROOTApplicationsMannMovie.exeshellopencommand
    Default (String) = "C:PASCALMANNMOVIEMANNMOVIE.EXE" "%1"
    [/code]

    That "sets up" my application. Now we can set up the file extensions we want to open with MannMovie:

    [code]
    HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.avi
    Application (String) = "MannMovie.exe"
    HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.mpeg
    Application (String) = "MannMovie.exe"
    HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.mpg
    Application (String) = "MannMovie.exe"
    [/code]

    I have many more associations, but Im sure 3 is more than enough for you to see how it works, since they are almost identical.

    If you open up REGEDIT you can browse to the following keys and look around to see exactly how they look. You obviously wont have the MannMovie entry, but there should be plenty of others.


  • CoolWriterCoolWriter Member Posts: 72
    Thanks a lot. That solves the problem.
  • Andre YoungAndre Young USAMember Posts: 0

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

Sign In or Register to comment.