4
Description : Ariehs library for windows utilities
9
WinLoadFile - loads a file (can also be a url) with the default application
15
This command loads a file (or url) with the default application.
18
Author : Arieh Schneier ( lio_lion - lio_lion@user.sourceforge.net)
21
//HWND hWnd = Tk_GetHWND(Tk_WindowId((Tk_Window) clientData));
23
// Include the header file
26
static int Tk_WinLoadFile (ClientData clientData,
29
Tcl_Obj *CONST objv[]) {
34
// We verify the arguments, we must have one arg, not more
36
Tcl_AppendResult (interp, "Wrong number of args.\nShould be \"WinLoadFile file\"" , (char *) NULL);
40
// Get the first argument string (file)
41
file=Tcl_GetStringFromObj(objv[1], NULL);
43
ShellExecute(NULL,"open", file, NULL, NULL, SW_SHOWNORMAL);
52
Function : Winutils_Init
54
Description : The Init function that will be called when the extension is loaded to your tk shell
56
Arguments : Tcl_Interp *interp : This is the interpreter from which the load was made and to
57
which we'll add the new command
60
Return value : TCL_OK in case everything is ok, or TCL_ERROR in case there is an error (Tk version < 8.3)
65
int Winutils_Init (Tcl_Interp *interp ) {
67
//Check TK version is 8.0 or higher
68
if (Tk_InitStubs(interp, "8.3", 0) == NULL) {
73
// Create the new command "WinLoadFile" linked to the ShellExecute function
74
Tcl_CreateObjCommand(interp, "WinLoadFile", Tk_WinLoadFile,
75
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);