As of version 6.80 Basic4ppc stores several values in the main thread slots.
This allows external libraries to read these parameters and act accordingly.
The C# code is:
scaleX / scaleY - have the same value as Basic4ppc keywords ScreenScaleX / ScreenScaleY.
fixX / fixY - used in AutoScale compilation. See this thread for more information: http://www.b4x.com/forum/beta-versions/4207-autoscale-compilation-mode-external-libraries.html
cPPC - same as Basic4ppc cPPC (true when running on the device and false on the desktop).
optimized - True for optimized compiled applications and false otherwise.
It is also possible to read these values from Basic4ppc with the door library.
Basic4ppc code:
Note that this code requires Door library v1.2 or newer.
This allows external libraries to read these parameters and act accordingly.
The C# code is:
B4X:
(double)Thread.GetData(Thread.GetNamedDataSlot("fixX"))
(double)Thread.GetData(Thread.GetNamedDataSlot("fixY"))
(double)Thread.GetData(Thread.GetNamedDataSlot("scaleX"))
(double)Thread.GetData(Thread.GetNamedDataSlot("scaleY"))
(bool)Thread.GetData(Thread.GetNamedDataSlot("cPPC"))
(bool)Thread.GetData(Thread.GetNamedDataSlot("optimized"))
fixX / fixY - used in AutoScale compilation. See this thread for more information: http://www.b4x.com/forum/beta-versions/4207-autoscale-compilation-mode-external-libraries.html
cPPC - same as Basic4ppc cPPC (true when running on the device and false on the desktop).
optimized - True for optimized compiled applications and false otherwise.
It is also possible to read these values from Basic4ppc with the door library.
Basic4ppc code:
B4X:
Sub ReadValueFromThread (property)
AddObject("obj1", "Object")
AddObject("obj2", "Object")
AddObject("objArr", "ObjectArray")
obj1.New1(True)
obj2.New1(False)
obj1.CreateNew("System.Threading.Thread" & obj1.System_Mscorlib)
obj2.Value = obj1.RunMethod2("GetNamedDataSlot", property, "System.String")
objArr.New1(1)
objArr.SetObject(0, obj2.Value)
ret = obj1.RunMethod4("GetData", objArr.Value)
obj1.Dispose
obj2.Dispose
objArr.Dispose
Return ret
End Sub