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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 128
» Latest member: Andre Drabs
» Forum threads: 102
» Forum posts: 831

Full Statistics

Latest Threads
Where is CAfxMp3.inc
Forum: PowerBASIC for Windows
Last Post: Owen_English
Yesterday, 06:00
» Replies: 3
» Views: 106
Happy holidays to all of ...
Forum: This and that - friendly chat
Last Post: Albert Richheimer
25.12.2025, 07:50
» Replies: 3
» Views: 151
Microsoft to Replace All ...
Forum: This and that - friendly chat
Last Post: Kurt Kuzba
23.12.2025, 12:24
» Replies: 1
» Views: 120
"Unread-Posts Sign" re-ap...
Forum: Suggestions and discussion about PUMP
Last Post: Stanley Durham
16.12.2025, 21:31
» Replies: 7
» Views: 424
Issue with MalwareBytes A...
Forum: This and that - friendly chat
Last Post: Kurt Kuzba
29.11.2025, 13:19
» Replies: 1
» Views: 333
Posts here
Forum: Suggestions and discussion about PUMP
Last Post: Stanley Durham
26.11.2025, 22:37
» Replies: 2
» Views: 425
Arduino users news
Forum: This and that - friendly chat
Last Post: Pierre Bellisle
31.10.2025, 21:18
» Replies: 9
» Views: 1,733
How to run PB progs in Li...
Forum: PowerBASIC for Windows
Last Post: Gerald Sutherland
30.10.2025, 20:18
» Replies: 12
» Views: 2,497
Pac-Man maze
Forum: Programming
Last Post: Jules Marchildon
30.10.2025, 16:03
» Replies: 12
» Views: 3,970
Having problems with pbus...
Forum: This and that - friendly chat
Last Post: Kurt Kuzba
26.10.2025, 12:17
» Replies: 3
» Views: 1,044

 
  gbClientCapture (Discussion)
Posted by: Gary Beene - 20.09.2025, 18:43 - Forum: PowerBASIC for Windows - Replies (21)

I decided to break the gbScroller app into two parts. The first is posted in the forum as gbClientCapture.

It captures the area under the transparent dialog client, merging each new capture into a horizontal image for subsequent scrolling. I've not yet written the scrolling app.

The area between the Toolbar and Statusbar is captured and merged into a horizontal image.

[Image: capture.jpg]


Some new features come to mind:

1. allow using the arrow keys to more accurately position the dialog
2. with transparency, the resize with a mouse ability is limited to the caption and toolbar. Not sure why but I know I don't like it.

Not a feature, but I notice there is a tiny gap between the caption and toolbar. I'm not sure why. I thought the toolbar by default would be positioned immediately next to the caption.

And, another thing, I tweaked the various dimensions to make sure the client area is captured, without overlapping the toolbar, statusbar and dialog borders. But it seems to me that I should have been able to do a more exact dimensioning of the capture positioning/size.

Here's how I envision this working.

1. Call up the electronic copy of the music (PDF in this example).
2. Place gbClientCapture over the first row of music (resize as needed)
3. Click "Copy"
4. Scroll the PDF upwards until the next row of music is under gbClientCapture (that should be easier than moving the dialog itself.
5. Click "Copy"
6. Repeat until all rows of music are captured and placed in the "merge.bmp" file.

In this example, the Adele music sheet PDF is displayed vertically in my browser.  The gbClientCapture is positioned over the first row, ready for "Copy".  Then, instead of moving the dialog to a new position, I scroll the PDF upwards until the next row of music is visible under the dialog client area. Repeat Copying untill all rows of music are captured. With each capture the "merge.bmp" file is updated to contain the most recent capture.

[Image: capture2.jpg]

Print this item

  gbClientCapture
Posted by: Gary Beene - 20.09.2025, 18:38 - Forum: Source Code Library - Replies (1)

This app displays a transparent dialog, with a Toolbar and a Statusbar. Images under the open dialog client area are captured and merged into a horizontal image.  This will be used by my next app to scroll the horizontal image - corresponding to my post about breaking vertical sheet music into scrollable horizontal music.

Discussion is here.

Toolbar buttons:

1. Exit - close gbClientCapture

2. Copy - captures the desktop below the transparent dialog client and saves it as a BMP. each capture is merged with previous captures to form a horizontal image (first captured image on the left, last captured image on the right)

3. New - deletes all images, including the merged image

4. View - opens the current merged image in the default image viewer

The Statusbar keeps track of how many images there are in the image folder.

Here's a picture of the app, with some desktop showing through the client area.

[Image: capture.jpg]

Code and images are here:  https://www.garybeene.com/files/gbclientcapture.zip

Code:
'Compilable Example:  (Jose Includes)
#Compile Exe  "gbclientcapture.exe"
#Dim All

#Debug Error On
#Debug Display On

%Unicode=1
#Include "Win32API.inc"

%IDC_Toolbar   = 500
%IDT_Exit      = 501
%IDT_Copy      = 502
%IDT_New       = 503
%IDT_View      = 504
%IDC_StatusBar = 505

#Resource Manifest, 1,      "icons\xptheme_dpiaware.xml"
#Resource VersionInfo
#Resource StringInfo "0409", "04B0"
#Resource Version$ "CompanyName", "New Vision Concepts"
#Resource Version$ "ProductName", "gbClientCapture"
#Resource Version$ "ProductVersion", "1.0"
#Resource Version$ "FileDescription",  "gbClientCapture - Capture Desktop Behind Client"
#Resource Version$ "LegalCopyright",   "Copyright 2025 New Vision Concepts"

#Resource Icon logo, "icons\alogo.ico"
#Resource Icon zexit, "icons\power.ico"
#Resource Icon zcopy, "icons\copy.ico"
#Resource Icon znew, "icons\new.ico"
#Resource Icon zmerge, "icons\view.ico"

$Ver = "1.0"

Global hDlg, hToolbar, hList, hBrush, hFont As Dword
Global ImageCount, ImageWidth, ImageHeight As Long
Global SBW, SBH, TBW, TBH As Long

Function PBMain() As Long
   Dialog New Pixels, 0, "gbClientCapture  v" + $Ver,300,50,200,100, %WS_OverlappedWindow, %WS_Ex_Layered To hDlg
   Dialog Set Icon hDlg, "logo"
   Dialog Set Color hDlg, %Black, %White
   CreateToolbar

   Control Add Statusbar, hDlg, %IDC_StatusBar, "", 0,0,0,0, %CCS_Bottom Or %SBars_SizeGrip
   Control Get Size hDlg, %IDC_StatusBar To SBW, SBH
   Control Set Color hDlg, %IDC_StatusBar, %Black, %Gray

   Font New "Tahoma",10, 1 To hFont
   Control Set Font hDlg, %IDC_Toolbar, hFont
   Control Set Font hDlg, %IDC_StatusBar, hFont

   Dialog Show Modal hDlg Call DlgProc
End Function

CallBack Function DlgProc() As Long
   Select Case Cb.Msg
      Case %WM_InitDialog
         hBrush = CreateSolidBrush(RGB(243,243,243))
         SetWindowPos hDlg, %HWND_TOPMOST, 0, 0, 0, 0, %SWP_NOMOVE Or %SWP_NOSIZE
         If IsFalse IsFolder("images") Then MkDir "images"
         Settings_INI "get"
         Statusbar Set Text hDlg, %IDC_StatusBar, 1, 0, "ImageCount = " + Format$(ImageCount)
         SetLayeredWindowAttributes(hDlg, %White, 255, %LWA_ALPHA Or %LWA_Colorkey)
      Case %WM_ContextMenu
         sBeep : Dialog End hDlg
      Case %WM_Command
         Select Case Cb.Ctl
            Case %IDT_Exit  : sBeep : Dialog End hDlg
            Case %IDT_Copy  : sBeep : SaveDialogToClipboard : MergeImages
            Case %IDT_New   : sBeep : NewProject
            Case %IDT_View : sBeep : ViewMerge
         End Select

      Case %WM_Notify
         Select Case Cb.NmId
            Case %IDC_Toolbar
               Local pTbCustDraw As NmTbCustomDraw Pointer
               pTbCustDraw  = Cb.LParam
               Select Case @pTbCustDraw.nmcd.dwDrawStage
                  Case %CDDS_PREPAINT  ' paint entire toolbar
                     FillRect(@pTbCustDraw.nmcd.hdc, @pTbCustDraw.nmcd.rc, hBrush)
                     Function = %CDRF_NOTIFYITEMDRAW
               End Select
         End Select

      Case %WM_Destroy
         DeleteObject hBrush
         Settings_INI "save"
   End Select
End Function

Sub CreateToolbar
   ImageList New Icon 32,32,32,20 To hList
   ImageList Add Icon hList, "zexit"   '1
   ImageList Add Icon hList, "zcopy"   '2
   ImageList Add Icon hList, "znew"    '3
   ImageList Add Icon hList, "zmerge"  '4

   Control Add Toolbar, hDlg, %IDC_Toolbar, "", 0,0,0,0 ', %TbStyle_Flat
   Control Handle hDlg, %IDC_Toolbar To hToolbar
   Toolbar Set ImageList hDlg, %IDC_Toolbar, hList, 0

   Toolbar Add Button hDlg, %IDC_Toolbar, 1, %IDT_Exit, %TbStyle_Button, " Exit "
   Toolbar Add Button hDlg, %IDC_Toolbar, 2, %IDT_Copy, %TbStyle_Button, " Copy "
   Toolbar Add Button hDlg, %IDC_Toolbar, 3, %IDT_New, %TbStyle_Button, " New "
   Toolbar Add Button hDlg, %IDC_Toolbar, 4, %IDT_View, %TbStyle_Button, " View "

   Control Get Size hDlg, %IDC_Toolbar To TBW, TBH

End Sub

Sub Settings_INI(Task$)
   Local x,y,w,h, tempz, INIFileName As WStringZ * %Max_Path, WinPla As WindowPlacement

   'set ini filename
   INIFileName = Exe.Path$ + Exe.Name$ + ".ini"    'get INI file name

   Select Case Task$
      Case "get"
         'get dialog width/height from INI file and use to set Dialog size
         GetPrivateProfileString "All", "Width", "1200", w, %Max_Path, INIFileName
         GetPrivateProfileString "All", "Height", "300", h, %Max_Path, INIFileName
         Dialog Set Size hDlg,Val(w), Val(h)   'width/height

         'get dialog top/left from INI file and use to set Dialog location
         Getprivateprofilestring "All", "Left", "0", x, %Max_Path, INIFileName
         Getprivateprofilestring "All", "Top", "0",  y,  %Max_Path, INIFileName
         If IsFile(INIFileName) Then Dialog Set Loc hDlg, Val(x), Val(y)   'left/top but only once INIFileName exists

         'get value for string variables
'         GetPrivateProfileString "All", "FontName", "Arial Black", FontName, %Max_Path, INIFileName

         'get value for numeric variables
         Getprivateprofilestring "All", "ImageWidth", "",     tempz, %Max_Path, INIFileName   : ImageHeight = Val(tempz)
         Getprivateprofilestring "All", "ImageHeight", "",    tempz, %Max_Path, INIFileName   : ImageWidth = Val(tempz)
         Getprivateprofilestring "All", "ImageCount", "0",    tempz, %Max_Path, INIFileName   : ImageCount = Val(tempz)

      Case "save"
         If IsFile(INIFileName) Then Kill INIFileName    'clear the INI file Name to remove residual entries before saving
         WinPla.Length = SizeOf(WinPla)
         GetWindowPlacement hDlg, WinPla
         WritePrivateProfileString "All", "Left",   Str$(WinPla.rcNormalPosition.nLeft), INIFileName
         WritePrivateProfileString "All", "Top",    Str$(WinPla.rcNormalPosition.nTop), INIFileName
         WritePrivateProfileString "All", "Width",  Str$(WinPla.rcNormalPosition.nRight - WinPla.rcNormalPosition.nLeft), INIFileName
         WritePrivateProfileString "All", "Height", Str$(WinPla.rcNormalPosition.nBottom - WinPla.rcNormalPosition.nTop), INIFileName

         'save string variables
'         WritePrivateProfileString "All", "FontName",   FontName, INIFileName

         'save numeric variables
         WritePrivateProfileString "All", "ImageHeight",    Str$(ImageHeight), INIFileName
         WritePrivateProfileString "All", "ImageWidth",     Str$(ImageWidth), INIFileName
         WritePrivateProfileString "All", "ImageCount",     Str$(ImageCount), INIFileName
   End Select
End Sub

Sub sBeep : WinBeep(275,150) : End Sub

Sub NewProject  'remove all \images\*.bmp
   Local temp$
   Clipboard Reset
   ImageCount = 0
   temp$ = Dir$("images\*.bmp")
   If Len(temp$) Then Kill "images\*.bmp"
   Statusbar Set Text hDlg, %IDC_StatusBar, 1, 0, "ImageCount = " + Format$(ImageCount)
End Sub

Sub SaveDialogToClipboard
   Local x,y As Long, hBMP, hBMPDC, hDC As Dword       '         abcdegfg
   'create memory bitmap the size of the dialog client (less Toolbar and less StatusBar)
   Dialog Get Client hDlg To ImageWidth, ImageHeight
   ImageWidth = ImageWidth - 1
   ImageHeight = ImageHeight - SBH - TBH - 2

   Graphic Bitmap New ImageWidth, ImageHeight To hBMP
   Graphic Attach hBMP,0
   Graphic Get DC To hBMPDC

   'bitblt dialog rectangle from the screen to the me                            mory bitmap
   Dialog Get Loc hDlg To x,y
   x = x + 9
   y = y + TBH + CaptionHeight - 7
   hDC = GetDC(%Null)
   BitBlt hBMPDC, 0,0,ImageWidth,ImageHeight, hDC, x,y, %SRCCopy 'copy desktop image to
   ReleaseDC(%Null,hDC)

   'save to file
   Incr ImageCount
   Graphic Save "images\" + Format$(ImageCount) + ".bmp"

   'send to clipboard
   Clipboard Reset
   Clipboard Set Bitmap hBMP

   'get rid of the bitmap
   Graphic Bitmap End

   'count images
   Statusbar Set Text hDlg, %IDC_StatusBar, 1, 0, "ImageCount = " + Format$(ImageCount)

End Sub

Function captionHeight As Long
   Local cw,ch,ddw,ddh As Long
   Dialog Get Size hDlg To ddw,ddh
   Dialog Get Client hDlg To cw,ch
   Function = ddh-ch
End Function

Sub MergeImages
   Local i, x1, y1, x2, y2 As Long
   Local hBMP, hBMPDC As Dword, ImageName$

   If IsFile("merge.bmp") Then Kill "merge.bmp"

   Graphic Bitmap New ImageCount*ImageWidth,ImageHeight To hBMP
   Graphic Attach hBMP,0
   Graphic Get DC To hBMPDC

   For i = 1 To ImageCount
      ImageName$ = "images\" + Format$(i) + ".bmp"
      x1 = (i-1) * ImageWidth
      x2 = x1 + ImageWidth
      y1 = 0
      y2 = ImageHeight
      Graphic Render Bitmap ImageName$, (x1,y1)-(x2,y2)
   Next i

   Graphic Save "merge.bmp"
   Graphic Bitmap End
End Sub

Sub ViewMerge
   Local iReturn As Long, hBMP As Dword

   Graphic Bitmap Load "merge.bmp", 0,0 To hBMP
   Graphic Attach hBMP,0

   Clipboard Reset
   Clipboard Set Bitmap hBMP

   Graphic Bitmap End

   iReturn = ShellExecute(hDlg, "Open", "merge.bmp", $Nul, $Nul, %SW_ShowNormal)
End Sub

Print this item

  File Transfer Between PCs
Posted by: Gary Beene - 19.09.2025, 21:32 - Forum: PowerBASIC for Windows - Replies (2)

I want to move all DOCX files from an old PC to my new PC, preferably by first putting them all on a flash drive which I use for the transfer.

I've posted code before that would capture a list of files anywhere on the PC that match a filespec such as "*.docx". I can use that to copy files to the flash.

But because some files have the same name, I can't just fill the root folder of the flash with all the files by their original name.  To do that I would have to rename files - such as with a simple prefix of "00001", "0002", etc.  Or, I could prefix the original folder name onto each file name, substituting the \ characters with an underscore.  That won't recreate the old folder structure on the new PC, but will at least capture all of the files.

Better yet, I could use something like Beyond Compare to find only DOCX files and replicate the original folder structure onto the new PC.  That's the most "exact" approach, but I'd have to be careful not to inappropriately overwrite any files on the new PC.

As best I know, the command line xcopy can do a similar thing but doesn't as easily et you pick and chose which files to copy.

Anyone use a better solution?

Print this item

  DOCX and XLSX Viewer
Posted by: Gary Beene - 18.09.2025, 03:30 - Forum: PowerBASIC for Windows - Replies (9)

I'd like to display DOCX and XLSX files with their full visual content.

But, I need for the solution to NOT require Word/Excel be installed on a user's PC.

Is that possible?

Print this item

  gbScroller - Vertical to Horizontal Music Converter
Posted by: Gary Beene - 17.09.2025, 16:13 - Forum: PowerBASIC for Windows - Replies (7)

From talking with a friend, I got the idea of writing a tool to convert music sheets from a portrait format to a scrollable, horizontal format.  I went looking on the web, thinking there must be one already, but did not find anything.  I have the basics working, but before I spent more time on it, I thought I'd see if anyone here knows of such a thing.

Here's an image showing the idea.  A vertical page of music, with multiple rows of content, would be converted to a horizontal image that can be scrolled at a specified rate.  There might be several pages to convert.

[Image: gbscroller.png]

My approach is to have a transparent, resizable dialog that the user places over a row of music and takes a snapshot of that row, then moves the dialog over the next row of music and takes another snapshot - repeating until all rows over multiple pages have been captured. All images would be the same size. gbScroller would merge the images into a single image, which could then be displayed and scrolled within the same app.

Print this item

Smile Comments re High resolution replacement for Sleep
Posted by: David Roberts - 14.09.2025, 00:00 - Forum: Programming - Replies (12)

I had a bit of a 'carrry on' creating post #2. I couldn't figure out the difference between 'Quick Edit' and 'Full Edit'. On one occasion, I got post #1 merging with post #2. On another occasion, I got post #2 being duplicated within itself.

Would someone explain the difference?

Anyway, the question is whether to use SleepX or SleepXX. I cannot answer that - only you can by trying the two source codes. On my Windows 10 machine with a Performance Counter Frequency of 10MHz and a CPU Base Frequency of 3.5GHz SleepXX is the more accurate.

If you have the time, would you let me know what your Performance Counter Frequency is, your CPU Base Frequency, and a console output of the more accurate.

Ta much.  Smile

Print this item

  gbLocator (Discussion)
Posted by: Gary Beene - 07.09.2025, 06:49 - Forum: PowerBASIC for Windows - Replies (2)

This thread is for discussion of gbLocator - a file and folder search utility for blind and low vision users. I posted it a few days ago in the Source Code forum.

Same links ...
Web Site: https://newvisionconcepts.com/gblocator/gblocator.htm
Installation File:   https://garybeene.com/files/gblocator_setup.exe
Source Code File:   https://garybeene.com/files/gblocator.zip

There's even a short video:  https://garybeene.com/files/gblocator.mp4

ver 4.1 is now available - these new features:


1. F1 shows Settings Shortcuts and F2 shows Actions Shortcuts.
2. When Ctrl-F1 is used to start a browser, the BigX toolbar is shown - literally a big "X" over the small browser "x". (optional)
3. Folders now have "(f)" in front of them in Column 1 and when spoken, is spoken as "folder"
4. When opening a file/folder externally (browser, default client, or File Explorer), user can choose between opening the BigX toolbar or Windows Narrator (or neither)
5. A variety of changes to the text spoken when an action is taken - generally more informative but sometimes shorter
6. The Ctrl+Mouse fontsize change now works over the RE and the LV
7. When Expanding a folder, the folder name is now NOT shown in the RE.  Having that long a visible search string was annoying. 
8. As searches are made, the last 5 search terms are kept. To see them, press the up/down arrow keys when focus is on the RE (for my low vision users, I avoid dropdown combobox solutions).
9. Previews of image files (I don't think this was in the previous version)

Howdy, Mike!

Thanks for that post.  I'm glad to hear it was ok at 1920x1080.  I tried the newest version on 3840x2160 and it seems to draw correctly.  If you would, please try the latest version on your 3840x2160 again and let me know if it look ok for you too.

In the latest version, I can't repeat the problem you mentioned, about ESC. As you noted, ESC is supposed to stop talking and exit only if talking is stopped.


Howdy, Pierre!

Yes, with David's encouragement, I put up a thread about gbLocator on the Everything forum!
I was pretty excited about the possibility of getting responses there, but it's been 5 days and I've had zero responses!  Bummer that!  Huh  I will have to be patient!

Test. I don't seem to have figured out how to make a reply that carries the name of the person making the reply.  This time, I pressed "New Reply" across the top of the thread.

Print this item

  New Announcements?
Posted by: Stuart McLachlan - 06.09.2025, 03:43 - Forum: Suggestions and discussion about PUMP - No Replies

The Portal sidebar shows something like this:

Last visit: Today, 12:05
Since then, there have been:
» 1 new announcement
» 1 new thread
» 1 new post

View New Posts
View Today's Posts

What are "announcements" and where do we find them?

Print this item

  WMIC removed in WIn11 25H2
Posted by: Stuart McLachlan - 06.09.2025, 03:23 - Forum: Programming - No Replies

There are currently a number of threads in gbThreads that contain a Shell to WMIC  (Windows Management Instrumentation Command-line), including some from the last few years.  

If you are currently using an application that Shells to WMIC, it will not work in Win11 25H2 (coming very soon).  It is being removed (along with PowerShell 2.0).

Print this item

  Very Fast WString /Object Hash Table (Comments)
Posted by: Stanley Durham - 05.09.2025, 02:20 - Forum: Programming - Replies (7)

One thing I learned from this, for absolute speed, you can’t use normal WString comparison. Also, Equal is faster than Comparison if that’s all you need, which is the case with a hash table. Comparison requires two comparisons to determine if it’s less than or greater than. For absolute speed, you can’t use; If A$ = B$ Then.
In the Equal callback, testing the lengths first immediately eliminates some values. Passing a pointer and the length to the callback eliminates that overhead in the callback.
I could get this faster, about 0.095 seconds to find 1,000,000 keys, by writing the code inline instead of using callbacks, but the complexity isn’t worth the benefit.


Code:
Very Fast WString /Object Hash Table

Print this item