| Welcome, Guest |
You have to register before you can post on our site.
|
| Latest Threads |
GDI+ Gauges custom contro...
Forum: Programming
Last Post: Jules Marchildon
Yesterday, 12:02
» Replies: 2
» Views: 68
|
Next Gen Visual Designer ...
Forum: Programming
Last Post: Jules Marchildon
27.10.2026, 04:38
» Replies: 14
» Views: 1,113
|
Program that won't close
Forum: PowerBASIC for Windows
Last Post: Mike Doty
26.10.2026, 15:54
» Replies: 6
» Views: 273
|
EnableVisualStyles.bas
Forum: Source Code Library
Last Post: Stanley Durham
25.10.2026, 01:12
» Replies: 5
» Views: 243
|
PHP and PowerBasic
Forum: PowerBASIC for Windows
Last Post: Fim Wästberg
24.10.2026, 17:18
» Replies: 2
» Views: 177
|
Claude
Forum: PowerBASIC for Windows
Last Post: Stanley Durham
20.10.2026, 00:30
» Replies: 18
» Views: 2,413
|
LOOP remains active after...
Forum: Programming
Last Post: Dale Yarker
18.10.2026, 17:00
» Replies: 4
» Views: 384
|
trailing semicolon?
Forum: PowerBASIC for Windows
Last Post: Borje Hagsten
15.10.2026, 14:12
» Replies: 3
» Views: 389
|
Promoting PowerBASIC docu...
Forum: PowerBASIC Documentation
Last Post: Claudio DalZovo
13.10.2026, 17:18
» Replies: 6
» Views: 6,756
|
PowerBASIC Users...
Forum: This and that - friendly chat
Last Post: Marc Giao
11.10.2026, 04:04
» Replies: 2
» Views: 391
|
|
|
| Program that won't close |
|
Posted by: Giuseppe Belziti - 25.10.2026, 12:37 - Forum: PowerBASIC for Windows
- Replies (6)
|
 |
I have a program that I can't close; I've tried everything. Here is the current situation:
Code: CALLBACK FUNCTION AggiornaXProc()
SELECT CASE CB.MSG
'...........................................chiudi con X
CASE %WM_SYSCOMMAND
IF (CB.WPARAM AND &HFFF0) = %SC_CLOSE THEN
PID = SHELL("PAY.EXE", 1)
DIALOG END CB.HNDL, 0 ' Chiude hDlg2
DIALOG END hDlg, 0 ' Chiude hDlg
CLOSE ' Rilascia gli handle file
END ' Termina definitivamente PAY_START.EXE
END IF
END SELECT
END FUNCTION
Code: ' --- RICHIAMA PAY.EXE ---
PID = SHELL("PAY.EXE", 1)
' --- CHIUSURA ORDINATA IN SEQUENZA CORRETTA ---
DIALOG END hDlg2, 0 ' Chiude prima il dialogo figlio (Aggiornamenti)
DIALOG END hDlg, 0 ' Poi chiude la finestra principale (AgriPag)
CLOSE ' Chiude tutti i canali file aperti
END ' Forza la terminazione del processo
I also tried using taskkill, but it doesn't work.
If I try from the CMD, on the other hand, I get this—and you can see that the program was open:
C:\PAG>cmd.exe /c taskkill /F /IM PAY_START.EXE
OPERAZIONE RIUSCITA: il processo "PAY_START.EXE" con il PID 8960 è stato terminato.
Do you have a solution for closing this program safely? P.S. This only happens with this one...
|
|
|
| EnableVisualStyles.bas |
|
Posted by: Borje Hagsten - 24.10.2026, 17:13 - Forum: Source Code Library
- Replies (5)
|
 |
Don't remember if anyone posted this kind of function in any of the old - now gone - forums, so here it is. Works for me in Windows 10 - hopefully also in later versions. To be compiled with PB/Win 10. Some comments explain.
Code: '======================================================================
' Small example of how to enable visual styles in CommCtrl.dll v.6 via
' code instead of using manifest file in resource. Maybe not so useful,
' since doing it via xptheme.xml manifest in resource is easy, but here
' it is anyway. Public Domain by Borje Hagsten October 24, 2026.
'
' Added: Made a correction to deactivation via SUB DisableVisualStyles,
' where FreeeLibrary and ReleaseActCtx was added.
' Thank you Stanley Durham for pointing this out.
'======================================================================
#COMPILE EXE
#DIM ALL
'--------------------------------------------------------------------
%UNICODE = 1
#INCLUDE "WIN32API.INC"
'--------------------------------------------------------------------
%IDC_TEXTBOX1 = 531
GLOBAL ghActCtx, gCookie, ghShell32 AS LONG ' need to store these as global.
'======================================================================
FUNCTION PBMAIN () AS LONG
LOCAL hDlg AS LONG
EnableVisualStyles() 'Activate at entry
DIALOG NEW 0, "EnableVisualStyles",,, 185, 65, %WS_CAPTION OR %WS_SYSMENU OR _
%WS_MINIMIZEBOX, 0 TO hDlg
DIALOG SET COLOR hDlg, -1, RGB(196, 196, 196)
'------------------------------------------------------------------
CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX1, "TextBox1", 5, 5, 100, 55
CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Ok", 110, 46, 70, 14
'------------------------------------------------------------------
DIALOG SHOW MODAL hDlg ' no callback - just a demo of how to..
IF gCookie THEN DisableVisualStyles ' Deactivate at exit
END FUNCTION
'=================================================================================
' Enable visual styles in CommCtrl.dll v.6, using manifest resource in shell32.dll
'---------------------------------------------------------------------------------
FUNCTION EnableVisualStyles() AS DWORD
LOCAL aCtx AS ACTCTX
#IF %DEF(%UNICODE)
LOCAL szSys AS WSTRINGZ * %MAX_PATH
#ELSE
LOCAL szSys AS ASCIIZ * %MAX_PATH
#ENDIF
GetSystemDirectory szSys, SIZEOF(szSys) ' Need path to shell32.dll
aCtx.cbSize = SIZEOF(ACTCTX)
aCtx.dwFlags = %ACTCTX_FLAG_RESOURCE_NAME_VALID OR _
%ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID OR _
%ACTCTX_FLAG_HMODULE_VALID
aCtx.hModule = LoadLibrary("shell32.dll") ' Use the manifest resource in shell32.dll
aCtx.lpResourceName = 124 ' Manifest resource name
aCtx.lpAssemblyDirectory = VARPTR(szSys)
ghShell32 = aCtx.hModule
ghActCtx = CreateActCtx(aCtx) 'push the specified activation context to the top of the activation stack
IF ghActCtx <> %INVALID_HANDLE_VALUE THEN 'vs.hActCtx = dwRes, &vs.cookie = dwCookie, vs.hShell32 = aCtx.hModule
ActivateActCtx(ghActCtx, gCookie)
END IF
FUNCTION = gCookie
END FUNCTION
'=================================================================================
' Disable visual styles
'---------------------------------------------------------------------------------
SUB DisableVisualStyles
IF gCookie THEN DeactivateActCtx(0, gCookie)
IF NOT ghActCtx = %INVALID_HANDLE_VALUE THEN ReleaseActCtx(ghActCtx)
IF ghShell32 THEN FreeLibrary(ghShell32)
END SUB
|
|
|
| LOOP remains active after closing via Task Bar cure |
|
Posted by: Dale Yarker - 18.10.2026, 02:58 - Forum: Programming
- Replies (4)
|
 |
In a current project I'm using GRAPHIC WINDOW CLICK in a DO/LOOP.
(Is similar to MODELESS pump and CALLBACK but only clicks not Windows messages)
If I closed the window using right click on task bar icon compiling again failed because program is still running.
(needed to close using Task Manager)
The cure is API IsWindow (hWin) in the DO/LOOP.
Code: 'Mouse click "pump"
do
graphic window click to ClickState, PosX, PosY
' if ClickState then '<== to also check for double click
' sleep 550 'default Windows time 500, '<== for double click
' graphic window click to ClickState, dummy, dummy '<== for double click
ExitRequest = ClickProc( ClickState, PosX, PosY) '<== Exit clicked on window
if ExitRequest then exit function
if IsWindow (hGrafWin) = 0 then exit function '<== the cure!
' end if '<== for double click
sleep 100
loop
I've found no way to monitor for mouse clicks in TXT.WINDOW. But there could be a DO/LOOP.
Use CON.MOUSE and CON.HANDLE for the above to work in PBCC.
PBWIN has function ISWIN, but GRAPHIC WINDOW and TXT.WINDOW can also be created in PBCC which doesn't.
related: Console programs can have a callback. See PBCC samples\Internet\TCP or \UDP.
|
|
|
| trailing semicolon? |
|
Posted by: Dan Soper - 14.10.2026, 13:04 - Forum: PowerBASIC for Windows
- Replies (3)
|
 |
I'm sure this has come up before, but probably on the old forum.
In a code module translated from C, I inadvertently left a line-end semicolon behind, resulting in:
As far as I'm aware this is not valid, and shouldn't compile - but it did!
What am I getting wrong here? Is is somehow valid PB syntax?
|
|
|
| Next Gen Visual Designer front end -testing |
|
Posted by: Jules Marchildon - 12.10.2026, 22:59 - Forum: Programming
- Replies (14)
|
 |
I wonder if a few people can test out my latest compiled version work in progress. This isn't going to be a full fledged designer + code generator, just a quick start with a a few of my own new personal features, when I get to that point in life. I will make it available (source code) as custom control and include a small demo how to use it. But for now it's just the binary test file.
Here's the zip file. (See post#9 for updated file, October 24th, 2026)
It will create a temp avi file in the same folder as the exe, it cleans up once you exit. Once I add the properties dialog, you can swap avi files during design time.
Thanks in advance!
|
|
|
| Claude |
|
Posted by: Owen_English - 05.10.2026, 22:29 - Forum: PowerBASIC for Windows
- Replies (18)
|
 |
Has anyone subjected their code to Claude for an analysis? I recently pushed a 100k .bas file thru it and in return receiving a list of ~100 logic errors, some of which were valid, some were not.
I then asked Claude to write an alternative code and what it produced was incredibly close to the original in 25k - but it wasn't 100% compilable by PB. This stuff is going to make us old dinasours all totally redundant.
|
|
|
|