Deprecate FullName.exe
Darcy Shen via Texmacs-dev <[email protected]> Sat, 27 Nov 2021 12:07:01 +0800
| Newsgroups | gmane.editors.texmacs.devel |
|---|---|
| Message-ID | <[email protected]> |
Since SVN revision 13808, we do not need FullName.exe to get the full name of the user any more on Windows.
I tried using GetUserNameEx to get the full name of the login user, but failed.
https://stackoverflow.com/questions/21766954/how-to-get-windows-users-full-name-in-python
And finally, I googled about how to get the full name using Python. Verified with the python snippets in the TeXmacs Python session:
import ctypes
def get_display_name():
GetUserNameEx = ctypes.windll.secur32.GetUserNameExW
NameDisplay = 3
size = ctypes.pointer(ctypes.c_ulong(0))
GetUserNameEx(NameDisplay, None, size)
nameBuffer = ctypes.create_unicode_buffer(size.contents.value)
GetUserNameEx(NameDisplay, nameBuffer, size)
return nameBuffer.value
It turns out that we need to call GetUserNameEx twice to make the C++ code work!!!
Python win32 api seems to be a good way to expore Windows API before coding in C++.
_______________________________________________
Texmacs-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/texmacs-dev