Simplest Windows Application

Started by Stan Duraham, April 18, 2026, 02:19:26 PM

Previous topic - Next topic

Stan Duraham

Single-Page Applications (SPAs). "Most major modern platforms like Gmail, Google Maps, Trello, Netflix, and Airbnb are built as SPAs."

All HTML tags that might be used must have a unique ID.
You use Fake URLs to send messages to FreeBASIC using JavaScript or wrap the button or text in a Fake URLs.
FreeBASIC code intercepts navigation attempts and cancels and handles the message.
Use JavaScript innerText or innerHTML to Get/Set text or HTML.
You can change any element including the whole page. One page can be a thousand pages.

No point in me trying to explain it, run this query in Google AI search mode in a browser.
"Using FreeBASIC and the Afx library by José Roca, I want to build a local one-page browser application. Data is passed to FreeBASIC code in fake URLs that are really messages. Data is passed from FreeBASIC code to the browser using a javascript call to replace inner text or inner html to change the html in the browser. Thus, the page can change, or other things can happen using fake URL messages. How would I go about doing this?"

You can ask further questions for more information. Include "using FreeBASIC and José Roca's Afx library" or it might get sidetracked.

I haven't tried this yet, but I know it will work because I did it with PB. I'm not up to speed on FreeBASIC. I have other code I'm focused on, but it did this query to make sure I could build an easy application before I committed to FreeBASIC. Thanks to José I know I can do it when the need arises because I did it on PB using his code.

If anybody more adapt with FreeBASIC does give it a try, it would be interesting to know how it works for you. Lot of powerful tools you can use inside the browser. José's code provides a direct bridge to FreeBASIC.
Happy trails...

José Roca

Hi Stan,

You may want to consider using WebView2 instead of the legacy WebBrowser control before you invest too much time into this approach.

The WebBrowser control is based on Internet Explorer and is already obsolete, with many limitations regarding modern HTML, CSS, JavaScript and communication between the host application and the embedded page.

In contrast, my CWebView2 class provides a clean and modern wrapper around Microsoft's WebView2 (Chromium-based) and gives you:

- full modern HTML/CSS/JS support

- reliable two‑way communication between JavaScript and FreeBASIC

- the ability to execute JavaScript directly from your code

- no need for "fake URLs" or navigation hacks

- much better performance and long‑term support

If you plan to build SPA‑style interfaces or dynamic HTML‑driven UIs, WebView2 is a far better foundation and will save you a lot of work in the long run.

Just a friendly suggestion before you go too deep into something that is already outdated.

CWebView2 class: https://github.com/JoseRoca/AfxNova/blob/main/AfxNova/CWebView2.inc

A few examples: https://github.com/JoseRoca/AfxNova/tree/main/Examples/WebView2

Documentation: https://github.com/JoseRoca/AfxNova/tree/main/docs/WebView

BTW the old WebBrowser control is also available in my AfxNova framework for FreeBasic.

CWebCtx: https://github.com/JoseRoca/AfxNova/blob/main/AfxNova/CWebCtx.inc

CWebBrowserEvents: https://github.com/JoseRoca/AfxNova/blob/main/AfxNova/CWebBrowserEvents.inc

Stan Duraham

#2
Correction, one should include "using FreeBASIC 1.10.1 and José Roca's Afx library at https://github.com/JoseRoca/AfxNova" in the query. If the querying is about C or C++ or another language, one should include what version and particular compiler. AI tends to use the most used syntax and most of the code on the web is outdated.

Important News; there is a new local model just released, Qwen3.6 35B, that appears to be really good with FreeBASIC. A local model stays on your computer. Both it and Google AI mode in the browser appear to be really good with FreeBASIC.

You're 100% correct for most use except for what I was going to use it for, a dirt simple application. The difference is, IE COM directly supports innerText and innerHtml in COM methods and WebView2 doesn't. So, with IE you have a simple way to transfer large amounts of text and don't need to use JavaScript at all. Windows still uses IE for some things, but it's scheduled to be discontinued in 2029.
As far as I know, it's impossible to build code using your current libraries that directly support innerText and innerHtml. You have to call JavaScript to do that. That also means that you don't have a direct way to transfer large amounts of text.
Both Qwen3.6 and Google AI made recommendations on what I need to use with your current code.

I didn't give Qwen3.6 proper instructions and asked if it could build an app using your code that directly supports innerText and innerHtml, it said it could. So, I asked it to build it. However, I couldn't find the libraries it used. It turns out that it used old code apparently archived at https://forum.it-berater.org/. I asked it to make corrections using current code. It really liked your new code and gave it a lot of complements.

Qwen3.6 is pretty cool because you can watch it think. It makes a to do list and then queries itself and makes corrections as it goes. At one point, it started with QT code and converted it to FreeBASIC syntax.

Conclusion. One can use your current code to build very powerful local Single Page Applications (SAP). AI can help pulling it all together. In the browser, there's all kinds of libraries to do whatever you want, games, 3D, ....
However, for my use, a dirt-simple application. It may not be so simple because you have to use JavaScript with other techniques to transfer text.
For my use, a Windows application may be simpler. But I'd still need AI to help pull it together because that's the heck of a lot of code to shift through. Once the skeleton is in place, it should be easy for an old xPB, xDDT, SDK ignorant, user.

I'm like water. I want to take the easiest path so I can focus on what I'm doing and not spend time on things that there may be a simple way around.