I’m trying to set the text on the ‘save’ button of the Windows ‘Save file as…’ dialog.
I’ve set up the hook, received the message, found the button (nb. If I call ‘GetWindowText()‘ I see ‘&Save’ so I know it’s the right button).
Next I changed the text using ‘SetWindowText()‘ (and called ‘GetWindowText()‘ to check it – the text is correct).
But … the button still says ‘Save’.
I can change the ‘Cancel’ button using the exact same code – no problem. What’s so special about the ‘Save’ button? How can I change it.
Code (for what it’s worth):
static UINT_PTR CALLBACK myHook(HWND hwnd, UINT msg, WPARAM, LPARAM) { if (msg == WM_INITDIALOG) { wchar_t temp[100]; HWND h = GetDlgItem(GetParent(hwnd),IDOK); GetWindowTextW(h,temp,100); // temp=='&Save' SetWindowTextW(h,L'Testing'); GetWindowTextW(h,temp,100); // temp=='Testing' } }
I finally made it work….
I’m pretty sure there’s something funny going on with the ‘Save’ button but this code will wrestle it into submission: