ExecFile
BlitzMax Forums/BlitzMax Beginners Area/ExecFile| 
 | ||
| Hello I it is necessary to open url file. I do so: 
Import "-lshell32"
Extern
	Function ShellExecute:Int(hwnd:Int,operation:Byte Ptr,file:Byte Ptr,parameters:Byte Ptr,directory:Byte Ptr,showcmd:Int) = "ShellExecuteA@24"
End Extern
Function ExecFile:Int(file:String,params:String="",defaultdir:String="")
	Print  ShellExecute(0,"OPEN",file.ToCString(),params.ToCString(),defaultdir.ToCString(),0) > 32
	Return False
End Function
ExecFile("test.url")
But this code does not open the label :(. Exe files he starts orderly | 
| 
 | ||
| hmmm... not sure what your problem is. It certainly opens a url in the default browser for me (I created my own via rightclick->new->shortcut). | 
| 
 | ||
| not work :( 
Import "-lshell32"
Extern
	Function ShellExecute:Int(hwnd:Int,operation:Byte Ptr,file:Byte Ptr,parameters:Byte Ptr,directory:Byte Ptr,showcmd:Int) = "ShellExecuteA@24"
End Extern
Function ExecFile:Int(file:String,params:String="",defaultdir:String="")
	Print  ShellExecute(0,"OPEN",file.ToCString(),params.ToCString(),defaultdir.ToCString(),0) > 32
	Return False
End Function
Print "Start exec"
ExecFile("test.url")
Print "End exec"
output: Building test Compiling:test.bmx flat assembler version 1.51 3 passes, 2741 bytes. Linking:test.exe Executing:test.exe Start exec 0 Process complete | 
| 
 | ||
| I get: Building urltest Executing:urltest.debug.exe 1 Process complete | 
| 
 | ||
| I get the same as Proger. It doesn't open the default browser. Perhaps it would if IE was my default browser? I don't know. Definitely can't be relied on though. |