Recent Posts

Pages: [1] 2 3 ... 10
1
Bug Reports / Re: SetDialogScale(hWnd, 0); added
« Last post by jcfuller on February 20, 2024, 07:08:04 AM »
Crap!
It appears I did it again and did not explain myself fully.
I have no reason to believe your fix will not work. On the contrary it will work for c++ but will not for "c" coding.

I am on a new coding rig (my old Gaming box) and cannot compile a new bc.exe at present.

The "BEGIN DIALOG AS DlgProcName" is not searchable in the help file and it took me a bit to find it this am. I am aware now it is part of the BCX_DIALOG coding. As such the adding of the "SetDialogScale(hWnd, 0);" is NOT a BUG.

I am probably the only one who wants to use it with a resource dialog so I will find my own way around it.
Sorry for the inconvenience.

James
 
2
Bug Reports / Re: SetDialogScale(hWnd, 0); added
« Last post by MrBcx on February 19, 2024, 02:02:08 PM »
Well, my suggested change to BCX worked for me.

Your code runs using MSVC and Mingw. 

See attached scrnshot.

3
Bug Reports / Re: SetDialogScale(hWnd, 0); added
« Last post by jcfuller on February 19, 2024, 01:46:01 PM »
That's a negatory. Fails with Pelles also after removing c++ stuff
It appears you cannot use "Begin Dialog As DlgProc" with a resource dialog.
For a real hack if you switch    case WM_INITDIALOG with case WM_INITDLG it works
       
James

Code: [Select]
$NOMAIN
$ONEXIT "ASTYLE.EXE -pn $FILE$.C"
$ONEXIT "PEL.BAT $FILE$ -m64 gui"

CONST MANIFEST                24
CONST IDD_DLG1                1000
CONST IDC_BTN1                1003
CONST IDC_BTN2                1004
CONST IDC_BTN3                1005
CONST IDC_STC1                1001
CONST IDC_STC2                1002
CONST IDR_XPMANIFEST1         1
CONST CTLHNDL(id) = GetDlgItem(hWnd,id)
CONST WM_INITDLG = WM_INITDIALOG
'==============================================================================
Function WinMain()
    Local As HWND hDlg
    Local As MSG Msg
Local As HFONT hFont
Dim As HWND hCtl
    hDlg = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_DLG1),0,(DLGPROC)DlgProc,0)
    While GetMessage(&Msg,NULL, 0, 0)
        If (IsDialogMessage(hDlg, &Msg) = 0) Then
            TranslateMessage(&Msg)
            DispatchMessage(&Msg)
        End If
    Wend
   
    Function = Msg.wParam   
End Function
'==============================================================================
Begin Dialog As DlgProc


    Select Case (CBMSG)
    'This is added automagically by BCX
    'case WM_CLOSE
        '    DestroyWindow(CBHWND)
    case WM_INITDIALOG
    'case WM_INITDLG
    BCX_SET_FONT(CTLHNDL(IDC_STC2),"Tahoma",14)
    BCX_SET_FONT(CTLHNDL(IDC_STC1),"Tahoma",14)
    BCX_SET_FONT(CTLHNDL(IDC_BTN1),"Tahoma",12)
    BCX_SET_FONT(CTLHNDL(IDC_BTN2),"Tahoma",12)
    BCX_SET_FONT(CTLHNDL(IDC_BTN3),"Tahoma",12)
    case WM_DESTROY
            PostQuitMessage(0)
            Function = 0   
    case WM_COMMAND
            Select Case(CBCTL)
            case IDC_BTN3
                    PostMessage(CBHWND,WM_CLOSE,0,0)
                    CloseDialog
            End Select
    End Select
End Dialog

4
Bug Reports / Re: SetDialogScale(hWnd, 0); added
« Last post by MrBcx on February 19, 2024, 12:03:45 PM »
James,

It seems this code in BCX:

Code: [Select]
    IF InDialogEvt OR ModDialogEvt THEN
        IF iMatchNQ(Arg$, "WM_INITDIALOG") THEN
            CALL AddExpressionToStack(Arg$)
            CALL AddExpressionToStack("SetDialogScale(hWnd,0)")
            GOTO ProcessNew
        END IF
    END IF

is responsible for the issue that you're seeing.

A possible fix would be to add a C++ test to that block:

Code: [Select]
    IF (InDialogEvt OR ModDialogEvt) and UseCpp = FALSE THEN
      .
      .
    END IF

This might have unintended consequences in other apps but I seriously doubt it.
5
Bug Reports / SetDialogScale(hWnd, 0); added
« Last post by jcfuller on February 19, 2024, 10:51:13 AM »
Kevin,
  SetDialogScale(hWnd, 0);
  is added to the cpp translation when a
  case WM_INITDIALOG is added to the bcx source
  Comment the WM_INITDIALOG and it is not added
  This is an rc dialog app. you will need to compile and include the res in the construction.
James

Code: [Select]
$CPP
$CPPHDR
$NOMAIN
$ONEXIT "ASTYLE.EXE -pn $FILE$.CPP"
$ONEXIT "VSCPP.BAT $FILE$ -m64 con"

$CCODE CONST
  using namespace std;
$CCODE

CONST MANIFEST                24
CONST IDD_DLG1                1000
CONST IDC_BTN1                1003
CONST IDC_BTN2                1004
CONST IDC_BTN3                1005
CONST IDC_STC1                1001
CONST IDC_STC2                1002
CONST IDR_XPMANIFEST1         1
CONST CTLHNDL(id) = GetDlgItem(hWnd,id)
$PP
'$USE USE_IMATCH USE_bc9StrParseCount USE_SetColor USE_CLIPBOARD
'$Include <BCppXLib.bi>
'==============================================================================
Function WinMain()
    Local As HWND hDlg
    Local As MSG Msg
Local As HFONT hFont
Dim As HWND hCtl
    hDlg = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_DLG1),0,(DLGPROC)DlgProc,0)
    While GetMessage(&Msg,NULL, 0, 0)
        If (IsDialogMessage(hDlg, &Msg) = 0) Then
            TranslateMessage(&Msg)
            DispatchMessage(&Msg)
        End If
    Wend
   
    Function = Msg.wParam   
End Function
'==============================================================================
Begin Dialog As DlgProc


    Select Case (CBMSG)
    'This is added automagically by BCX
    'case WM_CLOSE
        '    DestroyWindow(CBHWND)
    case WM_INITDIALOG
    ' BCX_SET_FONT(CTLHNDL(IDC_STC2),"Tahoma",11)
    case WM_DESTROY
            PostQuitMessage(0)
            Function = 0   
    case WM_COMMAND
            Select Case(CBCTL)
            case IDC_BTN3
                    PostMessage(CBHWND,WM_CLOSE,0,0)
                    CloseDialog
            End Select
           
    End Select
End Dialog
$PP
'==============================================================================
cpp Source
Code: [Select]
// *************************************************
//      Made with BCX BASIC To C/C++ Translator
//            Version 8.0.8 (12/27/2023)
// *************************************************
//    Translated for compiling with a C++ Compiler
// *************************************************

#ifndef __cplusplus
#error A C++ compiler is required
#endif

#ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif

#if defined(__cplusplus)
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
typedef std::string stdstr;
#endif


#include <windows.h>    // WinApi
#include <windowsx.h>   // WinApi
#include <commctrl.h>   // WinApi
#include <commdlg.h>    // WinApi
#include <direct.h>     // WinApi
#include <mmsystem.h>   // WinApi
#include <oaidl.h>      // WinApi
#include <objbase.h>    // WinApi
#include <ocidl.h>      // WinApi
#include <ole2.h>       // WinApi
#include <oleauto.h>    // WinApi
#include <olectl.h>     // WinApi
#include <richedit.h>   // WinApi
#include <shellapi.h>   // WinApi
#include <shlobj.h>     // WinApi
#include <urlmon.h>     // WinApi
#include <wchar.h>      // WinApi
#include <wctype.h>     // WinApi
#include <tchar.h>      // WinApi
#include <unknwn.h>     // WinApi
#include <wingdi.h>     // WinApi
#include <wininet.h>    // WinApi
#include <winsock.h>    // WinApi
#include <winuser.h>    // WinApi
#include <stdbool.h>    // ISO StdLib
#include <ctype.h>      // ISO StdLib
#include <math.h>       // ISO StdLib
#include <setjmp.h>     // ISO StdLib
#include <stdarg.h>     // ISO StdLib
#include <stddef.h>     // ISO StdLib
#include <stdio.h>      // ISO StdLib
#include <stdlib.h>     // ISO StdLib
#include <string.h>     // ISO StdLib
#include <time.h>       // ISO StdLib
#include <process.h>    // ISO StdLib
#include <inttypes.h>   // ISO StdLib
#include <fcntl.h>      // POSIX
#include <io.h>         // WinNT POSIX subset
#include <conio.h>      // Primitive i/o


// *************************************************
//            System Defined Macros
// *************************************************

#define BCXSTRSIZE 2048

// *************************************************
//             User Defined Macros
// *************************************************

using namespace std;
#define MANIFEST 24
#define IDD_DLG1 1000
#define IDC_BTN1 1003
#define IDC_BTN2 1004
#define IDC_BTN3 1005
#define IDC_STC1 1001
#define IDC_STC2 1002
#define IDR_XPMANIFEST1 1
#define CTLHNDL(id) GetDlgItem(hWnd,id)

// *************************************************
//                  Compiler Macros
// *************************************************

#if defined(__cplusplus)
#define overloaded
#define C_EXPORT EXTERN_C __declspec(dllexport)
#define C_IMPORT EXTERN_C __declspec(dllimport)
#else
#define C_EXPORT __declspec(dllexport)
#define C_IMPORT __declspec(dllimport)
#endif

// *************************************************
//                   Microsoft VC++
// *************************************************

#ifndef DECLSPEC_UUID
#if(_MSC_VER >= 1100) && defined(__cplusplus)
#define DECLSPEC_UUID(x)  __declspec(uuid(x))
#else
#define DECLSPEC_UUID(x)
#endif
#endif
#if (_MSC_VER >= 1900)            // earlier versions untested
#include <intrin.h>
#ifndef _rdtsc
#define _rdtsc __rdtsc   // MSVC uses 2 underscores
#endif
#pragma warning(disable: 4018) // signed/unsigned mismatch warnings
#pragma warning(disable: 4100) // unreferenced argument warnings
#pragma warning(disable: 4244) // conversion from type1 to type2 warnings
#pragma warning(disable: 4267) // conversion from type1 to type2 warnings
#pragma warning(disable: 4305) // truncation from double to float warnings
#pragma warning(disable: 4800) // forcing value to bool warnings
#pragma warning(disable: 4838) // conversion from type1 to type2 warnings
#endif

// *************************************************
//                  GCC and CLANG
// *************************************************

#if defined(__GNUC__) || defined(__clang__)
#ifndef __BCPLUSPLUS__
#include <x86intrin.h>
#endif
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wdangling-else"
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif

// *************************************************
//                  Embarcadero C++
// *************************************************

#if defined(__BCPLUSPLUS__)
#if defined (_clang__)
#include <mmintrin.h>
#endif
#define _kbhit kbhit
#ifndef _rdtsc
#define _rdtsc __rdtsc  // Uses 2 underscores
#endif
#endif


// *************************************************
// Instruct Linker to Search Object/Import Libraries
// *************************************************

#if !defined(__GNUC__) && !defined(__TINYC__)
#if !(defined(__BCPLUSPLUS__) && defined(_WIN64))
#pragma comment(lib,"kernel32.lib")
#pragma comment(lib,"user32.lib")
#pragma comment(lib,"gdi32.lib")
#pragma comment(lib,"comctl32.lib")
#pragma comment(lib,"advapi32.lib")
#pragma comment(lib,"winspool.lib")
#pragma comment(lib,"shell32.lib")
#pragma comment(lib,"msimg32.lib")
#pragma comment(lib,"ole32.lib")
#pragma comment(lib,"oleaut32.lib")
#pragma comment(lib,"uuid.lib")
#pragma comment(lib,"odbc32.lib")
#pragma comment(lib,"odbccp32.lib")
#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"comdlg32.lib")
#pragma comment(lib,"imagehlp.lib")
#pragma comment(lib,"version.lib")
#pragma comment(lib,"wininet.lib")
#pragma comment(lib,"urlmon.lib")
#endif
#endif


// *************************************************
//               Standard Macros
// *************************************************


// *************************************************
//               User's Prototypes
// *************************************************

int     WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int);
INT_PTR CALLBACK DlgProc (HWND, UINT, WPARAM, LPARAM);

// *************************************************
//            User's Global Initialized Arrays
// *************************************************


// *************************************************
//                 Runtime Functions
// *************************************************

// *************************************************
//            User's Subs and Functions
// *************************************************

int WINAPI WinMain (HINSTANCE  hInst, HINSTANCE  hPrev, LPSTR  CmdLine, int CmdShow)
{
    HWND     hDlg = {0};
    MSG      Msg = {0};
    HFONT    hFont = {0};
    HWND     hCtl = {0};
    hDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DLG1), 0, (DLGPROC)DlgProc, 0);
    while(GetMessage(&Msg, NULL, 0, 0)) {
        if((IsDialogMessage(hDlg, &Msg) == 0)) {
            TranslateMessage(&Msg);
            DispatchMessage(&Msg);
        }
    }
    return Msg.wParam;
}


INT_PTR CALLBACK DlgProc (HWND hWnd, UINT Msg, WPARAM  wParam, LPARAM  lParam)
{
    if((Msg) == WM_INITDIALOG ) {
        SetDialogScale(hWnd, 0);
        goto L1001;
    }
    if((Msg) == WM_DESTROY ) {
        PostQuitMessage(0);
        return 0;
    }
    if((Msg) == WM_COMMAND ) {
        if((LOWORD(wParam)) == IDC_BTN3 ) {
            PostMessage(hWnd, WM_CLOSE, 0, 0);
            DestroyWindow(hWnd);
        }
    }
L1001:
    ;
    if(Msg == WM_CLOSE) DestroyWindow(hWnd);
    return EXIT_SUCCESS;
}



 
James

6
Questions & Answers / Re: How can I change the default BED help file (.chm) reader in BED?
« Last post by djsb on February 10, 2024, 04:50:39 PM »
I may have sorted it now. The Comodo Antivirus was putting hh.dat into auto containment as it recognised it as suspicious for some reason. hh.exe is used to open any .chm files.
7
Is there any way I can change BED to enable me to select Sumatra pdf reader as the chm file reader?

Not easily.  It would require a code change, a full recompile of BED, and testing.

I've used Sumatra in the past and it is a fine bit of software but coupling it to BED to launch
BcxHelp.chm while retaining BED's F1 lookup capability would require some experimentation.

If I were you, I'd be more interested in discovering why overwriting an old version of BCXHelp.chm
inside \Bed\Help\ is not working on your computer.  Seems fishy to me ...

8
Questions & Answers / How can I change the default BED help file (.chm) reader in BED?
« Last post by djsb on February 10, 2024, 01:35:39 PM »
I'm having problems when trying to open the BCXHelp.chm file? The default windows reader for some reason will not show the pages properly, and I can only see the left-hand tabs. When I click on the tab contents, nothing shows up in the main window. I have previously checked the properties of the help file and clicked "unblocked" and this has cured the problem. However, on the latest downloaded version the files has not been blocked by windows, so I can't unblock it. I have also checked the permissions for this file and checked my antivirus in case it has blocked the file. Still no joy. I have found an open source chm reader (https://www.sumatrapdfreader.org/free-pdf-reader) and it opens the file properly. Windows has associated the Sumatra pdf reader as the default .chm reader. But on trying to open the BCXHelp.chm file from within BED the default reader is invoked which I don't want. Is there any way I can change BED to enable me to select Sumatra pdf reader as the chm file reader? Thanks.

PS. Project on Github https://github.com/sumatrapdfreader/sumatrapdf/tree/master
9
Questions & Answers / Re: Split a resized bitmap
« Last post by MrBcx on February 10, 2024, 10:42:16 AM »
when resizing images with BCX_BITMAP it is better to keep the same width/height ratio as the original image!

Thank you for the update and for sharing the above pearl of wisdom!
10
Questions & Answers / Re: Split a resized bitmap
« Last post by Pietro54 on February 10, 2024, 07:44:01 AM »
Hi

I did some testing with bitmap images and in the end I realized that there is only one solution: when resizing images with BCX_BITMAP it is better to keep the same width/height ratio as the original image!
In this way the functions that access the BCX_BITMAP work quite well although I still encountered strange results with particular ratio values (not well definable).

Just knowing that the problem is there....

PS. I attach an example where everything works well.
Pages: [1] 2 3 ... 10