What are required changes from 32 to 64 bit assember for calling C++ classes in a dll

Just starting out? Need help? Post your questions and find answers here.
Olli
Addict
Addict
Posts: 1240
Joined: Wed May 27, 2020 12:26 pm

Re: What are required changes from 32 to 64 bit assember for calling C++ classes in a dll

Post by Olli »

Skin a window has no artistic limits.

Here is a copy of my rectangular example. If you wanted rounded patterns (between the window and the desktop background, use UpdateLayeredWindow (for Windows only, but I think this function has an equivalent on Linux).

Example #1 with rectangles :

Code: Select all

Define tempWin = OpenWindow(#PB_Any, ExamineDesktops(), 0, 0, 0, "", #PB_Window_Maximize | #PB_Window_BorderLess | #PB_Window_Invisible)
If DesktopWidth(0) <> WindowWidth(tempWin) * DesktopResolutionX()
    If #PB_Compiler_OS = #PB_OS_Windows And OSVersion() > 70
        MessageRequester("Don't forget to...", "switch the user option ! (menu Compiler)")
        End
    EndIf
    MessageRequester("Please switch...", "the dpi option on ! (menu Compiler)")
    End
EndIf
CloseWindow(tempWin)
Global Dim win.i(2047)
Global Dim hid.i(2047)
hid(3) = 1     
hid(7) = 1     
hid(8) = 1     
hid(10) = 1    
hid(11) = 1    
hid(13) = 1    
hid(15) = 1    
hid(19) = 1    
hid(22) = 1    
hid(25) = 1    
hid(28) = 1    
hid(32) = 1    
hid(34) = 1     
hid(37) = 1     
hid(39) = 1     
hid(44) = 1     
hid(50) = 1     
hid(52) = 1     
hid(53) = 1     
hid(55) = 1     
hid(67) = 1     
hid(76) = 1     
hid(77) = 1     
hid(79) = 1     
hid(84) = 1     
hid(85) = 1     
hid(86) = 1     
hid(89) = 1     
hid(91) = 1     
hid(92) = 1     
hid(100) = 1    
hid(103) = 1    
hid(107) = 1    
hid(110) = 1    
hid(111) = 1    

Procedure.i unscaX(x.i)
    ProcedureReturn DesktopUnscaledX(x)
EndProcedure

Procedure.i unscaY(y.i)
    ProcedureReturn DesktopUnscaledY(y)
EndProcedure

Global.I ctlWin = OpenWindow(#PB_Any, 16, 16, UnscaX(400), UnscaY(300), "", #PB_Window_SystemMenu | #PB_Window_Invisible ! #PB_Window_Invisible)

Procedure coloredBox(x, y, w, h, color)
    Define.i window
    window = OpenWindow(#PB_Any, UnscaX(x), UnscaY(y), unscax(w), UnscaY(h), "", #PB_Window_BorderLess | #PB_Window_NoGadgets | #PB_Window_NoActivate | #PB_Window_Invisible ! #PB_Window_Invisible, WindowID(ctlWin) )
    SetWindowColor(window, color)
    StickyWindow(window, 1)
    ProcedureReturn window
EndProcedure

ExamineDesktops()
Global dw = DesktopWidth(0)
Global dh = DesktopHeight(0)
Global gw = 16
Global gh = 9
Global cw = dw / gw
Global ch = dh / gh
Global Dim gx.d(2)
Global Dim gy.d(3)
Global Dim xx.d(2)
Global Dim yy.d(3)
 gx(0) = 1 / 8
 gy(0) = 1 / 10
 gx(1) = gx(0)
 gx(2) = 1 - gx(0)
 gy(1) = gy(0)
 gy(2) = 1 / 2
 gy(3) = 1 - gy(0)
Global Dim x.d(3)
Global Dim y.d(4)

Procedure bcd()
thi.d = 12
thi2.d = thi / 2
y = 4 * ch
id = 0
Repeat
    x = 0
    Repeat             
        For yy = 1 To 3
            For xx = 1 To 2                
                xx(xx) = x + cw * gx(xx)
                yy(yy) = y + ch * gy(yy)
            Next
        Next        
        cc = RGB((x * 255) / dw, ((dw - x) * 255) / dw, 0)
        For yy = 1 To 3
            For xx = 1 To 2                
                If xx < 2
                    If hid(id) = 0 And win(id) = 0
                        win(id) = coloredBox(xx(xx) + thi2, yy(yy) - thi2, xx(xx + 1) - xx(xx) - thi, thi, cc)
                    EndIf
                    If hid(id) And win(id)
                        CloseWindow(win(id) )
                        win(id) = 0
                    EndIf
                    id + 1
                EndIf
                If yy < 3
                    If hid(id) = 0 And win(id) = 0
                        win(id) = coloredBox(xx(xx) - thi2, yy(yy) + thi2, thi, yy(yy + 1) - yy(yy) - thi, cc)
                    EndIf
                    If hid(id) And win(id)
                        CloseWindow(win(id) )
                        win(id) = 0
                    EndIf
                    id + 1
                EndIf
            Next
        Next        
        x + cw
    Until x >= dw
    y + ch
Until y >= dh / 2
EndProcedure
dmx = DesktopMouseX()
Repeat
    t = ElapsedMilliseconds()
    If t > lap
        lap = t + 1000
        bcd()
        For i = 0 To 7
            hid(i + 16*7) = hid(i)
        Next
        For i = 0 To 16 * 7 - 1 Step 1
            hid(i) = hid((i + 7) )
        Next
    EndIf
    Delay(33)
    ev = WindowEvent()
    dmx0 = dmx
    dmx = DesktopMouseX()
Until ev = #PB_Event_CloseWindow ; dmx <> dmx0
pamen
Enthusiast
Enthusiast
Posts: 193
Joined: Sat Dec 31, 2022 12:24 pm
Location: Cyprus
Contact:

Re: What are required changes from 32 to 64 bit assember for calling C++ classes in a dll

Post by pamen »

That is cool indeed.
but...
What I'm talking about is applying theme to each and every gadget , not just window NC_AREA or making a window with a shape of doughnut.
That is a completely different matter, as you have to subclass, let's say a combobox, redefine all colors according to scheme, apply bitmaps as backgrounds or colors or both for different states (hover, focused, disabled , active)
And that should be consistent across Tree, ListView (don't forget ListView filler are right of the columns), Text, String, Edit, WEB gadget, Tab, Containers and so on.
You do not handle correctly just one element (let's say a splitter or status bar) - all looks like 1980 shareware.

So complexity of the task and time it takes to do things correctly and bug-free is a showstopper - I tried all cool code from the forum (and many are useful for a simple use case with limited number of gadgets), did some myself but to do it properly requires much more diligence and time, not just an idea.
The world is full of nice ideas and cool-looking simple examples, practice first shows how are they useful in a bit more complex setting and how much work needs to be done to make a solid, bug-free, not memory-leaking, fast and maintainable code :-)
Cheers
S.T.V.B.E.E.V.
Bitblazer
Enthusiast
Enthusiast
Posts: 762
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: What are required changes from 32 to 64 bit assember for calling C++ classes in a dll

Post by Bitblazer »

See this discussion and make sure to read it fully ;)
pamen
Enthusiast
Enthusiast
Posts: 193
Joined: Sat Dec 31, 2022 12:24 pm
Location: Cyprus
Contact:

Re: What are required changes from 32 to 64 bit assember for calling C++ classes in a dll

Post by pamen »

What do you mean?
I did read most of the 15 pages already,
I see only - Use HTML, Use Sciter, use browser , use this or that, make your own.

So - I do not see a straight forward solution while using PureBasic / Windows native controls/gadgets.
I tried already Sciter and few others, but that means MacOS and Linux will look like Sciter - unless you have literally 3 UIs.
For me it defeats the purpose of the language to use non-native toolkit. PureBasic has by now quality tested 1000 times, rock-solid controls (no matter how they look) they will not crash or leak memory or cause issues with dependencies on external UI toolkit.
And native / PureBasic gadgets work with no glitches on Mac/raspberry/Win/Linux in 32 and 64 bit.

Or maybe I missed something interesting and enigmatic in this long exchange of wise opinions?
S.T.V.B.E.E.V.
Bitblazer
Enthusiast
Enthusiast
Posts: 762
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: What are required changes from 32 to 64 bit assember for calling C++ classes in a dll

Post by Bitblazer »

pamen wrote: Sun Sep 17, 2023 11:04 am What do you mean?
HTML based would be the solution for the near future.

You missed skincrafter and a new solution would be from devexpress.

But this is the wrong thread for that topic :(

ps: if you just want the windows plain standard look, thats what purebasic creates if you dont use your own custom canvas gadgets. Unless you talk about win ui3
Last edited by Bitblazer on Sun Sep 17, 2023 11:36 am, edited 1 time in total.
pamen
Enthusiast
Enthusiast
Posts: 193
Joined: Sat Dec 31, 2022 12:24 pm
Location: Cyprus
Contact:

Re: What are required changes from 32 to 64 bit assember for calling C++ classes in a dll

Post by pamen »

Thanks
I will see skincrafter.
DevExpress is for .NET .NET Core, Blazor / ASP - it has excellent controls (I use them all at my work) , but nothing for PureBasic.
Not windows native and 200MB to distribute
Subject closed.
S.T.V.B.E.E.V.
Post Reply