Page 1 of 2
Like winzip
Posted: Thu Dec 13, 2007 8:39 am
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
Posted: Thu Dec 13, 2007 11:10 am
by Antonio Linares
Marco,
Code: Select all
function Main()
local n
for n = 1 to HB_ArgC()
MsgInfo( HB_ArgV( n ) )
next
return nil
Posted: Thu Dec 13, 2007 11:18 am
by MarcoBoschi
Antonio,
I've tested.
I see only the firts selected file
Thanks
Posted: Thu Dec 13, 2007 11:23 am
by Antonio Linares
Marco,
Please run your EXE this way:
test.exe one two three
Posted: Thu Dec 13, 2007 1:35 pm
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
Posted: Thu Dec 13, 2007 1:55 pm
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.
Posted: Thu Dec 13, 2007 1:57 pm
by Antonio Linares
Nageswararao,
> But if we use "Openwith" we see only one file.
Please check HB_ArgC() value in that case
Posted: Thu Dec 13, 2007 1:59 pm
by nageswaragunupudi
hb_argc() is ! ( one )
Posted: Thu Dec 13, 2007 2:34 pm
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
Posted: Thu Dec 13, 2007 3:48 pm
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
Posted: Thu Dec 13, 2007 4:04 pm
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
Posted: Thu Dec 13, 2007 4:15 pm
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
Posted: Fri Dec 14, 2007 9:22 am
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.
Posted: Fri Dec 14, 2007 10:47 am
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
Posted: Fri Dec 14, 2007 11:02 am
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.