#1
  1. Introspective
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    3,317
    Rep Power
    110

    DLL's, storing user options, and TOpenDialog


    Hi chaps,

    Just for the fun of it, I wrote my first ever Delphi app last week. It's a file uploader (see here) . I admit that it's just a wrapper for pscp.exe and there's lots missing, hence the following questions:

    o Is there a more elegant way of calling pscp instead of using CreateProcess?. I would like to be able to use a dll instead and report upload progress through the application UI instead of a popup .exe screen. Any ideas on how this could be done?

    o Users can only select multiple files at the moment. I have considered changing the function used here to "SelectDirectory" with a checkbox option to upload recursively. However, the ultimate solution would allow either a directory selection OR a multiple file selection. Is there a graceful way of calling a single dialog which would allow this?

    o The app builds a remove path as /home/<username>. The user has the option of changing the path if required. A better plan would allow user options to save a 'default path', a 'pscp.exe location', a 'default hostname' etc and load it in every time the app runs. I intend to store this data on a user-based config file, but can't decide where to put it (assuming user is on WinXP). What's the usual protocol here?

    I'll have plenny more naff questions over the next couple weeks

    Cheers
    christo
    This is me: http://chris.uk.com
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    Let's see if I can answer your questions without looking at the source .

    1. There's always ShellExecute() and WinExec().
    http://msdn.microsoft.com/library/de...ellexecute.asp
    http://msdn.microsoft.com/library/de...se/winexec.asp
    I think I posted some examples of ShellExecute in this forum a couple of weeks ago, so you should have some examples for reference .
    As for part two, does pscp come with a DLL? If not, you can always try hiding the DOS window (Call ShellExecute() with SW_HIDE as the last argument)

    2. I guess you'd have to write your own dialog then, instead of using the Windows standard dialog. The trouble is that the File Selection dialog that Windows provides doesn't allow directory selection .

    3. Best (and most standard) place to put it would be the Windows Registry. Since you're just starting with Delphi and Windoze programming, don't worry about this yet. However, when you feel ready to muck about in the registry, simply look at the Delphi help for TRegistry, which encapsulates a lot of the registry manipulation functions.
    Last edited by Scorpions4ever; July 5th, 2004 at 01:27 AM.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo