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

0 Members and 1 Guest are viewing this topic.

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Dialog rc To source code utility
« on: January 11, 2017, 05:09:20 PM »
It has been an interesting few weeks. This project actually started out to be a PowerBASIC DDT to CWindow converter written in PBWin 10 using a pcre com class wrapper I wrote several years ago.
I lost interest for a couple of reasons. Bob had a VERY flexible syntax, with many items optional or ignored altogether, making the pcre rules difficult. It could have been done but I had no use for it so I bailed.
While still in the parsing mood I decided to create a utility that takes a dialog resource script and generates bc9Basic/CWindow/TCLib source. As I never do anything in moderation I added conversions for bc9Basic/TCLib, bc9Basic SDK, FreeBasic/CWindow, FreeBasic SDK, C++/TCLib (for Fred), C/C++ SDK, PowerBASIC/CWindow (PbWin10), PowerBASIC SDK (PbWin 9/10) and Oxygen Basic.
Throughout development only dialog resource scripts created with ResEd 2.2.8.0 were tested.
http://jcfuller.github.io/bc9Basic/Tools/ResEd.zip
Help File:
http://jcfuller.github.io/bc9Basic/Tools/ResEd.chm

I started with the Visual Studio 2015 Community C++ compiler but discovered I did not have a pcre static library.
NUWEN distro to the rescue. Many fine libraries included but not without a price. A huge exe of 1.5 meg was brought down to a somewhat reasonable size of 500k with UPX but there were issues. The Open File Dialog has noticeable delays so I am not using UPX. I know 64bit is listed as experimental.

Only 64bit OS Vista+ supported.

I have mixed feelings about reource dialogs versus CWindow and SDK windows.
At the beginning of the bc9Basic CWindow port (from José's FreeBasic version) I was under the impression only an sdk approach would give satisfactory display results on hi dpi monitors not set to the default setting.
I have found this is not quite true. If one adds a dpi aware section to your manifest you no longer get fuzzy text.

Also, apps using resource dialogs are smaller than their SDK counterparts.


Here is the link:

https://sourceforge.net/projects/bc9basic/files/Tools/Dlg2Src/Dlg2Src.zip/download

James

Edit:
Because of some false browser malware site protection issues I have posted ResEd and it's help file to my bc9Basic github site:
http://jcfuller.github.io/bc9Basic/Tools/ResEd.zip
http://jcfuller.github.io/bc9Basic/Tools/ResEd.chm
change above also

James

 
« Last Edit: March 22, 2018, 02:11:51 PM by James C. Fuller »

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: Dialog rc To source code utility
« Reply #1 on: January 11, 2017, 08:31:22 PM »
Quote
Also, apps using resource dialogs are smaller than their SDK counterparts.

By me, SDK always produce {much} smaller code size, than using a resource dialogs.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Re: Dialog rc To source code utility
« Reply #2 on: January 12, 2017, 12:03:45 AM »
Patrice,
  :) I doubt you have ever created a resource dialog for use with c++

Maybe comparing PB SDK to DDT but not SDK windows to a resource dialog.

See how small you can get this.
88k here with Visual Studio 2015.
Code: [Select]
//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
//                   This source created by dlg2src
//                           Target: C/C++
//------------------------------------------------------------------------------
//              link with kernel32 user32 gdi32 comctl32 libraries
//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
#ifndef UNICODE
#define UNICODE
#endif
#ifndef _UNICODE
#define _UNICODE
#endif

#include <windows.h>
#include <commctrl.h>
#pragma comment(lib,"kernel32.lib")
#pragma comment(lib,"user32.lib")
#pragma comment(lib,"gdi32.lib")
#pragma comment(lib,"comctl32.lib")
#include <tchar.h>
//==============================================================================
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
//==============================================================================
HFONT Create_Font (const _TCHAR* szFaceName, long lPointSize)
{
    LOGFONT  tlf = {0};
    HDC      hdc = {0};
    hdc = GetDC( HWND_DESKTOP);
    tlf.lfHeight = - MulDiv( lPointSize, GetDeviceCaps( hdc, LOGPIXELSY), 72);
    tlf.lfWidth = 0;
    tlf.lfEscapement = 0;
    tlf.lfOrientation = 0;
    tlf.lfWeight = 0;
    tlf.lfItalic = 0;
    tlf.lfUnderline = 0;
    tlf.lfStrikeOut = 0;
    tlf.lfCharSet = ANSI_CHARSET;
    tlf.lfOutPrecision = OUT_TT_PRECIS;
    tlf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
    tlf.lfQuality = DEFAULT_QUALITY;
    tlf.lfPitchAndFamily = FF_DONTCARE;
    _tcscpy(tlf.lfFaceName, szFaceName);
    ReleaseDC(HWND_DESKTOP, hdc);
    return (HFONT)CreateFontIndirect( &tlf);
}
//==============================================================================
void Center_Win (HWND hwnd)
{
    RECT     WndRect = {0};
    long     x = {0};
    long     y = {0};
    GetWindowRect(hwnd, &WndRect);
    x = ( GetSystemMetrics( SM_CXSCREEN) - ( WndRect.right - WndRect.left)) / 2;
    y = ( GetSystemMetrics( SM_CYSCREEN) - ( WndRect.bottom - WndRect.top + GetSystemMetrics( SM_CYCAPTION))) / 2;
    SetWindowPos(hwnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
//==============================================================================
void SetClientSize (HWND hwnd, long nWidth, int nHeight)
{
    RECT     rc = {0};
    RECT     rcTemp = {0};
    SetRect( &rc, 0, 0, nWidth, nHeight);
    HANDLE   hMenu = GetMenu(hwnd);
    DWORD    dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
    AdjustWindowRectEx( &rc, dwStyle, (hMenu != NULL), GetWindowLongPtr(hwnd, GWL_EXSTYLE));
    if(hMenu != NULL )
    {
        rcTemp = rc;
        rcTemp.bottom = 0x7FFF;
        SendMessage(hwnd, (UINT)WM_NCCALCSIZE, (WPARAM)0, (LPARAM)&rcTemp);
        rc.bottom +=   rcTemp.top;
    }
    if((dwStyle & WS_HSCROLL) == WS_HSCROLL )
    {
        rc.bottom = rc.bottom + GetSystemMetrics( SM_CYHSCROLL);
    }
    if((dwStyle & WS_VSCROLL) == WS_VSCROLL )
    {
        rc.right = rc.right + GetSystemMetrics( SM_CXVSCROLL);
    }
    long     cx = rc.right - rc.left;
    long     cy = rc.bottom - rc.top;
    SetWindowPos(hwnd, NULL, 0, 0, cx, cy, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
}
//==============================================================================
#define IDD_DLG1 1000
#define IDC_INDEX1 1001
#define IDC_INDEX2 1002
#define IDC_COMPANY1 1003
#define IDC_COMPANY2 1004
#define IDC_FIRST 1005
#define IDC_FIRSTNAME 1006
#define IDC_LAST 1007
#define IDC_LASTNAME 1008
#define IDC_ADDRESS1 1009
#define IDC_ADDRESS2 1010
#define IDC_CITY1 1011
#define IDC_CITY2 1012
#define IDC_COUNTY 1034
#define IDC_COUNTY2 1013
#define IDC_STATE1 1014
#define IDC_STATE2 1015
#define IDC_ZIP1 1016
#define IDC_ZIP2 1017
#define IDC_PHONE11 1018
#define IDC_PHONE12 1019
#define IDC_PHONE21 1020
#define IDC_PHONE22 1021
#define IDC_EMAIL1 1022
#define IDC_EMAIL2 1023
#define IDC_URL1 1024
#define IDC_URL2 1025
#define IDC_PRIOR 1026
#define IDC_NEXT 1027
#define IDC_FIND 1028
#define IDC_ADD 1029
#define IDC_UPDATE 1030
#define IDC_DELETE 1031
#define IDC_PRINT 1032
#define IDC_CLOSE 1033
//==============================================================================
int WINAPI _tWinMain (HINSTANCE hInst, HINSTANCE hPrev, LPWSTR CmdLine, int CmdShow)
{
    HWND     hWin = {0};
    HWND     hCtl = {0};
    WNDCLASSEX  wcx = {0};
    MSG      uMsg = {0};
    HFONT    hFont = {0};
    _TCHAR     szClassName[] = _T("CSdkWindow");
    INITCOMMONCONTROLSEX  icc = {0};
    icc.dwSize = sizeof( icc);
    icc.dwICC = ICC_NATIVEFNTCTL_CLASS | ICC_COOL_CLASSES | ICC_BAR_CLASSES | ICC_TAB_CLASSES |
                ICC_USEREX_CLASSES | ICC_WIN95_CLASSES | ICC_STANDARD_CLASSES | ICC_ANIMATE_CLASS |
                ICC_DATE_CLASSES | ICC_HOTKEY_CLASS |   ICC_LISTVIEW_CLASSES |
                ICC_PAGESCROLLER_CLASS | ICC_PROGRESS_CLASS | ICC_TREEVIEW_CLASSES | ICC_UPDOWN_CLASS;
    InitCommonControlsEx( &icc);
    wcx.cbSize = sizeof( wcx);
    wcx.style = CS_HREDRAW | CS_VREDRAW;
    wcx.lpfnWndProc = WndProc;
    wcx.cbClsExtra = 0;
    wcx.cbWndExtra = 0;
    wcx.hInstance = hInst;
    wcx.hIcon = LoadIcon( NULL, IDI_APPLICATION);
    wcx.hCursor = LoadCursor( NULL, IDC_ARROW);
    wcx.hbrBackground = ( HBRUSH)( COLOR_BTNFACE + 1);
    wcx.lpszMenuName = 0;
    wcx.lpszClassName = szClassName;
    wcx.hIconSm = LoadIcon( NULL, IDI_APPLICATION);
    if(!RegisterClassEx( &wcx))
    {
        MessageBox (GetActiveWindow(), _T("RegisterClassEx Failed"),_T("ERROR"), MB_ICONERROR);
        return 0;
    }
    hFont = Create_Font(_T("Tahoma"),10);
    hWin = CreateWindowEx(0,szClassName,_T("Address Book"),0x10CA0800,0,0,254,245,0,(HMENU) 0,hInst,NULL);
    SetClientSize(hWin,445,490);
    hCtl = CreateWindowEx(0,_T("Static"),_T("Record No."),0x50000000,275,10,89,16,hWin,(HMENU)IDC_INDEX1,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("0  /  0"),0x50001201,361,8,70,20,hWin,(HMENU)IDC_INDEX2,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("Company"),0x50000000,9,48,105,16,hWin,(HMENU)IDC_COMPANY1,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,44,263,24,hWin,(HMENU)IDC_COMPANY2,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("First Name"),0x50000000,9,76,105,16,hWin,(HMENU)IDC_FIRST,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,72,263,24,hWin,(HMENU)IDC_FIRSTNAME,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("Last Name"),0x50000000,9,104,105,16,hWin,(HMENU)IDC_LAST,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,100,263,24,hWin,(HMENU)IDC_LASTNAME,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("Address"),0x50000000,9,132,105,16,hWin,(HMENU)IDC_ADDRESS1,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,128,263,24,hWin,(HMENU)IDC_ADDRESS2,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("City"),0x50000000,9,160,105,16,hWin,(HMENU)IDC_CITY1,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,156,263,24,hWin,(HMENU)IDC_CITY2,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("County"),0x50000000,9,188,105,16,hWin,(HMENU)IDC_COUNTY,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,184,263,24,hWin,(HMENU)IDC_COUNTY2,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("State"),0x50000000,9,216,105,16,hWin,(HMENU)IDC_STATE1,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,212,51,24,hWin,(HMENU)IDC_STATE2,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("Zip"),0x50000000,9,244,105,16,hWin,(HMENU)IDC_ZIP1,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,240,100,24,hWin,(HMENU)IDC_ZIP2,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("Phone #1"),0x50000000,9,272,105,16,hWin,(HMENU)IDC_PHONE11,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,268,121,24,hWin,(HMENU)IDC_PHONE12,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("Phone #2"),0x50000000,9,300,105,16,hWin,(HMENU)IDC_PHONE21,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,296,121,24,hWin,(HMENU)IDC_PHONE22,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("Email"),0x50000000,9,328,105,16,hWin,(HMENU)IDC_EMAIL1,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,324,263,24,hWin,(HMENU)IDC_EMAIL2,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Static"),_T("WWW"),0x50000000,9,356,105,16,hWin,(HMENU)IDC_URL1,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0x00000200,_T("Edit"),_T(""),0x50010000,119,352,263,24,hWin,(HMENU)IDC_URL2,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Button"),_T("<< Prior"),0x50010000,46,406,70,28,hWin,(HMENU)IDC_PRIOR,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Button"),_T("Next >>"),0x50010000,140,406,70,28,hWin,(HMENU)IDC_NEXT,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Button"),_T("Find"),0x50010000,235,406,70,28,hWin,(HMENU)IDC_FIND,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Button"),_T("Add"),0x50010000,331,406,70,28,hWin,(HMENU)IDC_ADD,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Button"),_T("Update"),0x50010000,46,442,70,28,hWin,(HMENU)IDC_UPDATE,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Button"),_T("Delete"),0x50010000,140,442,70,28,hWin,(HMENU)IDC_DELETE,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Button"),_T("Print"),0x50010000,235,442,70,28,hWin,(HMENU)IDC_PRINT,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    hCtl = CreateWindowEx(0,_T("Button"),_T("Close"),0x50010000,331,442,70,28,hWin,(HMENU)IDC_CLOSE,hInst,NULL);
    SendMessage(hCtl,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)0);
    Center_Win(hWin);
    ShowWindow(hWin, SW_SHOW);
    while(GetMessage( &uMsg, NULL, 0, 0))
    {
        if(IsDialogMessage(hWin, &uMsg))
        {
            continue;
        }
        TranslateMessage( &uMsg);
        DispatchMessage( &uMsg);
    }
    DeleteObject((HFONT)hFont);
    return uMsg.wParam;
}
//==============================================================================
LRESULT CALLBACK WndProc (HWND hWnd, UINT Msg, WPARAM  wParam, LPARAM  lParam)
{
    switch(Msg)
    {
    case WM_COMMAND:
        if(LOWORD(wParam) == IDCANCEL && HIWORD(wParam) == BN_CLICKED )
        {
            SendMessage(hWnd, (UINT)WM_CLOSE, (WPARAM)0, (LPARAM)0);
        }
        return 0;
    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;
    }
    return DefWindowProc(hWnd, Msg, wParam, lParam);
}



8k with a resource dialog using Fred's TCLib.

Code: [Select]
$NOMAIN
$CPP
$ONEXIT "ULEX.EXE $FILE$.CPP TCHARXLATER_VC.TXT"
$ONEXIT "TCLIB.BAT $FILE$"   
$HEADER
    #pragma comment(lib,"gdi32.lib")       
$HEADER

CONST IDD_DLG1 = 1000
CONST IDC_INDEX1 = 1001
CONST IDC_INDEX2 = 1002
CONST IDC_COMPANY1 = 1003
CONST IDC_COMPANY2 = 1004
CONST IDC_FIRST = 1005
CONST IDC_FIRSTNAME = 1006
CONST IDC_LAST = 1007
CONST IDC_LASTNAME = 1008
CONST IDC_ADDRESS1 = 1009
CONST IDC_ADDRESS2 = 1010
CONST IDC_CITY1 = 1011
CONST IDC_CITY2 = 1012
CONST IDC_COUNTY2 = 1013
CONST IDC_STATE1 = 1014
CONST IDC_STATE2 = 1015
CONST IDC_ZIP1 = 1016
CONST IDC_ZIP2 = 1017
CONST IDC_PHONE11 = 1018
CONST IDC_PHONE12 = 1019
CONST IDC_PHONE21 = 1020
CONST IDC_PHONE22 = 1021
CONST IDC_EMAIL1 = 1022
CONST IDC_EMAIL2 = 1023
CONST IDC_URL1 = 1024
CONST IDC_URL2 = 1025
CONST IDC_PRIOR = 1026
CONST IDC_NEXT = 1027
CONST IDC_FIND = 1028
CONST IDC_ADD = 1029
CONST IDC_UPDATE = 1030
CONST IDC_DELETE = 1031
CONST IDC_PRINT = 1032
CONST IDC_CLOSE = 1033


'==============================================================================
Function WinMain()
    Dim As int RetVal
    RetVal = DialogBoxParam(hInst,MAKEINTRESOURCE(IDD_DLG1),0,(DLGPROC)DlgProc,0)
    If  RetVal = -1 Then
        MsgBox("BAD")
        Function = EXIT_FAILURE
    EndIf

    Function = EXIT_SUCCESS
End Function
'==============================================================================
DlgCallBack DlgProc()
    Select Case CBMSG
        Case WM_COMMAND
            Select Case CBCTL
                Case IDCANCEL
                    EndDialog(CBHNDL,0)
            End Select
    End Select
End Function
'==============================================================================


James

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: Dialog rc To source code utility
« Reply #3 on: January 12, 2017, 08:51:56 AM »
My remark was based on a Theme aware Media Foundation example written by Microsoft from the latest SDK, that is using the VS resource editor.
The binary code size is 162 Kb.
Once translated to SDK it goes down to 122 Kb.
The name of the code source is MFplayer.sln, and it can be found in the SDK\samples\multimedia\mediafoundation\MFPLayer2

I must say that there are also a couple of small bitmaps embedded altogether with the RC for menu and dialog components.

Anyway, RC is useless for what i am doing myself to gain full control of my window, and especially when you need to change things on the fly without recompiling the code.

 
« Last Edit: January 12, 2017, 09:00:36 AM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Re: Dialog rc To source code utility
« Reply #4 on: January 12, 2017, 12:00:23 PM »
Patrice,
  I know you have no personal use or interest but your opinion is highly respected.
I have conducted alot of trials with different compilers and I have yet to find one that produces smaller code than Visual c++ in conjunction with Fred's TCLib using resource dialogs as the display medium.
  That said I am not a TINY fanatic. I REALLY like José's CWindow framework and the 20k or so overhead is well worth it, but, I have always used a WYSIWYG window designer going all the way back to my dos and Win 3.1 days. Now I can have both.

James



Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: Dialog rc To source code utility
« Reply #5 on: January 12, 2017, 12:53:43 PM »
James

I have never been able to use TCLib within a standard VS 2015 Window project (no console).
If you have a SDK one, i would be glad to try it.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Re: Dialog rc To source code utility
« Reply #6 on: January 12, 2017, 01:16:51 PM »
Dlg2Src is updated with new link in first post.

James

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Re: Dialog rc To source code utility
« Reply #7 on: January 12, 2017, 02:10:54 PM »
James

I have never been able to use TCLib within a standard VS 2015 Window project (no console).
If you have a SDK one, i would be glad to try it.

...

See: http://www.jose.it-berater.org/smfforum/index.php?topic=5180.0

James

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: Dialog rc To source code utility
« Reply #8 on: January 17, 2017, 10:23:31 PM »
I did try to use TClib with a full SDK version of Address, and the resulting size looks very good.
Need to find a good replacement for vector in order to manage the dynamic array...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Re: Dialog rc To source code utility
« Reply #9 on: January 17, 2017, 11:52:39 PM »
I did try to use TClib with a full SDK version of Address, and the resulting size looks very good.
Need to find a good replacement for vector in order to manage the dynamic array...
There is one over on PellesC froum someplace. If you don't find it I'll take a look tomorrow .
http://forum.pellesc.de/index.php

James

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: Dialog rc To source code utility
« Reply #10 on: January 18, 2017, 10:22:15 AM »
My idea was to use: new + delete[]
to allocate dynamically the global array.

But if there is something already written to add, remove, erase, that would save my time.
The only other thing that could enlarge the code is the use of printing.

I wrote a couple of TRIM functions that do not require the use of the string class, and thus keep the code size small, currently 22 Kb.

If you want i can post the VS2015 project in its current unfinished state.
(And tell me in which thread to post it).

...

« Last Edit: January 18, 2017, 10:25:02 AM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Re: Dialog rc To source code utility
« Reply #11 on: January 18, 2017, 10:53:38 AM »
Patrice,
  Yes Thanks. Put it in the Discussion Section.
I like Fred's String class and just made a conversion (StringA.cpp) to ansi only I needed. My ansi sections in TCLib\tchar.h is not up to date.
James

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Re: Dialog rc To source code utility
« Reply #12 on: March 04, 2017, 06:25:53 PM »
Because of some false browser malware site protection issues I have posted ResEd and it's help file to my bc9Basic github site:
http://jcfuller.github.io/bc9Basic/ResEd.zip
http://jcfuller.github.io/bc9Basic/ResEd.chm

Also I recompiled with VS2015 using STL regex and reduced the size considerably so you may want to re-download. Same code just different compilers.

The first Post has been updated also.
James

Offline Frederick J. Harris

  • Hero Member
  • *****
  • Posts: 914
  • User-Rate: +16/-0
    • Frederick J. Harris
Re: Dialog rc To source code utility
« Reply #13 on: March 06, 2017, 04:13:36 PM »
My intention was to code a replacement for C++ vectors for use with TCLib, but I've got so much going on in my life right now I don't know when I'll get to it.

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: Dialog rc To source code utility
« Reply #14 on: March 07, 2017, 09:26:04 AM »
Why TClib helps to produce very small piece of code, its current status is too limited to produce real life application.

I did try to use it to produce 64-bit OpenGL visual plugins, but the lack of very basic math functions forced me to switch back to the classic <math.h>.
Thus my question is, do you know if there is a much ellaborated math.h include file that could be used with it?
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com