Main Menu

Recent posts

#91
José Roca Software / Re: Modeless Popup Window prob...
Last post by José Roca - September 28, 2025, 12:12:16 PM
DoEvents is a default message pump that works in most cases, but with a modeless window you can't use it because PostQuitMessage sends a WM_QUIT message to the active window. The solution is to use a message pump like this one, that exits the loop when the window handle is no longer valid. Note: If you use this message pump, you don't need to send a PostQuitMessage.

' ========================================================================================
' Popup window procedure
' ========================================================================================
FUNCTION PopupWindow (BYVAL hParent AS HWND) AS LONG

   DIM pWindow AS CWindow
   pWindow.Create(hParent, "Popup window", @PopupWndProc, , , , , _
      WS_VISIBLE OR WS_CAPTION OR WS_POPUPWINDOW OR WS_THICKFRAME, WS_EX_WINDOWEDGE)
   pWindow.Brush = GetStockObject(WHITE_BRUSH)
   pWindow.SetClientSize(300, 200)
   pWindow.Center(pWindow.hWindow, hParent)
   ' / Process Windows messages
'   FUNCTION = pWindow.DoEvents

   DIM hWndPopUp AS HWND = pWindow.hWindow
   DIM uMsg AS tagMsg
   DO
      IF PeekMessageW(@uMsg, NULL, 0, 0, PM_REMOVE) THEN
         IF IsDialogMessageW(hWndPopUp, @uMsg) = 0 THEN
            TranslateMessage @uMsg
            DispatchMessage @uMsg
         END IF
      END IF
   LOOP WHILE IsWindow(hWndPopUp)
   FUNCTION = uMsg.wParam

END FUNCTION
' ========================================================================================
#92
José Roca Software / Modeless Popup Window problem
Last post by docroger - September 28, 2025, 05:59:48 AM
Hello José,

With modeless popup window, when closing main window (if popup window is open) then app dont end.

How to fix that ?

#define UNICODE
#INCLUDE ONCE "AfxNova/CWindow.inc"
USING AfxNova

DECLARE FUNCTION wWinMain (BYVAL hInstance AS HINSTANCE, _
                           BYVAL hPrevInstance AS HINSTANCE, _
                           BYVAL pwszCmdLine AS WSTRING PTR, _
                           BYVAL nCmdShow AS LONG) AS LONG
   END wWinMain(GetModuleHandleW(NULL), NULL, wCommand(), SW_NORMAL)

' // Forward declarations
DECLARE FUNCTION WndProc (BYVAL hWnd AS HWND, BYVAL uMsg AS UINT, BYVAL wParam AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT
DECLARE FUNCTION PopupWindow (BYVAL hParent AS HWND) AS LONG
DECLARE FUNCTION PopupWndProc (BYVAL hWnd AS HWND, BYVAL uMsg AS UINT, BYVAL wParam AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT

CONST IDC_POPUP = 1001

' ========================================================================================
' Main
' ========================================================================================
FUNCTION wWinMain (BYVAL hInstance AS HINSTANCE, _
                   BYVAL hPrevInstance AS HINSTANCE, _
                   BYVAL pwszCmdLine AS WSTRING PTR, _
                   BYVAL nCmdShow AS LONG) AS LONG

   ' // Set process DPI aware
   SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
   ' // Enable visual styles without including a manifest file
   AfxEnableVisualStyles

   ' // Creates the main window
   DIM pWindow AS CWindow = "MyClassName"   ' Use the name you wish
   DIM hWin AS HWND = pWindow.Create(NULL, "CWindow - Popup Window", @WndProc)
   ' // Sizes it by setting the wanted width and height of its client area
   pWindow.SetClientSize(400, 220)
   ' // Centers the window
   pWindow.Center

   ' // Adds a button
   pWindow.AddControl("Button", hWin, IDC_POPUP, "&Popup", 270, 155, 75, 30)
   ' // Anchors the button to the bottom and the right side of the main window
   pWindow.AnchorControl(IDC_POPUP, AFX_ANCHOR_BOTTOM_RIGHT)

   ' // Displays the window and dispatches the Windows messages
   FUNCTION = pWindow.DoEvents(nCmdShow)

END FUNCTION
' ========================================================================================

' ========================================================================================
' Main window procedure
' ========================================================================================
FUNCTION WndProc (BYVAL hwnd AS HWND, BYVAL uMsg AS UINT, BYVAL wParam AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT

   SELECT CASE uMsg

      ' // If an application processes this message, it should return zero to continue
      ' // creation of the window. If the application returns –1, the window is destroyed
      ' // and the CreateWindowExW function returns a NULL handle.
      CASE WM_CREATE
         AfxEnableDarkModeForWindow(hwnd)
         RETURN 0

      ' // Theme has changed
      CASE WM_THEMECHANGED
         AfxEnableDarkModeForWindow(hwnd)
         RETURN 0

      ' // Sent when the user selects a command item from a menu, when a control sends a
      ' // notification message to its parent window, or when an accelerator keystroke is translated.
      CASE WM_COMMAND
         SELECT CASE CBCTL(wParam, lParam)
            CASE IDCANCEL
               ' // If ESC key pressed, close the application by sending an WM_CLOSE message
               IF CBCTLMSG(wParam, lParam) = BN_CLICKED THEN SendMessageW(hwnd, WM_CLOSE, 0, 0)
            CASE IDC_POPUP
               IF CBCTLMSG(wParam, lParam) = BN_CLICKED THEN PopupWindow(hwnd)
         END SELECT
         RETURN 0

      CASE WM_DESTROY
         ' // End the application by sending an WM_QUIT message
         PostQuitMessage(0)
         RETURN 0

   END SELECT

   ' // Default processing of Windows messages
   FUNCTION = DefWindowProcW(hwnd, uMsg, wParam, lParam)

END FUNCTION
' ========================================================================================

' ========================================================================================
' Popup window procedure
' ========================================================================================
FUNCTION PopupWindow (BYVAL hParent AS HWND) AS LONG

   DIM pWindow AS CWindow
   pWindow.Create(hParent, "Popup window", @PopupWndProc, , , , , _
      WS_VISIBLE OR WS_CAPTION OR WS_POPUPWINDOW OR WS_THICKFRAME, WS_EX_WINDOWEDGE)
   pWindow.Brush = GetStockObject(WHITE_BRUSH)
   pWindow.SetClientSize(300, 200)
   pWindow.Center(pWindow.hWindow, hParent)
   ' / Process Windows messages
   FUNCTION = pWindow.DoEvents

END FUNCTION
' ========================================================================================

' ========================================================================================
' Popup window procedure
' ========================================================================================
FUNCTION PopupWndProc (BYVAL hWnd AS HWND, BYVAL uMsg AS UINT, BYVAL wParam AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT

   STATIC hNewFont AS HFONT

   SELECT CASE uMsg

      CASE WM_CREATE
         AfxEnableDarkModeForWindow(hwnd)
         ' // Get a pointer to the CWindow class from the CREATESTRUCT structure
         DIM pWindow AS CWindow PTR = AfxcWindowPtr(lParam)
         ' // Create a new font scaled according the DPI ratio
         IF pWindow->DPI <> 96 THEN hNewFont = pWindow->CreateFont("Times New Roman", 24)
         ' Disable parent window to make popup window modal
         'EnableWindow GetParent(hwnd), FALSE
         RETURN 0

      ' // Theme has changed
      CASE WM_THEMECHANGED
         AfxEnableDarkModeForWindow(hwnd)
         RETURN 0

      CASE WM_COMMAND
         SELECT CASE CBCTL(wParam, lParam)
            CASE IDCANCEL
               ' // If ESC key pressed, close the application by sending an WM_CLOSE message
               IF CBCTLMSG(wParam, lParam) = BN_CLICKED THEN
                  SendMessageW hwnd, WM_CLOSE, 0, 0
                  EXIT FUNCTION
               END IF
         END SELECT

      CASE WM_PAINT
    DIM ps AS PAINTSTRUCT, hOldFont AS HFONT
         DIM hDC AS HDC = BeginPaint(hWnd, @ps)
         IF hNewFont THEN hOldFont = CAST(HFONT, SelectObject(hDC, CAST(HGDIOBJ, hNewFont)))
         DIM rc AS RECT
         GetClientRect(hWnd, @rc)
         DrawTextW(hDC, "Hello, World!", -1, @rc, DT_SINGLELINE or DT_CENTER or DT_VCENTER)
         IF hNewFont THEN SelectObject(hDC, CAST(HGDIOBJ, CAST(HFONT, hOldFont)))
         EndPaint(hWnd, @ps)
         EXIT FUNCTION

      CASE WM_CLOSE
         ' // Enables parent window keeping parent's zorder
         'EnableWindow GetParent(hwnd), CTRUE
         ' // Don't exit; let DefWindowProcW perform the default action

    CASE WM_DESTROY
         ' // Destroy the new font
         IF hNewFont THEN DeleteObject(CAST(HGDIOBJ, hNewFont))
         ' // End the application by sending an WM_QUIT message
         PostQuitMessage(0)
         EXIT FUNCTION

   END SELECT

   ' // Default processing of Windows messages
   FUNCTION = DefWindowProcW(hWnd, uMsg, wParam, lParam)

END FUNCTION
' ========================================================================================


Compile the app cw_popupwindow.
Open Popup.
Close Main window.

The app seems to be terminated but...
On windows task, cw_popup is here, not terminated.

Any help ?

Tested on Freebasix x64, C backend with windows 11 pro.
#93
PlanetSquires Software / Tiko Editor v1.2.6 Release (Se...
Last post by Paul Squires - September 20, 2025, 05:05:12 PM
Version 1.2.6 release: https://github.com/PaulSquires/tiko/releases

Download the "Source code (zip)" file from the Release page (https://github.com/PaulSquires/tiko/releases), or directly via the following link:
https://github.com/PaulSquires/tiko/archive/refs/tags/v1.2.6.zip

To install, simply unzip to a folder path that does not contain spaces. To uninstall, delete the folder. Tiko does not install any additional files elsewhere in your system nor does it store information in the Windows Registry.

It is safe to copy the files from this version release over your previous v1.2.5 release because the download does not contain a settings.ini or keybindings.ini file that would overwrite your existing files.

Version 1.2.6 (September 20, 2025)
- Added: AfxNova. José Roca's latest and greatest Windows programming framework and library.
- Fixed: Visual artifact from top menubar (light colored box/rectangle displaying when mouse click on menubar).
- Fixed: StatusBar panels would show information, popups, tooltips, when no active file was open in the editor.
- Fixed: Wrong mouse cursor showing when Explorer docked to the right, no documents open, and mouse down button pressed.
- Fixed: Changing theme with no documents open would not immediately recolor the area occupied by the code document.
#94
PlanetSquires Software / Re: Tiko 1.2.5 glitches
Last post by docroger - September 19, 2025, 05:37:01 PM
Hello Paul,

Very nice ! Good catch ! All works well.

Good job !

Tested on Win 11 Pro
#95
PlanetSquires Software / Re: Tiko 1.2.5 glitches
Last post by Paul Squires - September 19, 2025, 12:56:48 PM
Pretty sure that I have now fixed these problems. The fixes will be in the next official release but if you ant to try them out early then you can download the latest exe from the development branch:
https://github.com/PaulSquires/tiko/blob/development/tiko.exe

Simply overwrite your existing tiko.exe with that one that you download.
#96
José Roca Software / Re: Some Errors?
Last post by hajubu - September 18, 2025, 02:23:51 AM
Thanks Jose for your patience and fast reaction as ever. :)

Yes these are the missing links, it worked now for me with the 3 inc files ( put in the AfxNova Folder , all other are the same - checked via checksum)

b.r. Hajubu
#97
José Roca Software / Re: Some Errors?
Last post by José Roca - September 18, 2025, 02:01:01 AM
Then I must have forgot to upload the latest files. I have done it now.

These are:


CIFileDialogCustomize.inc
CIFileDialogEvents.inc
CIOpenSaveFile.inc

Thanks for reporting it.
#98
José Roca Software / Re: Some Errors?
Last post by hajubu - September 17, 2025, 04:05:52 PM
hi  Jose, can confirm the "glitches" inside the files of sdk-templates, inside the dowloads of the latest ( today ) github repository. (
Test trial was compiled with the new tiko 1.25
I do not repeat all errs , but I confirm all found as Frank described.

It seems there are some missing declarations or "includes" .
for 'COSFD' and  ....

b.r. Hajubu


1) -> CW_CIOpenFilDialog_Events_01.bas(83) error 42: Variable not declared,
   -> COSFD_DP in 'COSFD_DP ("hOleWindow: " & WSTR(hOleWindow))
2) -> CW_CIOpenFilDialog_Events_02.bas wit error in line
(69) error 14: Expected identifier, found 'CIFileDialogControlEvents' in 'TYPE CIFileDialogControlEventsImpl EXTENDS CIFileDialogControlEvents'
(76) error 256: An ENUM, TYPE or UNION cannot be empty, found 'END' in 'END TYPE'
(82) error 42: Variable not declared, COSFD_DP in 'COSFD_DP("")'
(90) error 3: Expected End-of-Line, found 'COSFD_DP' in 'COSFD_DP("")'
(98) error 3: Expected End-of-Line, found 'COSFD_DP' in 'COSFD_DP("")'
(106) error 3: Expected End-of-Line, found 'COSFD_DP' in 'COSFD_DP("")'
(130) error 3: Expected End-of-Line, found 'COSFD_DP' in 'COSFD_DP(AfxGuidText(riid))'
(144) error 18: Element not defined, AddRef in 'pIFileDialogControlEvents->AddRef'
(162) error 3: Expected End-of-Line, found 'COSFD_DP' in 'COSFD_DP ("hOleWindow: " & WSTR(hOleWindow))'
3) -->  CW_CISaveFilDialog_01.bas  line 127
4) --> CW_CISaveFilDialog_01_events.bas line 82
#99
José Roca Software / Re: Some Errors?
Last post by José Roca - September 17, 2025, 03:14:34 PM
Which errors? I don't get any. Maybe you're using outdated include files.
#100
José Roca Software / Some Errors?
Last post by Frank Bruebach - September 17, 2025, 11:46:12 AM

hello jose, something is wrong with these files..

1) CW_CIOpenFilDialog_events.01.bas
about line 83 error mesage
'   COSFD_DP ("hOleWindow: " & WSTR(hOleWindow))
when I comment out this line the example runs

2) CW_CIOpenFilDialog__events.02.bas
line 69, 90.. much more errors

' TYPE CIFileDialogControlEventsImpl EXTENDS CIFileDialogControlEvents
' COSFD_DP("")

3) CW_CISaveFilDialog_01.bas
line 127
'OutputDebugStringW(psfd.GetResultString)
when I comment out these line, the example works

4) CW_CISaveFilDialog_01_events.bas
line 82
'   COSFD_DP ("hOleWindow: " & WSTR(hOleWindow))
line 165
'OutputDebugStringW(psfd.GetResultString)
when I comment out these lines, the example works

or my computer have a break ;-)

regards, frank