OSDN Git Service

nvda.pyw: duplicate getInputDesktopName from nvda_service so that it does not have...
authorMichael Curran <mick@kulgan.net>
Wed, 30 Mar 2011 00:57:31 +0000 (10:57 +1000)
committerMichael Curran <mick@kulgan.net>
Wed, 30 Mar 2011 00:57:31 +0000 (10:57 +1000)
source/nvda.pyw

index 3a80a84..5ecc38c 100755 (executable)
@@ -110,10 +110,17 @@ elif globalVars.appArgs.check_running:
        # NVDA is not running.\r
        sys.exit(1)\r
 \r
+UOI_NAME = 2\r
+def getInputDesktopName():\r
+       desktop = ctypes.windll.user32.OpenInputDesktop(0, False, 0)\r
+       name = ctypes.create_unicode_buffer(256)\r
+       ctypes.windll.user32.GetUserObjectInformationW(desktop, UOI_NAME, ctypes.byref(name), ctypes.sizeof(name), None)\r
+       ctypes.windll.user32.CloseDesktop(desktop)\r
+       return name.value\r
+\r
 #Ensure multiple instances are not fully started by using a mutex\r
-from nvda_service import getInputDesktopName\r
 ERROR_ALREADY_EXISTS=0XB7\r
-desktopName=getInputDesktopName().split("\\")[1]\r
+desktopName=getInputDesktopName()\r
 mutex=ctypes.windll.kernel32.CreateMutexW(None,True,u"Local\\NVDA_%s"%desktopName)\r
 if not mutex or ctypes.windll.kernel32.GetLastError()==ERROR_ALREADY_EXISTS:\r
        if mutex: ctypes.windll.kernel32.CloseHandle(mutex)\r