Thank you! that worked perfectly.
This is in a legacy program.
In the global embeds, inside the global map:
MODULE('shell32.dll')
FindExecutableA(*cstring,*cstring,*cstring),LONG, PASCAL, RAW, NAME('FindExecutableA')
END
Several sources recommend to use FindExecutableW instead of FindExecutableA, don’t bother, it doesn’t work with Clarion.
You will need some local variabes:
l:File CSTRING(2049)
l:Directory CSTRING(2049)
l:Result CSTRING(2049)
L:Executable STRING(256)
L:Status LONG
And, assign your variables to the call:
L:File = clip(YourfFlenameOnly)
L:directory = clip(YourPathOnly)
L:Status = FindExecutableA(L:File,L:Directory,L:Result)
L:Executable = st.FilenameOnly(L:Result)
I used Capesoft’s StringTheory to quickly get the filename only, from the result, as it is returned with fully path. You can, of course, use your own code or other tool for that.
That’s it!
Then you can, for example:
if lower(clip(L:Executable)) = 'mspaint.exe' then
!Do whatever
end
Kind regards,
Jorge Lavera