Portrait-landscape-accelerometer on HTC Phone.

dan kabestan

Licensed User
As the users know, in the (old!) HTC P3300 we had a command to switch Portrait/landscape.
With the new "accelerometer" generation HTC decides to take it off this command and (i suppose)
replace it by the accelerometer reactions.
But HTC doesnt give the correct use context and only the web browser run in the 2 positions.
On the WWW we find Gsensor or others free softwares witch solve this. But its not realy good.
Only some softwares switch right : WM microsoft office, files explorer... Starting portrait they switch
full size in landscape.
In others applications and B4ppc .exe the form is not refreshed when we switch (moving it).
We keep a part of screen from portrait moving in landscape position and reverse.
The only way to have a good run is to pass first by the file explorer, turn in landscape and
selecting B4ppc .exe, then its running fine full screen.
Its seem not a B4ppc QVGA option problem, it appears also with others softwares.

?? Is there any hidden microsoft flag or something to add in B4ppc to kill this portrait/landscape problem ??
Maybe a special refresh function ...

I follow and try all works on the mysterious dll in the forum (and Web) which gives acces to the accelerometer.
For Information, on HTC Touch Pro, you could find the UP DOWN RIGHT LEFT... move positions information
in the register-Key :
HKEY_LOCAL_MACHINE\Software\HTC\HTCSensor\GSensor key "EventChanged"
See attached file which read it, enjoy.



Staff member
Licensed User
I'm not sure if it is related, but in order for a form to correctly switch orientations you should add a FormLib object that wraps this form.
You just need to add this line somewhere at the beginning of the program:
[FONT=Courier New]flb.New1("Form1",[/FONT][FONT=Courier New][COLOR=#0000ff]B4PObject[/COLOR][/FONT][FONT=Courier New](1))

flb is a FormLib object.

dan kabestan

Licensed User
HTCsensor, the way is yet far...

Yes thanks Erel , formlib gives a better refresh !

Yes thanks Filippo, Italy-stopwatch is a VERY interesting use of HTCSensor and more (vscroll).
Is there any doc-help of your dll ? could we access to sensors values (light, stylet and ANGLES) ?
I have see a 'copyright' , could we use it ?

Actually i obtain :
- with the Filippo HTCSensor.dll --> the positions 'and' switch portrait/landscape
- with the HTCSensorS.dll --> the values of all sensors but 'dont switch' portrait/landscape without
any Gsen Gsensor freeware dll (? is it true ?) Is there any workaround ?
And then impossible to merge the two dll, because of same object names...
And no forgetting the HTC dll one, The Gsen, The Gsensor ....
I know all brains works in front of the HTC crazzy-undocumented....

Waiting for the federal complete-well-documented B4ppchtcsensor.dll ;-) Have a nice year.


Licensed User
Hi dan kabestan,

I'm sorry. I have no documentation.:sign0013:
It's only a test from me, and not everything does work with Basic4ppc.:(