Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 130
» Latest member: Harper Grimm
» Forum threads: 104
» Forum posts: 836

Full Statistics

Latest Threads
PB DOS
Forum: This and that - friendly chat
Last Post: Albert Richheimer
19.01.2026, 09:36
» Replies: 1
» Views: 66
Using #RESOURCE RCDATA to...
Forum: Source Code Library
Last Post: George Bleck
14.01.2026, 16:14
» Replies: 0
» Views: 73
Happy holidays to all of ...
Forum: This and that - friendly chat
Last Post: Dale Yarker
01.01.2026, 05:41
» Replies: 5
» Views: 523
Where is CAfxMp3.inc
Forum: PowerBASIC for Windows
Last Post: Owen_English
30.12.2025, 06:00
» Replies: 3
» Views: 366
Microsoft to Replace All ...
Forum: This and that - friendly chat
Last Post: Kurt Kuzba
23.12.2025, 12:24
» Replies: 1
» Views: 277
"Unread-Posts Sign" re-ap...
Forum: Suggestions and discussion about PUMP
Last Post: Stanley Durham
16.12.2025, 21:31
» Replies: 7
» Views: 880
Issue with MalwareBytes A...
Forum: This and that - friendly chat
Last Post: Kurt Kuzba
29.11.2025, 13:19
» Replies: 1
» Views: 498
Posts here
Forum: Suggestions and discussion about PUMP
Last Post: Stanley Durham
26.11.2025, 22:37
» Replies: 2
» Views: 635
Arduino users news
Forum: This and that - friendly chat
Last Post: Pierre Bellisle
31.10.2025, 21:18
» Replies: 9
» Views: 2,196
How to run PB progs in Li...
Forum: PowerBASIC for Windows
Last Post: Gerald Sutherland
30.10.2025, 20:18
» Replies: 12
» Views: 3,206

 
  PB DOS
Posted by: Brice Manuel - 19.01.2026, 08:48 - Forum: This and that - friendly chat - Replies (1)

I just recently ordered a new 386SX mini laptop system. Running DOS 6.22 and Windows 3.11. Lovely little beast. 40Mhz, 8MB RAM, and an IPS screen. It is capable of running Windows 95, but I do not want to at this time.

I am going to be working on some DOS & 16 bit Windows software.

PB DOS is still getting use from me.

Print this item

  Using #RESOURCE RCDATA to implement the missing #RESOURCE AVI
Posted by: George Bleck - 14.01.2026, 16:14 - Forum: Source Code Library - No Replies

I posted this on the new community run PB Users Forum: https://pbusers.org/forum/viewtopic.php?t=239
Sharing here as well as I think it is useful for those that might not have joined there yet.

============================


It always bothered me that PowerBASIC never implemented a #RESOURCE AVI metastatement. If you want to include an AVI for the animation control via #RESOURCE metastatements it's impossible as you cannot animate directly from RCDATA (or other resource sections available via the #RESOURCE metastatement). It can only be done from an AVI resource section (or from a supplied file path). Yes, you can compile the AVI into an AVI resource section using an RC file compiler and add it as a PBR (which still works but was technically deprecated) or RES, but "you cannot add any other #RESOURCE metastatements in your program" as per the PowerBASIC documentation.

What this code does is allow you to embed AVIs into your code using #RESOURCE RCDATA. After you compile your code to DLL or EXE you run this patcher by supplying the DLL/EXE file path on the command line (or via drag-and-drop). It proceeds to enumerate the AVIs and moves them to an AVI resource section using UpdateResource.

Be aware that you will need to repatch the DLL/EXE each time you re-compile your code.
As such, this could be included in a tool chain to always run after a compile.

Processing is written to a log (AVIRscPtch_Log.csv) in the directory the targeted module is located. To facilitate running in a toolchain it runs silently if no errors occur, but uses MESSAGEBOX to report any errors (in addition to the log).

Code:
' Compiles under PBWIN or PBCC without changes
#COMPILE EXE "AVIRscPtch.exe"
#DIM ALL

'----------------------------------------------------------------------------(')

%UNICODE = 1

'----------------------------------------------------------------------------(')

$DDQ = $DQ + $DQ

'----------------------------------------------------------------------------(')

#INCLUDE "Win32API.inc" ' Roca Headers III_107

'----------------------------------------------------------------------------(')

GLOBAL v_ghMod AS DWORD
GLOBAL v_ghUpd AS DWORD
GLOBAL v_gsExe AS STRING

'----------------------------------------------------------------------------(')

FUNCTION fn_sCSV(BYVAL v_sText AS WSTRING) AS STRING
  IF INSTR(v_sText, ANY CHR$(34, 44)) THEN
      REPLACE $DQ WITH $DDQ IN v_sText
      FUNCTION = $DQ + v_sText + $DQ
  ELSE
      FUNCTION = v_sText
  END IF
END FUNCTION

'----------------------------------------------------------------------------(')

FUNCTION fn_sTimestamp() AS WSTRING
  LOCAL v_uST AS SYSTEMTIME
  GETSYSTEMTIME v_uST
  FUNCTION = _
      FORMAT$(v_uST.wYear, "0000") + "-" + _
      FORMAT$(v_uST.wMonth, "00") + "-" + _
      FORMAT$(v_uST.wDay, "00") + " " + _
      FORMAT$(v_uST.wHour, "00") + ":" + _
      FORMAT$(v_uST.wMinute, "00") + ":" + _
      FORMAT$(v_uST.wSecond, "00") + "Z"
END FUNCTION

'----------------------------------------------------------------------------(')

FUNCTION fn_sGetErrorText(BYVAL v_lError AS LONG) AS WSTRING
  LOCAL v_lReturn AS LONG
  LOCAL v_szBuffer AS WSTRINGZ * 256
  IF v_lError = %ERROR_SUCCESS THEN EXIT FUNCTION
  v_lReturn = FORMATMESSAGE(%FORMAT_MESSAGE_FROM_SYSTEM, BYVAL 0&, v_lError, BYVAL 0&, v_szBuffer, SIZEOF(v_szBuffer), BYVAL 0&)
  IF v_lReturn > 0 THEN FUNCTION = RTRIM$(LEFT$(v_szBuffer, v_lReturn), ANY $CRLF)
END FUNCTION

'----------------------------------------------------------------------------(')

SUB sub_Log(BYVAL v_bError AS LONG, v_sText AS WSTRING)
  LOCAL v_hFile AS LONG
  LOCAL v_lError AS LONG
  LOCAL v_sLogPath AS WSTRING
  LOCAL v_sTimestamp AS WSTRING
  v_sTimestamp = fn_sTimestamp
  v_sLogPath = PATHNAME$(PATH, v_gsExe) + "\AVIRscPtch_Log.csv"
  TRY
      OPEN v_sLogPath FOR APPEND AS # v_hFile
      PRINT # v_hFile, v_sTimestamp + "," + fn_sCSV(v_sText)
      CLOSE # v_hFile
      IF v_bError THEN MESSAGEBOX %HWND_DESKTOP, "Error during patching:" + $LF + v_sText, EXE.NAMEX$, %MB_ICONEXCLAMATION
  CATCH
      v_lError = ERR
      MESSAGEBOX %HWND_DESKTOP, _
        "Could not record message to the log file." + $LF + $LF + _
        "Timestamp:" + $LF + v_sTimestamp + $LF + $LF + _
        "Log Path:" + $LF + v_sLogPath + $LF + $LF + _
        "Error:" + ERROR$(v_lError) + $LF + $LF + _
        "Msg:" + $LF + v_sText, _
        EXE.NAMEX$, %MB_ICONEXCLAMATION
      IF v_hFile THEN CLOSE # v_hFile
  END TRY
END SUB

'----------------------------------------------------------------------------(')

FUNCTION fn_bIsAVI(BYVAL v_pData AS DWORD, BYVAL v_cbData AS DWORD) AS LONG
  IF v_pData = 0 THEN sub_Log 0, "pdata = 0" : EXIT FUNCTION
  IF v_cbData < 12 THEN sub_Log 0, "cbData < 12" : EXIT FUNCTION
  IF PEEK$(v_pData, 4) <> "RIFF" THEN sub_Log 0, "Not a RIFF" : EXIT FUNCTION
  IF PEEK$(v_pData + 8, 4) <> "AVI " THEN sub_Log 0, "Not an AVI" : EXIT FUNCTION
  FUNCTION = %TRUE
END FUNCTION

'----------------------------------------------------------------------------(')

FUNCTION fn_lEnumLangProc( _
      BYVAL v_hModule AS DWORD, _
      BYVAL v_lpType AS DWORD, _
      BYVAL v_lpName AS DWORD, _
      BYVAL v_wLang AS WORD, _
      BYVAL v_lParam AS LONG) AS LONG
  LOCAL v_bOK AS LONG
  LOCAL v_cbData AS DWORD
  LOCAL v_hData AS DWORD
  LOCAL v_hRes AS DWORD
  LOCAL v_lError AS LONG
  LOCAL v_pData AS DWORD
  LOCAL v_wzTypeAVI AS WSTRINGZ * 4
  ' FindResourceEx
  v_hRes = FINDRESOURCEEX(v_hModule, BYVAL %RT_RCDATA, BYVAL v_lpName, v_wLang)
  v_lError = GETLASTERROR
  IF v_hRes = 0 THEN
      sub_Log 0, "Error calling FindResourceEx: " + fn_sGetErrorText(v_lError)
      FUNCTION = %TRUE
      EXIT FUNCTION
  END IF
  v_cbData = SIZEOFRESOURCE(v_hModule, v_hRes)
  v_hData = LOADRESOURCE(v_hModule, v_hRes)
  v_pData = LOCKRESOURCE(v_hData)
  IF fn_bIsAVI(v_pData, v_cbData) THEN
      v_wzTypeAVI = "AVI"
      ' UpdateResource - Copy resource to new resource type
      v_bOK = UPDATERESOURCE(v_ghUpd, BYVAL VARPTR(v_wzTypeAVI), BYVAL v_lpName, v_wLang, BYVAL v_pData, v_cbData)
      v_lError = GETLASTERROR
      IF v_bOK THEN
        ' UpdateResource - Remove resource from old resource type
        v_bOK = UPDATERESOURCE(v_ghUpd, BYVAL %RT_RCDATA, BYVAL v_lpName, v_wLang, BYVAL %NULL, 0)
        v_lError = GETLASTERROR
        IF v_bOK = %FALSE THEN sub_Log 1, "Error calling UpdateResource (delete old): " + fn_sGetErrorText(v_lError)
      ELSE
        sub_Log 1, "Error calling UpdateResource (copy to new): " + fn_sGetErrorText(v_lError)
      END IF
  END IF
  FUNCTION = %TRUE
END FUNCTION

'----------------------------------------------------------------------------(')

FUNCTION fn_lEnumNameProc( _
      BYVAL v_hModule AS DWORD, _
      BYVAL v_lpType AS DWORD, _
      BYVAL v_lpName AS DWORD, _
      BYVAL v_lParam AS LONG) AS LONG
  ENUMRESOURCELANGUAGES(v_hModule, BYVAL %RT_RCDATA, BYVAL v_lpName, CODEPTR(fn_lEnumLangProc), 0)
  FUNCTION = %TRUE
END FUNCTION

'----------------------------------------------------------------------------(')

FUNCTION PBMAIN() AS LONG
  LOCAL v_bOK AS LONG
  LOCAL v_lError AS LONG
  LOCAL v_sCmd AS STRING
  LOCAL v_wzExe AS WSTRINGZ * %MAX_PATH
  v_sCmd = TRIM$(COMMAND$, ANY CHR$(32, 34))
  IF LEN(v_sCmd) THEN
      v_gsExe = v_sCmd
  ELSE
      sub_Log 1, "Please supply a module (DLL/EXE) path to patch"
      EXIT FUNCTION
  END IF
  IF ISFILE(v_gsExe) = %FALSE THEN
      sub_Log 1, "Module (DLL/EXE) path does not exist"
      EXIT FUNCTION
  END IF
  v_wzExe = v_gsExe
  sub_Log 0, "Attemping to patch module: " + $DQ + v_gsExe + $DQ
  v_ghMod = LOADLIBRARYEX(BYVAL VARPTR(v_wzExe), BYVAL %NULL, %LOAD_LIBRARY_AS_DATAFILE)
  v_lError = GETLASTERROR
  IF v_ghMod = 0 THEN
      sub_Log 1, "Error loading module: " + fn_sGetErrorText(v_lError)
      EXIT FUNCTION
  END IF
  ' BeginUpdateResource
  v_ghUpd = BEGINUPDATERESOURCE(BYVAL VARPTR(v_wzExe), %FALSE)
  v_lError = GETLASTERROR
  IF v_ghUpd = 0 THEN
      sub_Log 1, "Error calling BeginUpdateResource: " + fn_sGetErrorText(v_lError)
      FREELIBRARY v_ghMod
      EXIT FUNCTION
  END IF
  ' EnumResourceNames
  v_bOK = ENUMRESOURCENAMES(v_ghMod, BYVAL %RT_RCDATA, CODEPTR(fn_lEnumNameProc), 0)
  v_lError = GETLASTERROR
  IF v_bOK = %FALSE THEN
      sub_Log 1, "Error calling EnumResourceNames: " + fn_sGetErrorText(v_lError)
      FREELIBRARY v_ghMod
      EXIT FUNCTION
  END IF
  ' Release the module
  FREELIBRARY v_ghMod
  ' EndUpdateResource
  v_bOK = ENDUPDATERESOURCE(v_ghUpd, %FALSE)
  v_lError = GETLASTERROR
  IF v_bOK = %FALSE THEN
      sub_Log 1, "Error calling EndUpdateResource: " + fn_sGetErrorText(v_lError)
      EXIT FUNCTION
  END IF
  sub_Log 0, "Module patched"
END FUNCTION

Print this item

  Where is CAfxMp3.inc
Posted by: Owen_English - 27.12.2025, 01:48 - Forum: PowerBASIC for Windows - Replies (3)

Not quite sure where I got this chunk of code from but it includes CAfxMp3.inc which I don't have.
Have searched everywhere - Google mentions it but leads nowhere.
Anyone heard of or got a copy of this one please?

Print this item

  Happy holidays to all of us...
Posted by: Mimmo Labate - 24.12.2025, 14:00 - Forum: This and that - friendly chat - Replies (5)

I would like to wish Albert Richheimer,  who created this meeting place and who hosts us with his generosity, a Merry Christmas, as well as everyone here in various capacities. I trust that the new year will bring health accompanied by serenity. Warm regards and best wishes from the bottom of my heart.
Mimmo

Print this item

  Microsoft to Replace All C/C++ Code With Rust by 2030
Posted by: Stanley Durham - 23.12.2025, 08:24 - Forum: This and that - friendly chat - Replies (1)

“My goal is to eliminate every line of C and C++ from Microsoft by 2030,” Microsoft Distinguished Engineer Galen Hunt writes in a post on LinkedIn. “Our strategy is to combine AI and Algorithms to rewrite Microsoft’s largest codebases. Our North Star is ‘1 engineer, 1 month, 1 million lines of code.’ To accomplish this previously unimaginable task, we’ve built a powerful code processing infrastructure. Our algorithmic infrastructure creates a scalable graph over source code at scale. Our AI processing infrastructure then enables us to apply AI agents, guided by algorithms, to make code modifications at scale. The core of this infrastructure is already operating at scale on problems such as code understanding.”

https://www.thurrott.com/dev/330980/micr...st-by-2030

Print this item

  "Unread-Posts Sign" re-appears
Posted by: Albert Richheimer - 16.12.2025, 07:37 - Forum: Suggestions and discussion about PUMP - Replies (7)

Hi @all

Dale Yarker has pointed out that from time to time the "unread posts sign", a black disc, re-appears, although there are no new postings in the affected subforums.

Has anyone else noticed this strange phenomenon?

Cheers,
Albert

Print this item

  Issue with MalwareBytes Account Log-In
Posted by: Frank Ferrell - 28.11.2025, 06:34 - Forum: This and that - friendly chat - Replies (1)

Greetings and Belated Thanksgiving Greetings ...

Do we have any users of MalwareBytes Anti-Virus/Malware here?

If yes, and if you are currently using a premium subscription, then I ask if you may have tried to access your online account within the last two or three days.

Here's my situation ....

I already have MalwareBytes Premium on my desktop, and I now desire to add the current subscription to a 2nd device, in this case a laptop.

This morning (Thursday AM in the USA) I properly entered my e-mail and account password, then immediately got the message to check my e-mail for a 6-digit verifier message. However, the verifier message did not immediately arrive in my inbox, and would not arrive for three to five minutes. When the verifier message finally appeared, I entered the 6-digit verifier and got the "INVALID" response. This same thing happened again about three more times. BTW, each time the verifier message always went to the inbox, never to Spam or any other folder.

I will most likely not attempt the process again until sometime tomorrow. Meantime, I would interested to know if anyone else might be experiencing this same problem.

Thanx-A-Lotte, Frank

Print this item

  Posts here
Posted by: Dale Yarker - 25.11.2025, 15:54 - Forum: Suggestions and discussion about PUMP - Replies (2)

seemed to have stopped completely.
I still check a couple times a day. I suspect some others do too.
If you haven't switched to new PB forum, you can discuss or question here, and someone will see it.

Cheers,

Print this item

  Having problems with pbusers.org
Posted by: Brian Alvarez - 20.10.2025, 02:14 - Forum: This and that - friendly chat - Replies (3)

Is it only me? it sometimes displays the forums list and then times out when opening some threads.

Print this item

  How to run PB progs in Linux
Posted by: Mannish Bhandari - 19.10.2025, 21:27 - Forum: PowerBASIC for Windows - Replies (12)

I heard so many terrible stories about upgrading to Windows 11 I'm now interested to use Linux instead and I want to be able to run my PB 
progs in Linux.  how to do this ?

Print this item