1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[misc] use GetWindowLongPtr/SetWindowLongPtr everywhere

* Also remove WS_EX_RIGHT style from IDC_PERSISTENCE_SIZE since we apply it manually
This commit is contained in:
Pete Batard 2018-08-20 09:46:23 +01:00
parent efcdbe30e5
commit 619dd9862b
4 changed files with 22 additions and 20 deletions

View file

@ -824,7 +824,8 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hDC;
HFONT hf;
long lfHeight, style;
LONG lfHeight;
LONG_PTR style;
DWORD log_size;
char *log_buffer = NULL, *filepath;
EXT_DECL(log_ext, "rufus.log", __VA_GROUP__("*.log"), __VA_GROUP__("Rufus log"));
@ -849,12 +850,12 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
// the displayed text becomes a mess due to Windows trying to interpret
// dots, parenthesis, columns and so on in an RTL context...
// We also take this opportunity to fix the scroll bar and text alignment.
style = GetWindowLong(hLog, GWL_EXSTYLE);
style = GetWindowLongPtr(hLog, GWL_EXSTYLE);
style &= ~(WS_EX_RTLREADING | WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR);
SetWindowLong(hLog, GWL_EXSTYLE, style);
style = GetWindowLong(hLog, GWL_STYLE);
SetWindowLongPtr(hLog, GWL_EXSTYLE, style);
style = GetWindowLongPtr(hLog, GWL_STYLE);
style &= ~(ES_RIGHT);
SetWindowLong(hLog, GWL_STYLE, style);
SetWindowLongPtr(hLog, GWL_STYLE, style);
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.2.1377"
CAPTION "Rufus 3.2.1378"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -47,7 +47,7 @@ BEGIN
LTEXT "Image option",IDS_IMAGE_OPTION_TXT,8,65,216,8
COMBOBOX IDC_IMAGE_OPTION,8,74,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "",IDC_PERSISTENCE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,125,76,34,8
EDITTEXT IDC_PERSISTENCE_SIZE,160,74,36,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
EDITTEXT IDC_PERSISTENCE_SIZE,160,74,36,12,ES_AUTOHSCROLL | ES_NUMBER
COMBOBOX IDC_PERSISTENCE_UNITS,200,74,24,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,8,87,96,8
COMBOBOX IDC_PARTITION_TYPE,8,96,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -392,8 +392,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,2,1377,0
PRODUCTVERSION 3,2,1377,0
FILEVERSION 3,2,1378,0
PRODUCTVERSION 3,2,1378,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -411,13 +411,13 @@ BEGIN
VALUE "Comments", "https://akeo.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.2.1377"
VALUE "FileVersion", "3.2.1378"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus-3.2.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.2.1377"
VALUE "ProductVersion", "3.2.1378"
END
END
BLOCK "VarFileInfo"

View file

@ -506,7 +506,7 @@ void ResizeButtonHeight(HWND hDlg, int id)
*/
INT_PTR CALLBACK LicenseCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
long style;
LONG_PTR style;
HWND hLicense;
switch (message) {
case WM_INITDIALOG:
@ -515,12 +515,12 @@ INT_PTR CALLBACK LicenseCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
CenterDialog(hDlg);
ResizeButtonHeight(hDlg, IDCANCEL);
// Suppress any inherited RTL flags
style = GetWindowLong(hLicense, GWL_EXSTYLE);
style = GetWindowLongPtr(hLicense, GWL_EXSTYLE);
style &= ~(WS_EX_RTLREADING | WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR);
SetWindowLong(hLicense, GWL_EXSTYLE, style);
style = GetWindowLong(hLicense, GWL_STYLE);
SetWindowLongPtr(hLicense, GWL_EXSTYLE, style);
style = GetWindowLongPtr(hLicense, GWL_STYLE);
style &= ~(ES_RIGHT);
SetWindowLong(hLicense, GWL_STYLE, style);
SetWindowLongPtr(hLicense, GWL_STYLE, style);
SetDlgItemTextA(hDlg, IDC_LICENSE_TEXT, gplv3);
break;
case WM_COMMAND:
@ -1891,7 +1891,7 @@ static void CALLBACK FormatPromptHook(HWINEVENTHOOK hWinEventHook, DWORD Event,
BOOL found;
if (Event == EVENT_SYSTEM_FOREGROUND) {
if (GetWindowLong(hWnd, GWL_STYLE) & WS_POPUPWINDOW) {
if (GetWindowLongPtr(hWnd, GWL_STYLE) & WS_POPUPWINDOW) {
str[0] = 0;
GetWindowTextU(hWnd, str, sizeof(str));
if (safe_strcmp(str, fp_title_str) == 0) {

View file

@ -643,16 +643,17 @@ void TogglePersistenceControls(BOOL display)
{
RECT rc;
HWND hSize, hUnits;
LONG style, width = fw - bsw - ssw;
LONG_PTR style;
LONG width = fw - bsw - ssw;
hSize = GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE);
hUnits = GetDlgItem(hMainDialog, IDC_PERSISTENCE_UNITS);
style = GetWindowLong(hSize, GWL_EXSTYLE);
style = GetWindowLongPtr(hSize, GWL_EXSTYLE);
if (display)
style |= WS_EX_RIGHT;
else
style &= ~WS_EX_RIGHT;
SetWindowLong(hSize, GWL_EXSTYLE, style);
SetWindowLongPtr(hSize, GWL_EXSTYLE, style);
if (display) {
GetWindowRect(hUnits, &rc);