FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Like winzip
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Like winzip
Posted: Thu Dec 13, 2007 08:39 AM
Hi everybody,
from explorer a can select multiple files.
When I click right mouse button from one of these selected files a context menu appears. For instance I find "Winzip" item with its own menu.
If I select the voice "Add to myfolder.zip" then winzip start and compress all selected files.
The question is:
In a Fivewin/xHarbour program how can I obtain an array containing these selected files? (simply to display them...)

#include "fivewin.ch"

FUNCTION MAIN( aSelectedFiles )
LOCAL i
FOR i := 1 TO LEN(aSelectedFiles)
MsgInfo[aSelectedFiles[i]
// other complicated processing......

NEXT i


RETURN NIL

Thanks in advance
Marco Boschi
Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Like winzip
Posted: Thu Dec 13, 2007 11:10 AM
Marco,
function Main()

   local n

   for n = 1 to HB_ArgC()
      MsgInfo( HB_ArgV( n ) )
   next

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Like winzip
Posted: Thu Dec 13, 2007 11:18 AM

Antonio,
I've tested.
I see only the firts selected file
Thanks

Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Like winzip
Posted: Thu Dec 13, 2007 11:23 AM

Marco,

Please run your EXE this way:

test.exe one two three

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Like winzip
Posted: Thu Dec 13, 2007 01:35 PM

ine two three if I run from
c:\fwh\samples\test01.exe one two three
but my scenario is different
from explorer - seleccted files right click mouse Open with....selecct program
c:\fwh\samples\test01.exe
I see only "one"

Best regards
Marco

Marco Boschi
info@marcoboschi.it
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Like winzip
Posted: Thu Dec 13, 2007 01:55 PM

Yes. If we drag and drop a bunch of files, we get all of them. But if we use "Openwith" we see only one file.

Regards



G. N. Rao.

Hyderabad, India
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Like winzip
Posted: Thu Dec 13, 2007 01:57 PM

Nageswararao,

> But if we use "Openwith" we see only one file.

Please check HB_ArgC() value in that case

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Like winzip
Posted: Thu Dec 13, 2007 01:59 PM

hb_argc() is ! ( one )

Regards



G. N. Rao.

Hyderabad, India
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Like winzip
Posted: Thu Dec 13, 2007 02:34 PM

With regedit I add this

HKEY_CLASSES_ROOT*\shell\Cataloga\command

"c:\foto\test01.exe" "%L"

If I select one file test01.exe run once
If I select two files test01.exe run twice
and so on...
I want to run once for one or for one thousand files.
Thanks

Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Like winzip
Posted: Thu Dec 13, 2007 03:48 PM

Marco,

It seems as Windows runs the EXE for each supplied file, again and again.

Anyhow it seems as we could code a workaround for this. We need to do some tests

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Like winzip
Posted: Thu Dec 13, 2007 04:04 PM

I found this:

http://www.eggheadcafe.com/forumarchive ... 949448.asp

is the same problem!

I think a little program writte in C ( smaller ) that write in append mode in a temporary file.
Now the problem is
"At the and of this files collection in one single file, how can I run my application?"

dilemma of 5 p.m.
Bye Bye :?: :?:

Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Like winzip
Posted: Thu Dec 13, 2007 04:15 PM

Marco,

The plan is:

  1. The EXE gets called and ONE parameter is supplied from Windows
  2. The EXE checks if another instance of the EXE is already running
  3. If yes, then the parameter is supplied to the first EXE through an exported function ("entry point")
  4. The again invoked EXE quits
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Like winzip
Posted: Fri Dec 14, 2007 09:22 AM

Marco,

We have tried it as we commented it but it does not work properly.

I guess the solution is to use a timer and IsExeRunning() to quit the application if it is already running previously, but before copy in a text file the name of the new file to open. And the timer from the first EXE will open it.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Like winzip
Posted: Fri Dec 14, 2007 10:47 AM

I found that the easier solution is using the "sendto" directory. Any program link placed inside that directory will receive all the selected file names as parameters.

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Like winzip
Posted: Fri Dec 14, 2007 11:02 AM

Mr Enrico

Great. This works.

Now if we are able to add our program name to the RightClick Menu that gives it the final professional look.

Regards



G. N. Rao.

Hyderabad, India