Last active
December 17, 2015 22:49
-
-
Save peterooch/5684859 to your computer and use it in GitHub Desktop.
A function to add the unicode description string in the status bar of the charmap of ReactOS.
Ready for comments and suggestions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void UpdateStatusBar(WORD wch) // The function gets a Unicode value | |
{ | |
LPWSTR szCharDesc; | |
GetUName(wch,szCharDesc); //Gets the Character's Description String | |
WCHAR buff[sizeof szCharDesc + 30]; | |
wcscpy(buff,"U+%X: %s", wch, szCharDesc); //Putting it in a nice string | |
SendMessage(hStatusWnd,WM_SETTEXT,SB_SIMPLE,(LPARAM)buff); // push it to the status bar | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HINSTANCE hgetuname = NULL; | |
typedef int (*getUName) (WORD, LPWSTR); | |
getUName GetUName; | |
BOOL gunis; | |
hgetuname = LoadLibrary("getuname.dll"); | |
if(hgetuname != NULL) | |
{ | |
GetUName = (getUName)GetProcAddress(hgetuname,"GetUName"); | |
if (GetUName == NULL) | |
{ | |
FreeLibrary(hgetuname); | |
gunis = FALSE; | |
} | |
else | |
gunis = TRUE; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* reworked */ | |
VOID | |
UpdateStatusBar(WORD wch) // The function gets a Unicode value | |
{ | |
HINSTANCE hgetuname = NULL; | |
int (FAR STDAPICALLTYPE * GetUName) (WORD wCharCode, LPWSTR lpbuf); | |
BOOL gunis = FALSE; | |
hgetuname = LoadLibraryW(L"getuname.dll"); | |
if(hgetuname != NULL) | |
{ | |
(FARPROC&)GetUName = GetProcAddress(hgetuname,"GetUName"); | |
if (GetUName == NULL) | |
{ | |
FreeLibrary(hgetuname); | |
gunis = FALSE; | |
} | |
else | |
gunis = TRUE; | |
} | |
if(gunis) | |
{ | |
LPWSTR szCharDesc = NULL; | |
int res = GetUName(wch,szCharDesc); //Gets the Character's Description String | |
WCHAR buff[256]; | |
_swprintf(buff,L"U+%04X: %s", wch, szCharDesc); //Putting it in a nice string | |
SendMessageW(hStatusWnd,WM_SETTEXT,0,(LPARAM)buff); | |
FreeLibrary(hgetuname); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment