Like winzip

User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Like winzip

Post by MarcoBoschi »

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
// other complicated processing......

NEXT i


RETURN NIL

Thanks in advance
Marco Boschi
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marco,

Code: Select all

function Main()

   local n

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

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Post by MarcoBoschi »

Antonio,
I've tested.
I see only the firts selected file
Thanks
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marco,

Please run your EXE this way:

test.exe one two three
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Post by MarcoBoschi »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

hb_argc() is ! ( one )
Regards

G. N. Rao.
Hyderabad, India
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Post by MarcoBoschi »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Post by MarcoBoschi »

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 :?: :?:
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

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
Post Reply