~ubuntu-branches/ubuntu/gutsy/amsn/gutsy

« back to all changes in this revision

Viewing changes to plugins/winutils/winutils.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Theodore Karkoulis
  • Date: 2006-01-04 15:26:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060104152602-ipe1yg00rl3nlklv
Tags: 0.95-1
New Upstream Release (closes: #345052, #278575).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
                File : winutils.cpp
3
 
 
4
 
                Description :   Ariehs library for windows utilities
5
 
 
6
 
                MAN :
7
 
 
8
 
                        NAME :
9
 
                                WinLoadFile - loads a file (can also be a url) with the default application
10
 
 
11
 
                        SYNOPSYS :
12
 
                                WinLoadFile file
13
 
 
14
 
                        DESCRIPTION :
15
 
                                This command loads a file (or url) with the default application.
16
 
 
17
 
 
18
 
                Author : Arieh Schneier ( lio_lion - lio_lion@user.sourceforge.net)
19
 
*/
20
 
 
21
 
//HWND hWnd = Tk_GetHWND(Tk_WindowId((Tk_Window) clientData));
22
 
 
23
 
// Include the header file
24
 
#include "winutils.h"
25
 
 
26
 
static int Tk_WinLoadFile (ClientData clientData,
27
 
                                                                 Tcl_Interp *interp,
28
 
                                                                 int objc,
29
 
                                                                 Tcl_Obj *CONST objv[]) {
30
 
 
31
 
        char * file = NULL;
32
 
 
33
 
 
34
 
        // We verify the arguments, we must have one arg, not more
35
 
        if( objc < 2) {
36
 
                Tcl_AppendResult (interp, "Wrong number of args.\nShould be \"WinLoadFile file\"" , (char *) NULL);
37
 
                return TCL_ERROR;
38
 
        }
39
 
 
40
 
        // Get the first argument string (file)
41
 
        file=Tcl_GetStringFromObj(objv[1], NULL);
42
 
 
43
 
        ShellExecute(NULL,"open", file, NULL, NULL, SW_SHOWNORMAL);
44
 
 
45
 
 
46
 
        return TCL_OK;
47
 
}
48
 
 
49
 
 
50
 
 
51
 
/*
52
 
        Function : Winutils_Init
53
 
 
54
 
        Description :   The Init function that will be called when the extension is loaded to your tk shell
55
 
 
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
58
 
 
59
 
 
60
 
        Return value : TCL_OK in case everything is ok, or TCL_ERROR in case there is an error (Tk version < 8.3)
61
 
 
62
 
        Comments     : 
63
 
 
64
 
*/
65
 
int Winutils_Init (Tcl_Interp *interp ) {
66
 
        
67
 
        //Check TK version is 8.0 or higher
68
 
        if (Tk_InitStubs(interp, "8.3", 0) == NULL) {
69
 
                return TCL_ERROR;
70
 
        }
71
 
        
72
 
        
73
 
        // Create the new command "WinLoadFile" linked to the ShellExecute function
74
 
        Tcl_CreateObjCommand(interp, "WinLoadFile", Tk_WinLoadFile,
75
 
                (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
76
 
        
77
 
        // end
78
 
        return TCL_OK;
79
 
}