José,
This PbWin10 SDK code does not truncate the window on my Win10 64 machine.
'======================================================================
' Declares
'----------------------------------------------------------------------
#COMPILE EXE
'----------------------------------------------------------------------
#IF %PB_REVISION < &H1000 ' if compiler PBWIN9 or earlier
%USEMACROS = 1
#ENDIF
#INCLUDE "WIN32API.INC"
'----------------------------------------------------------------------
%IDC_EDIT100 = 100
'======================================================================
FUNCTION WINMAIN (BYVAL hInst AS DWORD, BYVAL hPrevInstance AS DWORD, _
BYVAL lpszCmdLine AS ASCIIZ PTR, BYVAL nCmdShow AS LONG) AS LONG
'----------------------------------------------------------------------
' Program entrance
'----------------------------------------------------------------------
LOCAL hDlg AS DWORD, hCtl AS DWORD, hFont AS DWORD, _
sBuf AS STRING, wc AS WndClassEx, szClassName AS ASCIIZ * 80
hFont = GetStockObject(%DEFAULT_GUI_FONT)
szClassName = "MyClassName"
wc.cbSize = SIZEOF(wc)
wc.style = %CS_HREDRAW OR %CS_VREDRAW
wc.lpfnWndProc = CODEPTR(WndProc)
wc.cbClsExtra = 0
wc.cbWndExtra = 0
wc.hInstance = hInst
wc.hIcon = LoadIcon (%NULL, BYVAL %IDI_APPLICATION)
wc.hCursor = LoadCursor(%NULL, BYVAL %IDC_ARROW)
wc.hbrBackground = %COLOR_3DFACE + 1
wc.lpszMenuName = %NULL
wc.lpszClassName = VARPTR(szClassName)
wc.hIconSm = LoadIcon (%NULL, BYVAL %IDI_APPLICATION)
CALL RegisterClassEx (wc)
hDlg = CreateWindowEx(%WS_EX_DLGMODALFRAME OR %WS_EX_CONTROLPARENT OR %WS_EX_WINDOWEDGE, szClassName, "What is your name?", _
%WS_POPUP OR %WS_VISIBLE OR %WS_CLIPSIBLINGS OR %WS_CAPTION OR _
%DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT OR %DS_MODALFRAME OR _
%DS_CENTER, _
(GetSystemMetrics(%SM_CXSCREEN) - 246) / 2, _
(GetSystemMetrics(%SM_CYSCREEN) - 110) / 2, _
246, 110, 0, 0, GetModuleHandle(""), BYVAL %NULL)
hCtl = CreateWindowEx(%WS_EX_CLIENTEDGE, "Edit", BYVAL %NULL, _
%WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %ES_AUTOHSCROLL, _
21, 20, 201, 19, _
hDlg, %IDC_EDIT100, GetModuleHandle(""), BYVAL %NULL)
IF hFont THEN SendMessage hCtl, %WM_SETFONT, hFont, 0
hCtl = CreateWindowEx(0, "Button", "OK", _
%WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP, _
51, 52, 60, 23, _
hDlg, %IDOK, GetModuleHandle(""), BYVAL %NULL)
IF hFont THEN SendMessage hCtl, %WM_SETFONT, hFont, 0
hCtl = CreateWindowEx(0, "Button", "Cancel", _
%WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP, _
126, 52, 60, 23, _
hDlg, %IDCANCEL, GetModuleHandle(""), BYVAL %NULL)
IF hFont THEN SendMessage hCtl, %WM_SETFONT, hFont, 0
ShowWindow hDlg, nCmdShow
UpdateWindow hDlg
LOCAL Msg AS tagMsg
WHILE GetMessage(Msg, %NULL, 0, 0)
TranslateMessage Msg
DispatchMessage Msg
WEND
FUNCTION = msg.wParam
END FUNCTION
'======================================================================
FUNCTION WndProc (BYVAL hWnd AS DWORD, BYVAL wMsg AS DWORD, _
BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
'----------------------------------------------------------------------
' Main Window procedure
'----------------------------------------------------------------------
SELECT CASE wMsg
CASE %WM_CREATE
'A good place to initiate things, declare variables,
'create controls and read/set settings from a file, etc.
'-------------------------------------------------------
CASE %WM_COMMAND
'Messages from controls and menu items are handled here.
'-------------------------------------------------------
SELECT CASE LOWRD(wParam)
CASE %IDCANCEL ' <- Esc key also triggers %IDCANCEL
IF HIWRD(wParam) = %BN_CLICKED OR HIWRD(wParam) = 1 THEN
SendMessage hWnd, %WM_DESTROY, wParam, lParam
FUNCTION = 0 : EXIT FUNCTION
END IF
CASE %IDOK ' <- Enter key usually triggers %IDOK
IF HIWRD(wParam) = %BN_CLICKED OR HIWRD(wParam) = 1 THEN
' do whatever...
END IF
CASE %IDC_EDIT100
SELECT CASE HIWRD(wParam)
CASE %EN_UPDATE ' Text is about to be changed
CASE %EN_CHANGE ' Text has changed
CASE %EN_SETFOCUS ' Control is getting focus
CASE %EN_KILLFOCUS ' Control is losing focus
END SELECT
END SELECT
CASE %WM_CTLCOLORBTN, %WM_CTLCOLOREDIT, %WM_CTLCOLORLISTBOX, %WM_CTLCOLORSTATIC
' wParam is handle of control's display context (hDC)
' lParam is handle of control
' Example on how to set colors to a specific control:
'-----------------------------------------------------
'IF lParam = GetDlgItem(hWnd, CtlId) THEN
' SetBkColor wParam, GetSysColor(%COLOR_INFOBK)
' SetTextColor wParam, GetSysColor(%COLOR_INFOTEXT)
' FUNCTION = GetSysColorBrush(%COLOR_INFOBK)
' EXIT FUNCTION
'END IF
'-----------------------------------------------------
CASE %WM_DESTROY
' is sent when program ends - a good place to delete any created objects and
' store settings in file for next run, etc. Must send PostQuitMessage to end
' properly in SDK-style dialogs. The PostQuitMessage function sends a WM_QUIT
' message to the program's (thread's) message queue, and then WM_QUIT causes
' the GetMessage function to return zero in WINMAIN's message loop.
'----------------------------------------------------------------------------
PostQuitMessage 0
FUNCTION = 0 : EXIT FUNCTION
CASE %WM_SIZE
IF wParam <> %SIZE_MINIMIZED THEN
' LOWRD(lParam) = width of dialog's client area
' HIWRD(lParam) = height of dialog's client area
' Example that resizes a control to dialog's client area:
'------------------------------------------------------
'SetWindowPos GetDlgItem(hWnd, CtlId), 0, 0, 0, _
' LOWRD(lParam), HIWRD(lParam), _
' %SWP_NOMOVE OR %SWP_NOZORDER
END IF
END SELECT
FUNCTION = DefWindowProc(hWnd, wMsg, wParam, lParam)
END FUNCTION
No other compiler I have tried:
PbWin9
PbWin10
PbCC6
PbCC5
NUWEN GCC Distro
TDM-GCC Distro
PellesC 8
Tiny C 9.26
truncates the window except Visual Studio 2012 Express and Visual Studio 2015 Community.
James