I have pretty much went as far as I intend to go with Res2Dlg. Menus were too much of a bother in the end and all of the resource types that interest me are included. For the remaining types without previews I have either left it like that or used the Windows shell to open them with the default application. The source code has been uploaded to my site as well as a text file that explains pretty much how to add resource types if anyone is interested. The source is largely uncommented but pretty clear and very modular so it shouldn't be a problem for someone to add to it. At any rate it is far more practical than the first Res2Dlg, and since I only needed it to extract toolbars (for tbpaint) it is much larger than even I expected it to be. I'll continue to do bug fixes and maybe the occasional addition if I need one for other projects.
Posted on 2003-09-10 11:29:57 by donkey
For anyone who is interested this is a standalone version of Re2Dlg for anyone who wants it for the resource editor. You can use it to create DLG files from executables (and dll's) so you can import dialogs from other applications.
Posted on 2003-09-11 11:10:51 by donkey
I downloaded your executable version of Res2Dlg and started to play with it.
First I tried to open comdlg32.dll from my Windows\System directory (on Win98). Res2Dlg complained, that the file is being used and it may cause a GPF. Anyway, after continuing it loaded the library and displayed the list of resources. I selected the first dialog ("CHOOSECOLOR"), clicked Preview. The preview window flashed and... nothing was displayed.
"Hmm", I thought to myself, "maybe that's because of the warning I got when trying to open this dll". I copied comdlg32.dll to another folder (where RadResource.exe was placed) and tried to open the dll. To my astonishment, Res2Dlg displayed the message: "This file uses an unrecognized format, it may be compressed or encrypted". Well, neither was the case, because a moment ago I opened this file with Res2Dlg from the system folder! Then I tried to rename comdlg32.dll to komdlg32.dll and load it, but I got the same message ("This file uses an unrecognized...").
My next thought was to try Res2Dlg as RadASM addin (not the standalone version), to see if it behaves the same. Well, unfortunately, it does (version 2.0.0.7).

I searched my harddisk for an older version of Res2Dlg.dll - I found version 2.0.0.2. I put it to RadASM addins folder, loaded RadASM up, selected Res2Dlg from Projects menu and... ...guess what - it works. Seems to me you messed up with your resource loader/enumerator or whatever it is. Version 2.0.0.7 complains about many dlls (including system dlls, which are not compressed nor encrypted), and when it does not complain - it simply does not display any dialog preview or the preview is broken (only a part of the dialog is displayed):

image at the top is from ResHacker, at the bottom - from Res2Dlg
library loaded - comctl32.ocx, dialog #300
Posted on 2003-09-14 06:11:04 by Morris
Two more things:

1. Res2Dlg 2.0.0.7 crashes on a dialog with SysIPAddress (there's been a fix for that, right?). Anyway, since you provided the source code for the addin, I changed something and it does not crash on that control anymore. The change was very simple - from GWL_USERDATA to GWL_ID. Since Res2Dlg is not a dialog editor (it just displays dialogs), you do not care about the control ID, do you? After this change, there's no crash :)

2. After the dialog is displayed in the preview window, a first control on it gets keyboard focus. I think you should disable this - by simply returning FALSE from WM_INITDIALOG.
Posted on 2003-09-14 06:27:32 by Morris
Hi Morris,

I'll find the problem with the preview. The extraction still works fine but for some reason, probably an alignment thing, the dialogs in common dialogs don't preview. The engine for that section remains unchanged so it can't be a big thing. The ID's of the control are probably the most important thing there is, with common dialogs you must know the ID numbers of the controls or the resulting dialog is useless. At any rate I will look into the problems when I have some time.
Posted on 2003-09-14 09:38:54 by donkey
Hi again Morris,

The problem with the common dialogs not displaying and the weird framing seem to be related. There is something up with the alignment of the structures, I have to strip the WS_CHILD style from a dialog before I display it so it is displayed as non-modal and does not hang the addin. This appears to be failing, that indicates that I am not removing the right bit, since it is the style bits I am adjusting I presume that the problem is related to the border one. I will hex dump the results of a few dialogs and find the problem.

For the display probelm the following change was needed, the WS_POPUP style needed to be stripped as well in the CreateMemDialog procedure:
...

pop eax
and eax,0BFFFFFFFh ; Remove the WS_CHILD style
and eax,07FFFFFFFh ; Remove the WS_POPUP style
mov [edi],eax
...

Also I see what you mean about the GWL_USERID, good idea. I had thought that Windows might truncate the value if I exceed 65535 (Maximum ID#) but apparently it doesn't care.
Posted on 2003-09-14 10:25:58 by donkey
The border problem (comctl32.ocx) is related to the fact that I did not add enough to the dialog size. ResHacker is wrong in it's display of that dialog, it has no caption in the file itself so I do not display one. However it does demonstrate to me a problem in recalculating the size without a caption and I will fix it.

It's been fixed.
Posted on 2003-09-14 11:13:46 by donkey
Okey Dokey,

The file will be loaded silently if it is already opened by another process. This doesn't seem to effect anything in Win98SE and Win2K/Xp will return a handle anyway so it is not an issue in those OSes. However, without a file handle it is not possible to verify if the file is compressed. The ocx file comdlg32.ocx has a very bizarre resource section, for some reason it is not aligned on a page boundary and that was the reason for the compression message with that particular one. The compression dialog now allows you to attempt a load regardless of the determination of the detection algorithm. I will try to find another data block that will support OCX files. The previews of SysIPAddress32 have been fixed using Morris's suggestion. The preview of child dialogs without a caption have their sizes properly adjusted now. The source is not uploaded yet but the DLL is on my site.
Posted on 2003-09-14 14:11:28 by donkey
Here's the new stand alone with the changes made, source is included:

There was a small problem with the bitmap save routine due to some changes to the resource handler, it's been fixed.
Posted on 2003-09-14 15:42:02 by donkey