Jump to content

Detect "tofu" in font Code


Deye
 Share

Recommended Posts

Hi,

Is there a way to detect glyphs in an ALT code showing only as a plain square tofu
And any input about  _GUIScrollbars_Generate, it seems to completely hang the system when it hangs ( windows 10 )

#include <GUIConstantsEx.au3>
#include "GUIScrollbars_Ex.au3"
#include <Misc.au3>

Local $hDLL = DllOpen("user32.dll")
;~ Local $hGUI = GUICreate("Example", 1000, 500, -1, -1,  $WS_VSCROLL+$WS_SIZEBOX,$ES_AUTOVSCROLL)
Local $hGUI = GUICreate("Example", 1000, 500)
$X = 10
$Y = 1
$max = 1700
Local $aCntrls[$max + 1]
$ChrW = "E6FF"
For $i = 1 To $max
    $ChrW = Hex(Dec($ChrW) + 1, 4)
    $aCntrls[$i] = GUICtrlCreateLabel(ChrW("0x" & $ChrW), $X, $Y, 25, 25, $WS_BORDER)
    GUICtrlSetFont(-1, 13, 500, -1, "Segoe MDL2 Assets")
    GUICtrlCreateLabel($ChrW, $X, $Y + 20, 25, 15, $WS_BORDER)
    GUICtrlSetFont(-1, 6)
    $X += 25
    If $X > 960 Then
        $X = 10
        $Y += 45
    EndIf
Next

_GUIScrollbars_Generate($hGUI, 0, 800)
GUISetState(@SW_SHOW, $hGUI)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            DllClose($hDLL)
            Exit
        Case $aCntrls[1] To $aCntrls[$max]
            $i = $msg / 2
            $i += (IsInt($i) ? -0.5 : 0)
            GUICtrlSetBkColor($aCntrls[$i], 0X1BDC8)
            Local $aPos = MouseGetPos()
            $hGUItmp = GUICreate('', 60, 50, $aPos[0], $aPos[1], BitOR($WS_POPUP, $WS_DLGFRAME), BitOR($WS_EX_STATICEDGE, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
            GUICtrlCreateLabel(ChrW("0x" & GUICtrlRead($aCntrls[$i] + 1)), 5, 2, 50, 50, -1, $GUI_WS_EX_PARENTDRAG)
            GUICtrlSetFont(-1, 20, "", -1, "Segoe MDL2 Assets")
            GUICtrlCreateLabel("0x" & GUICtrlRead($aCntrls[$i] + 1), -1, 30)
            GUICtrlSetFont(-1, 9)
            GUISetState(@SW_SHOWNA, $hGUItmp)
            While _IsPressed("01", $hDLL)
                Sleep(250)
            WEnd
            Sleep(150)
            GUIDelete($hGUItmp)
            GUICtrlSetBkColor($aCntrls[$i], 0xffffff)
    EndSwitch
WEnd

Thanks 

Deye

Edited by Deye
Link to comment
Share on other sites

  • Moderators

Deye,

I get the scrollbars generated without problem - what do you get?

And the UDF requires "0" as a parameter when not requiring scroll in one axis and not "-1", but it still functions for me even with that mistake.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites


Hi Melba,

It happens as soon as I press on some label
Not sure what to call it, If its a memory leak and such
If any one else can detect what it is Or confirm the same ..

Thanks
Deye
 

Edited by Deye
Link to comment
Share on other sites

  • Moderators

Deye,

Nothing untoward happens to the scrollbars for me when I click a label - they just keep on working. The labels take some time to reload - hardly surprising when you have so many.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Melba,

Even if I go as to 10 pixels higher than the the gui the same happens 
As Without _GUIScrollbars it acts very fast (Also, there is no loop that detects the pressed control ..)

Note that if I press a label (say right after a quick scroll) the correct label gets selected  (as it started carrying out whats for it in the while loop ) but then something else starts\still running in the background and interrupts, causing everything to hang ( in many occasions for more than a minute  )

if there where functions to help debug\Avoid  that For instance:

Case $aCntrls[1] To $aCntrls[$max]
$aPos =  _GUIScrollbars_Hold() ; save the position of the scroll bars And Stop all _WM procedures

; DO Stuff 

_GUIScrollbars_UnHold($aPos) ; Restart\Refresh

It would be easier for me to determine anything

Thanks

Deye

Link to comment
Share on other sites

  • Moderators

Deye,

I can "quick scroll" and click on any label without any problem. Is this the complete script you are actually running or is there something else that might interfere?

Have you thought of using Opt("TrayIconDebug") to see where the script is hanging? That might offer a clue as to what is happening.

As to writing debugging functions - you can always write your own:

  • Use _GUIScrollBars_GetScrollPos($hWnd, $SB_VERT) to get the scrollbar position
  • Use the $bRegisterMsg when generating the scrollbars to prevent the UDF from automatically registering the various messages and write your own handlers. which you can toggle as required

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks Melba,

The example is as is, all that I'm running along the with the UDF
I'm afraid you are right about how scrollbars are going to behave either ways As you have all the inventory of past experience with the issue ,So I'm not going to even try messing with it anymore :sweating:

Now maybe if someone finds a way to remove the tofus showing up this will have a better chance @ being less limited .. 

Thanks as always 
Deye

Link to comment
Share on other sites

  • 1 month later...

@ Back to this one.

If the tofu images will always have the same binary string then maybe _GDIPlus_BitmapCreateFromMemory  can work for doing the  binary string comparing 
And so : What can be used to  load\create GDI images for characters, Will I need to Screen Capture each one from a test label Or is there a better yet direct approach for doing this

Thanks
Deye

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...