[SOLVED]TextGadget showing up different location in Windows 11 than Windows 10

Just starting out? Need help? Post your questions and find answers here.
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 228
Joined: Sun Aug 29, 2021 4:34 am

Re: TextGadget showing up different location in Windows 11 than Windows 10

Post by Distorted Pixel »

I figured it out. Someone here that posted about I shouldn't do I think the constant for the font being hi quality...I forget who, but they were right. I removed the constant from the code and she tested it again and the title didn't shrink and the stuff is all lined up and the same color now.
Thank you all for your help with this.

Working code for Windows 10 64 bit and Windows 11 64 bit

Code: Select all

OpenWindow(0, 0, 0, 800, 600, "SysIM", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget |
                                       #PB_Window_MaximizeGadget)
; CreateMenu(0, WindowID(0))
; MenuTitle("Program")
; MenuItem(0, "Settings")
; MenuItem(1, "Quit")
; MenuTitle("Help")
; MenuItem(4, "Help")
; MenuItem(5, "Online Help")

; program title
#Arial25bu = 1 : LoadFont(#Arial25bu, "Arial", 25, #PB_Font_Bold)
TextGadget(0, 180, 30, 430, 35, "System Information", #PB_Text_Center)
SetGadgetFont(0, FontID(#Arial25bu))

; total memory installed
Mem.q = MemoryStatus(#PB_System_TotalPhysical)
#Arial13b = 2 : LoadFont(#Arial13b, "Arial", 13)
TextGadget(1, 50, 100, 300, 30, "Total Memory Installed:"); + Mem + "GB")
TextGadget(2, 270, 100, 300, 30, "" + Mem + " GB")
SetGadgetFont(1, FontID(#Arial13b)) : SetGadgetColor(1, #PB_Gadget_FrontColor, RGB(200, 50, 0))
SetGadgetFont(2, FontID(#Arial13b)) : SetGadgetColor(2, #PB_Gadget_FrontColor, RGB(200, 50, 0))

; computer name
CompName$ = ComputerName()
TextGadget(3, 50, 130, 250, 30, "Computer Name:")
TextGadget(4, 270, 130, 250, 30, "" + CompName$)
SetGadgetFont(3, FontID(#Arial13b)) : SetGadgetColor(3, #PB_Gadget_FrontColor, RGB(200, 50, 0))
SetGadgetFont(4, FontID(#Arial13b)) : SetGadgetColor(4, #PB_Gadget_FrontColor, RGB(200, 50, 0))

; cpu name
CpuName$ = CPUName()
TextGadget(5, 50, 160, 100, 30, "CPU Name:")
TextGadget(6, 270, 160, 550, 30, "" + CpuName$)
SetGadgetFont(5, FontID(#Arial13b)) : SetGadgetColor(5, #PB_Gadget_FrontColor, RGB(200, 50, 0))
SetGadgetFont(6, FontID(#Arial13b)) : SetGadgetColor(6, #PB_Gadget_FrontColor, RGB(200, 50, 0))

; number of cpus
CpuCount = CountCPUs()
TextGadget(7, 50, 190, 450, 30, "CPU Count:")
TextGadget(8, 270, 190, 450, 30, "" + CpuCount)
SetGadgetFont(7, FontID(#Arial13b)) : SetGadgetColor(7, #PB_Gadget_FrontColor, RGB(200, 50, 0))
SetGadgetFont(8, FontID(#Arial13b)) : SetGadgetColor(8, #PB_Gadget_FrontColor, RGB(200, 50, 0))

; user name
UsrName$ = UserName()
TextGadget(9, 50, 220, 650, 30, "User Name:")
TextGadget(10, 270, 220, 300, 30, "" + UsrName$)
SetGadgetFont(9, FontID(#Arial13b)) : SetGadgetColor(9, #PB_Gadget_FrontColor, RGB(200, 50, 0))
SetGadgetFont(10, FontID(#Arial13b)) : SetGadgetColor(10, #PB_Gadget_FrontColor, RGB(200, 50, 0))

; operating system
If OSVersion() <> #PB_OS_Windows_NT3_51
  Select OSVersion()
    Case #PB_OS_Windows_95
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows 95")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case  #PB_OS_Windows_NT_4
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows NT 4")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case  #PB_OS_Windows_98
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows 98")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_ME
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 2530, 300, 30, "Windows ME")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_2000
      TextGadget(11, 50, 2530, 300, 30, "Operating System:")
      TextGadget(12, 270, 2530, 300, 30, "Windows 2000")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_XP
      TextGadget(11, 50, 250, 300, 30, "Operating System:                Windows XP")
      TextGadget(12, 270, 250, 300, 30, "Windows XP")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_Server_2003
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows Server 2003")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_Vista
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows Vista")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_Server_2008
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows Server 2008")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_7
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows 7")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_Server_2008_R2
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 2530, 300, 30, "Windows Server 2008 R2")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_8
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows 8")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_Server_2012
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows Server 2012")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_8_1
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows 8.1")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_Server_2012_R2
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows Server 2012 R2")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      
    Case #PB_OS_Windows_10
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows 10")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
    Case #PB_OS_Windows_11
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows 11")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
    Case #PB_OS_Windows_Future
      TextGadget(11, 50, 250, 300, 30, "Operating System:")
      TextGadget(12, 270, 250, 300, 30, "Windows Future")
      SetGadgetFont(11, FontID(#Arial13b)) : SetGadgetColor(11, #PB_Gadget_FrontColor, RGB(200, 50, 0))
      SetGadgetFont(12, FontID(#Arial13b)) : SetGadgetColor(12, #PB_Gadget_FrontColor, RGB(200, 50, 0))
  EndSelect    
EndIf

;3rd party hard drive code, I need to comment who's code this is below
; hard drive
Global Dim HDAvailableSpace.q(0)
Global Dim HDCapacity.q(0)
Global Dim HDFreeSpace.q(0)

Procedure GetDiskFreeSpace(drive$)
  SetErrorMode_(#SEM_FAILCRITICALERRORS)
  GetDiskFreeSpaceEx_(@drive$, HDAvailableSpace(), HDCapacity(), HDFreeSpace())
  SetErrorMode_(0)
EndProcedure

GetDiskFreeSpace("c:")

TextGadget(13, 50, 280, 300, 30, "HD Capacity C:\")
TextGadget(14, 270, 280, 300, 30, "" + Str(HDCapacity(0)/1024/1024/1024)+" GB")
SetGadgetFont(13, FontID(#Arial13b)) : SetGadgetColor(13, #PB_Gadget_FrontColor, RGB(200, 50, 0))
SetGadgetFont(14, FontID(#Arial13b)) : SetGadgetColor(14, #PB_Gadget_FrontColor, RGB(200, 50, 0))

TextGadget(15, 50, 310, 300, 30, "HD Available Space C:\")
TextGadget(16, 270, 310, 300, 30, "" + Str(HDFreeSpace(0)/1024/1024/1024)+" GB")
SetGadgetFont(15, FontID(#Arial13b)) : SetGadgetColor(15, #PB_Gadget_FrontColor, RGB(200, 50, 0))
SetGadgetFont(16, FontID(#Arial13b)) : SetGadgetColor(16, #PB_Gadget_FrontColor, RGB(200, 50, 0))

TextGadget(17, 50, 340, 300, 30, "HD Used Space")
TextGadget(18, 270, 340, 300, 30, "" + Str((HDCapacity(0)-HDFreeSpace(0))/1024/1024/1024)+" GB")
SetGadgetFont(17, FontID(#Arial13b)) : SetGadgetColor(17, #PB_Gadget_FrontColor, RGB(200, 50, 0))
SetGadgetFont(18, FontID(#Arial13b)) : SetGadgetColor(18, #PB_Gadget_FrontColor, RGB(200, 50, 0))

Repeat
  event = WaitWindowEvent()
  
  
Until event = #PB_Event_CloseWindow



To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 617
Joined: Mon May 09, 2011 9:36 am

Re: [SOLVED]TextGadget showing up different location in Windows 11 than Windows 10

Post by VB6_to_PBx »

font being hi quality.
glad you Solved it !

i'm also glad i never use the "High Quality" Font option
i should have removed it in my previous Post for you ! :oops:
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 228
Joined: Sun Aug 29, 2021 4:34 am

Re: [SOLVED]TextGadget showing up different location in Windows 11 than Windows 10

Post by Distorted Pixel »

VB6_to_PBx wrote: Tue Nov 29, 2022 12:29 pm
font being hi quality.
glad you Solved it !

i'm also glad i never use the "High Quality" Font option
i should have removed it in my previous Post for you ! :oops:
Your fine, I also removed the underlined and bold constants, but I doubt it was either of those.
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
Post Reply