Author Topic: Removing persistent auto selecting of edit boxes within GetSaveFileNameA dialog  (Read 67 times)

vornez

  • Regular Member
  • *
  • Posts: 1
Removing persistent auto selecting of edit boxes within GetSaveFileNameA dialog. (commdlg.h)

On Windows 7, this dialog is poorly coded, The wheel scroller rarely works, it persistently highlights the filename
edit box, when focus is lost and gained, every time the dialog starts up.

If the filename already exists, after it's told you about that, it then rehighlights the filename field, then removes keyboard
focus away from that edit box. You then have to click on it twice.

This problem causes hundreds of extra mouse clicks per day, which is resulting in more repetitive strain in clicking the mouse.

So I'm removing all EM_SETSEL (0x000000B1) messages from comdlg32.dll.

Anyway changing out EM_SETSEL (B1) to EM_SETMARGINS (D3) will work. You just need to edit comdlg32.dll from another installed windows operating system. Also change out the security permissions.

:6F07FEAF 6AFF                    push FFFFFFFF
:6F07FEB1 6A00                    push 00000000
:6F07FEB3 68B1000000              push 000000B1 <- change to D3
:6F07FEB8 53                      push ebx

* Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:6F07FFC1(U)
|
:6F07FEB9 57                      push edi

* Reference To: USER32.SendDlgItemMessageW, Ord:0273h
                                  |
:6F07FEBA FF15E011056F            Call dword ptr [6F0511E0]


:6F0683D3 6AFF                    push FFFFFFFF
:6F0683D5 6A00                    push 00000000
:6F0683D7 68B1000000              push 000000B1
:6F0683DC 83C1A4                  add ecx, FFFFFFA4
:6F0683DF E8D4E5FEFF              call 6F0569B8
:6F0683E4 50                      push eax

* Reference To: USER32.SendMessageW, Ord:027Ch
                                  |
:6F0683E5 FF153012056F            Call dword ptr [6F051230]

The only problem is even if I change all 68B1 entries, only the first initdialog auto selecting is removed, I can't remove the auto selecting when a file already exists dialog shows.

jj2007

  • Member
  • *****
  • Posts: 11317
  • Assembler is fun ;-)
    • MasmBasic
Hi vornez,

First things first: welcome to the forum :thup:

This is interesting stuff, but I have a few points to ask:

- You modify %WinDir%\System32\comdlg32.dll; afaik Windows doesn't like that, and corrects such attempts. How do you deal with that problem?

- Wouldn't it be easier to change a few bytes in the loaded dll?

- I am on Windows 7-64, and I so far I never had the problems you mentioned. I attach a demo, can you tell me if you see the behaviour you mentioned above?

Here is the source of the demo:

Code: [Select]
GuiMenu equ @File, &Open, &Save, -, E&xit, @Edit, Undo, Copy, Paste
include \masm32\MasmBasic\Res\MbGui.asm
  GuiControl MyEdit, "RichEdit", wCL$(), bcol LiteBlueGreen
Event Command
  Switch_ MenuID
  Case_ 0
  .if FileOpen$("Rich sources=*.rtf;*.asc|All sauces=*.as?;*.inc|All files=*.*")
SetWin$ hMyEdit=FileRead$(FileOpen$())
  .endif
  Case_ 1 ; standard GetSaveFileName dialog
  .if FileSave$("Rich sources=*.rtf;*.asc|All sauces=*.as?;*.inc|All files=*.*")
MsgBox 0, Cat$("Saving "+FileSave$()+CrLf$+"is not yet implemented"), "Hi", MB_OK
  .endif
  Case_ 1: invoke SendMessage, hGui, WM_CLOSE, 0, 0
  Endsw_
GuiEnd