What's wrong here;
When i place a control on the DDT child dialog, and click the optionbutton, the app hangs.
When i remove the %DS_CONTROL style, the app works ok.
I need this style because of some painting problems described earlier and using tabstops.
Thanks,
When i place a control on the DDT child dialog, and click the optionbutton, the app hangs.
When i remove the %DS_CONTROL style, the app works ok.
I need this style because of some painting problems described earlier and using tabstops.
Thanks,
Code:
'PowerBasic/DLL Projectfile. 'Project : !TEST 'Created : 2000-3-14 17:14:34 $COMPILE EXE "c:\temp\test.EXE" Option Explicit $INCLUDE "c:\pbdll60\winapi\win32api.inc" Callback Function DlgProc() As Long Dim a As Long Dim PS As PaintStruct Dim R As Rect Dim T As String Static hInst As Long Static hBrush As Long Static OldBrush As Long Static hIcon As Long Static hFont As Long Static ResDPIX As Long Static ResDPIY As Long Select case cbMsg Case %WM_INITDIALOG hInst = GetWindowLong( cbhndl, %GWL_HINSTANCE ) a = GETDC( CbHndl ) ResDPIX = GetDeviceCaps( a, %LOGPIXELSX ) ResDPIY = GetDeviceCaps( a, %LOGPIXELSY ) ReleaseDC CbHndl, a hIcon = LoadIcon( hInst, "APPDEFICON") If hIcon Then SendMessage CbHndl, %WM_SETICON, %ICON_BIG, hIcon hFont = CreateFont( Clng( -( 8 * ResDPIY ) / 72 ), 0, 0, 0 _ , %FW_NORMAL _ 'Fontweight , Abs ( IsTrue( 0 ) ) _ 'Italic , Abs ( IsTrue( 0 ) ) _ 'Underlined , Abs ( IsTrue( 0 ) ) _ 'Strikethru , 0, 0, 0, 0, 0 , "Ms Sans Serif" ) hBrush = CreateSolidBrush( RGB( 255, 0, 0 ) ) SendMessage GetDlgItem( CbHndl, 102 ), %WM_SETFONT, hFont, 0 Case %WM_DESTROY If hFont Then DeleteObject hFont: hFont = 0 If hBrush Then DeleteObject hBrush: hBrush = 0 If hIcon Then DestroyIcon hIcon: hIcon = 0 Case %WM_ERASEBKGND Case %WM_PAINT T = "Hello World" Call BeginPaint( cbhndl, ps) GetClientRect cbhndl, R DrawText PS.hDC, ByVal StrPtr( T ), Len( T ), R, %DT_SINGLELINE OR %DT_CENTER OR %DT_VCENTER If hBrush Then OldBrush = SelectObject( PS.hDC, hBrush ) Rectangle PS.hDC, R.nRight - 30, R.nTop + 10, R.nRight - 20, R.nTop + 20 Call SelectObject( PS.hDC, OldBrush ) End If EndPaint cbhndl, ps Function = 1 Exit Function Case %WM_MOUSEMOVE Case %WM_COMMAND Select Case CBCTL Case 100 beep DIALOG END CBHNDL, 1 Function = 1 Exit Function Case 101 End Select Case %WM_SIZE InValidateRect cbhndl, ByVal 0&, -1 End Select End Function Function WinMain ( ByVal hCurInstance As Long, _ ByVal hPrevInstance As Long, _ lpszCmdLine As ASCIIZ PTR, _ ByVal nCmdShow As Long ) As Long Dim a As Long Dim hCombo As Long Dim hFrame As Long Dim hDlg As Long Dim hDlg1 As Long 'Prepare new dialog. DIALOG NEW 0, "DDT Skeleton",,, 240, 180 _ , %WS_OVERLAPPED _ Or %WS_SYSMENU _ Or %WS_MINIMIZEBOX _ Or %WS_MAXIMIZEBOX _ Or %WS_THICKFRAME _ Or %WS_CLIPSIBLINGS _ Or %WS_CLIPCHILDREN _ TO hDlg If hDlg = 0 Then Exit Function 'Add some controls CONTROL ADD BUTTON, hDlg, 100, "&Quit",2, 2, 40, 14, %WS_TABSTOP CONTROL ADD OPTION, hDlg, 105, "Option1", 4, 120, 50, 15 CONTROL ADD OPTION, hDlg, 106, "Option2", 4, 135, 50, 15 CONTROL ADD CHECKBOX, hDlg, 107, "Check1", 5, 150, 50, 15 DIALOG NEW hDlg, "", 40,40, 60, 60 _ , %WS_CHILD _ Or %WS_BORDER _ Or %WS_CLIPSIBLINGS _ Or %WS_CLIPCHILDREN _ Or %DS_CONTROL _ TO hDlg1 'msgbox Str$( hDlg1 ) CONTROL ADD BUTTON, hDlg1, 108, "DEF",2, 2, 40, 14, %WS_VISIBLE Or %WS_TABSTOP Or %BS_DEFAULT DIALOG SHOW MODELESS hDlg1 DIALOG SHOW MODAL hDlg CALL DlgProc FUNCTION = 1 'Success End Function
Comment