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
$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
// *************************************************
// 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