Author Topic: Dialog rc To source code utility  (Read 9169 times)

0 Members and 1 Guest are viewing this topic.

jcfuller

  • Guest
Dialog rc To source code utility
« on: January 11, 2017, 08:15:30 AM »

Dlg2Src is a Windows 64bit utility that takes a dialog resource script
as it's input and creates SDK source for a number of compiler/translators.

Supported source code generation:
bc9Basic/CWindow/TClib
bc9Basic/TCLib
bc9Basic/SDK
FreeBasic/CWindow
FreeBasic/SDK
C/C++ SDK
C++/TCLib
PowerBASIC/CWindow
PowerBASIC/SDK
Oxygen Basic/SDK

https://sourceforge.net/projects/bc9basic/files/Tools/

James

JRS

  • Guest
Re: Dialog rc To source code utility
« Reply #1 on: January 11, 2017, 09:13:00 AM »
Nice!

I would love to see a VB6 forms file converter doing the same thing.

Arnold

  • Guest
Re: Dialog rc To source code utility
« Reply #2 on: January 11, 2017, 02:36:14 PM »
Hi James,

your Dlg2Src is an interesting utility. Will you provide a 32-bit version too?

I tried out your examples and cardfiles.o2bas work ok. Running cumulus.o2bas and RasAddress.o2bas there is a difference as well in 32-bit as in 64-bit. E.g. in cumulus.o2bas I found these statements:
    hWin = CreateWindowEx(0,"O2SdkWindow","Address Book",&H10CA0800,0,0,254,245,0,0,hInstance,NULL)
    O2SetWindowClientSize(hWin,445,490)
I think this cannot be. The size must be at least 820*768. Is there a bug with converting dialog units to pixels?

Roland

.

jcfuller

  • Guest
Re: Dialog rc To source code utility
« Reply #3 on: January 11, 2017, 03:11:38 PM »
Roland,
  Not sure what the problem is. I only tested 64bit.
The only 32bit I do is PowerBASIC (very little)

James

JRS

  • Guest
Re: Dialog rc To source code utility
« Reply #4 on: January 11, 2017, 07:16:57 PM »
Quote from: Roland
Is there a bug with converting dialog units to pixels?

Getting dialog units to pixels right has been my nemesis for some time. There are so many variables.  (font size / face, DPI, ...)

Mike Lobanovsky

  • Guest
Re: Dialog rc To source code utility
« Reply #5 on: January 11, 2017, 08:56:49 PM »
... E.g. in cumulus.o2bas I found these statements:
    hWin = CreateWindowEx(0,"O2SdkWindow","Address Book",&H10CA0800,0,0,254,245,0,0,hInstance,NULL)
    O2SetWindowClientSize(hWin,445,490) ...

James,

Your clipboard copy/paste seems to be broken. Running several consecutive translations of different .RC sample files in the same instance (session) of DLG2SRC.EXE results in a random mixture of translated statements building up in the clipboard. When pasted into the editor, they produce broken dialogs very clearly depicted in Roland's screenshot.

JRS

  • Guest
Re: Dialog rc To source code utility
« Reply #6 on: January 11, 2017, 11:11:06 PM »
A couple of years ago I played with the idea of taking Rapid-Q forms and converting them to fixed position IUP forms.

HERE  is the thread to that effort.

Arnold

  • Guest
Re: Dialog rc To source code utility
« Reply #7 on: January 11, 2017, 11:55:59 PM »
Hi James,

it seems I applied Murphy's law. This morning I ran Dlg2Src again and only copied cumulus.o2bas. Everything works ok. So I have to start Dlg2Src every time again?

Roland

jcfuller

  • Guest
Re: Dialog rc To source code utility
« Reply #8 on: January 12, 2017, 02:18:02 AM »
Try the attached version.

James

.

Mike Lobanovsky

  • Guest
Re: Dialog rc To source code utility
« Reply #9 on: January 12, 2017, 03:28:46 AM »
Thanks James, this build seems to cure the problem.

Arnold

  • Guest
Re: Dialog rc To source code utility
« Reply #10 on: January 12, 2017, 03:49:42 AM »
Hi James,

continuous copying and pasting works for me now too.

I would like to ask a question about the window styles which seem to be hard-coded in the rc files. I can load your rc files with ResEd.exe and see and save the styles like this:

...
CAPTION "Weather Information"
FONT 10,"Tahoma",400,0,0
STYLE WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|DS_CENTER
BEGIN
  CONTROL "Outdoor",IDC_GRP1,"Button",WS_CHILDWINDOW|WS_VISIBLE|BS_FLAT|BS_GROUPBOX,16,10,122,134
  CONTROL "Temp",IDC_STC1,"Static",WS_CHILDWINDOW|WS_VISIBLE,28,28,38,10
...

but this is not accepted with Dlg2Src.exe. What must I change in ResEd.exe to get the same rc file as you?

Roland

jcfuller

  • Guest
Re: Dialog rc To source code utility
« Reply #11 on: January 12, 2017, 03:59:01 AM »
Roland,
 RTFM :)
It is in the readme.txt file

All styles and exStyles MUST use hex:
Menu->Option->Options->Behaviour
Make sure the Styles as hex is checked.

James

jcfuller

  • Guest
Re: Dialog rc To source code utility
« Reply #12 on: January 12, 2017, 04:01:35 AM »
Mike,
  Thanks for the input but clipboard was fine.
  I didn't clear a couple of global(shame on me) vectors.

James

Arnold

  • Guest
Re: Dialog rc To source code utility
« Reply #13 on: January 12, 2017, 04:33:46 AM »
Thank you James. Although I read the readme.txt last night, it seems I already drifted off. But now I understand.

Mike Lobanovsky

  • Guest
Re: Dialog rc To source code utility
« Reply #14 on: January 12, 2017, 05:30:10 AM »
... clipboard was fine.
  I didn't clear a couple of global(shame on me) vectors.

That's what I thought too, in hindsight, but was already too sleepy to add to my original message. :)