Cross Platform System Specific Commands Problem...

Just starting out? Need help? Post your questions and find answers here.
arma
User
User
Posts: 57
Joined: Sun Jul 24, 2016 11:54 pm

Cross Platform System Specific Commands Problem...

Post by arma »

Hello every body...
I have very long code, But i copy the problem part here. My problem is i get error when i run this code in Linux side... But It works fine on Windows side... I know the problem. I get error;
Linux Version says... "GetDeviceCaps_() is not a function, array, list, map or macro."
Is there any way to use System specific commands inside one code... I want to produce cross platform... I dont want to create 2 or 3 different code...
Thanks fot your help!

.
.
.
Select OS$(0)
Case "Windows"
X1.d=GetDeviceCaps_(GetDC_(0),#LOGPIXELSX)/96:Y1.d=GetDeviceCaps_(GetDC_(0),#LOGPIXELSY)/96
ExamineDesktops():h.WINDOWPLACEMENT:GetWindowPlacement_(GetDesktopWindow_(),@h)
X2.d=DesktopWidth(0)/h\rcNormalPosition\right:Y2.d=DesktopHeight(0)/h\rcNormalPosition\bottom
SX.d=X1:If X2>X1:SX=X2:EndIf:SY.d=Y1:If Y2>Y1:SY=Y2:EndIf:If OSVersion()<#PB_OS_Windows_Vista:SX=X1:SY=Y1:EndIf
aSCALE=SX:If SY>SX:aSCALE=SY:EndIf
Case "Linux"
aRunPRG("gsettings","get org.gnome.desktop.interface text-scaling-factor","","",1):aSCALE.f=ValF(PRGOut$)
EndSelect
.
.
.
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Cross Platform System Specific Commands Problem...

Post by davido »

@arma,

I think you will find the answer in the manual under Compiler Directives.
You could use something like this:

Code: Select all

 CompilerSelect #PB_Compiler_OS
    CompilerCase #PB_OS_MacOS
      ; some Mac OS X specific code
    CompilerCase #PB_OS_Linux
      ; some Linux specific code
    CompilerCase #PB_OS_Windows
      ; some Windows specific code
  CompilerEndSelect
DE AA EB
arma
User
User
Posts: 57
Joined: Sun Jul 24, 2016 11:54 pm

Re: Cross Platform System Specific Commands Problem...

Post by arma »

Thank YOU!
Your answer is helpful for me... It solved my big problem... Thank you again...
Post Reply