QuickWho

Check-in [f501f1d6aa]
Login

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

Overview
Comment:add quickwho.c for Windows
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f501f1d6aa99a75f720788d5f1e95c8499953e26
User & Date: kevin 2016-04-05 02:58:43
Context
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
2016-04-03
02:23
Changes for Windows port check-in: 12e2a7f0c3 user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added 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;
}