B4J Question sh.Initialize with arguments

GDO

Member
Licensed User
Longtime User
Hi,

This code is not working, for me, with long name :

B4X:
Dim    gdo1 As String = File.Combine("C:\Program Files\Windows Photo Viewer", "PhotoViewer.dll")
    
Dim  gdo2 As String = "ImageView_Fullscreen"
    
Dim    gdo3 As String = File.Combine(chemin, nom)
' or      Dim    gdo3 As String = """" & File.Combine(chemin, nom) & """"

Dim sh As Shell
Dim pathToExe As String = File.Combine("C:\Windows\System32", "rundll32.exe")

sh.Initialize("test", pathToExe, Array As String(gdo1, gdo2, gdo3))

sh.Run(-1)

As long as gdo3 is a short name (for example d:\temp\test.jpg) everything is working BUT with a long name (for example d:\te mp\text.jpg or d:\temp\te s t.jpg) it is not working.

Do you know a way to put long name in gdo3 or a way to find short name from long name ?

Thank you.

Same trouble this way :
B4X:
'        Dim l As List
'        l.Initialize()
'        l.Add(gdo1)
'        l.Add(gdo2)
'        l.Add(gdo3)
'        sh.Initialize("test", pathToExe, l)
 
Last edited:

GDO

Member
Licensed User
Longtime User
Not tested but try:
B4X:
sh.InitializeDoNotHandleQuotes("test", pathToExe, Array As String($""${gdo1}""$, gdo2, gdo3))

Not working.
All combinations tested (even with pathToExe) and nothing is working.
:-(

Another idea ?

Thanks for your help.
 
Last edited:
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
The problem may come from Photoviewer.dll more than from Shell.

When I try this:
B4X:
Dim sh As Shell
Dim n As String = File.Combine("C:\Program Files", "Blender Foundation\Blender\2.77\python")
sh.InitializeDoNotHandleQuotes("", "explorer.exe", Array(n))
sh.Run(-1)
It all works fine, even with spaces. Maybe the Photoviewer.dll doesn't accept paths containing spaces? Did you look at the documentation?

Could you try with doubling the double quotes?
B4X:
sh.InitializeDoNotHandleQuotes("test", pathToExe, Array As String($"""${gdo1}"""$, $"""${gdo2}"""$, $"""${gdo3}"""$))

Edit:
Did you try calling directly Photoviewer like this:
B4X:
sh.InitializeDoNotHandleQuotes("test", gdo1, Array(gdo2, $""${gdo3}""$))
 
  • Like
Reactions: GDO
Upvote 0

GDO

Member
Licensed User
Longtime User
The problem may come from Photoviewer.dll more than from Shell.

When I try this:
B4X:
Dim sh As Shell
Dim n As String = File.Combine("C:\Program Files", "Blender Foundation\Blender\2.77\python")
sh.InitializeDoNotHandleQuotes("", "explorer.exe", Array(n))
sh.Run(-1)
It all works fine, even with spaces. Maybe the Photoviewer.dll doesn't accept paths containing spaces? Did you look at the documentation?

Could you try with doubling the double quotes?
B4X:
sh.InitializeDoNotHandleQuotes("test", pathToExe, Array As String($"""${gdo1}"""$, $"""${gdo2}"""$, $"""${gdo3}"""$))

Edit:
Did you try calling directly Photoviewer like this:
B4X:
sh.InitializeDoNotHandleQuotes("test", gdo1, Array(gdo2, $""${gdo3}""$))

Hi,

--> "calling directly Photoviewer" does not work
--> "doubling the double quotes" does not work

--> "Photoviewer.dll doesn't accept paths containing spaces", I think you are right :-(

Googling "Photoviewer.dll in command line" shows me long name is a trouble.

Sorry for the question but thank you for your help.
 
Upvote 0
Top