Re: How to associate a file to an bound exe Euphoria program.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Andrew Katz wrote:
> 
> I wrote an application in Euphoria for MS Windows using Win32lib and the IDE.
> It can load and save files of a particular extension. I would like the ability
> to click on one of these saved files and have my program load this file. I
> already
> know how to open and read a file in Euphoria. 
> 
> What I need is:
> 1. Access to the code that executes on starting up a Euphoria application.
> 2. The format of the passed arguments when a user clicks on a file in Windows
> and how that is seen in Euphoria.
> 
> I guess Derek would know this. And Judith can tell me where in the IDE such
> code can be placed.
> 
> Andy Katz
> B.S. Computer Science, 1978
> Rensselaer Polytechnic Institute (RPI)

Andrew,

Here is what IDE does when the user clicks a file name with .prj extention. Look
in the Eu docs for information about command_line. You also need to have made a
filetype to execution program association in Windows[tm] so clicking the file
knows to start your program. For example C:\Euphoria\BIN\EXW.EXE
C:\EuphoriaMine\IDE\ide.exw %1 will start IDE when filename.prj is clicked.

params = command_line()
        if length(params) > 2 then

            --params might contain valid filename
            params = params[3]

            --get the long name if there is one
            d=dir(params)

            if not atom(d) then
                --find the filename minus path
                for i=length(params) to 1 by -1 do
                    if params[i] = '\\' then
                        params=params[1..i] & d[1][D_NAME]
                        exit
                    end if
                end for
            end if

            if length(params) then
                --read the project
                --open and read file here
            end if
         end if


This code is in the main window w32HActivate event.

Does this answer you question?

judith evans

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu