QuickWho

Check-in [2fdbf11fbd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update quickwho.c
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2fdbf11fbd1029d8cfe01f7cf78a1e4607a53c4b
User & Date: kevin 2016-04-05 03:25:35
Context
2016-04-06
03:29
Additional refinements for Windows build check-in: d9c371b7b0 user: kevin tags: trunk
2016-04-05
03:25
Update quickwho.c check-in: 2fdbf11fbd user: kevin tags: trunk
02:58
add quickwho.c for Windows check-in: f501f1d6aa user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to quickwho.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <Python.h>
#include <Windows.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <tchar.h>
 
int main(int argc, char *argv[])
{
   
    Py_SetProgramName(argv[0]);
    Py_Initialize();

     TCHAR exedir [MAX_PATH];

  
  #if 0 
  GetModuleFileName(NULL, exedir, MAX_PATH);
  _tprintf("%s\n", exedir);
  PathRemoveFileSpec(exedir);
  _tprintf("%s\n", exedir);
  #endif

   /*Get the module's full path, and set to the current working directory.*/
  if (!GetModuleFileName(NULL, exedir, MAX_PATH)) {

    TCHAR errmsg[512];
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0, GetLastError(),0,errmsg,1024,NULL);

    _tprintf( TEXT("The path is %s, and the error is %s\n"), exedir, errmsg );
  }


  if (!PathRemoveFileSpec(exedir)) {

    TCHAR errmsg[512];
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0, GetLastError(),0,errmsg,1024,NULL);
    _tprintf( TEXT("The target dir is %s, and the error is %s\n"), exedir, errmsg );
  }

  if (!SetCurrentDirectory(exedir)) {

    TCHAR errmsg[512];
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0, GetLastError(),0,errmsg,1024,NULL);
    _tprintf( TEXT("The working dir is %s, and the error is %s\n"), exedir,errmsg );
  }

 
    PyRun_SimpleString("execfile(\"QuickWho.py\")");
    Py_Finalize();
 
    return 0;
}
|
















|

|








|







|






|



|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <C:/Users/kevin/AppData/Local/Programs/Python/Python35/include/Python.h>
#include <Windows.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <tchar.h>
 
int main(int argc, char *argv[])
{
   
    Py_SetProgramName(argv[0]);
    Py_Initialize();

     TCHAR exedir [MAX_PATH];

  
  #if 0 
  GetModuleFileName(NULL, exedir, MAX_PATH);
  _tprintf("%s/n", exedir);
  PathRemoveFileSpec(exedir);
  _tprintf("%s/n", exedir);
  #endif

   /*Get the module's full path, and set to the current working directory.*/
  if (!GetModuleFileName(NULL, exedir, MAX_PATH)) {

    TCHAR errmsg[512];
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0, GetLastError(),0,errmsg,1024,NULL);

    _tprintf( TEXT("The path is %s, and the error is %s/n"), exedir, errmsg );
  }


  if (!PathRemoveFileSpec(exedir)) {

    TCHAR errmsg[512];
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0, GetLastError(),0,errmsg,1024,NULL);
    _tprintf( TEXT("The target dir is %s, and the error is %s/n"), exedir, errmsg );
  }

  if (!SetCurrentDirectory(exedir)) {

    TCHAR errmsg[512];
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0, GetLastError(),0,errmsg,1024,NULL);
    _tprintf( TEXT("The working dir is %s, and the error is %s/n"), exedir,errmsg );
  }

 
    PyRun_SimpleString("exec(open(\"QuickWho.py\").read())");
    Py_Finalize();
 
    return 0;
}