PPCGeeks Forums HTC Arrive HTC HD2 HTC Thunderbolt HTC Touch Pro 2 HTC Evo 4G HTC Evo 3D Samsung Galaxy S II Motorola Droid X Apple iPhone Blackberry
Go Back   PPCGeeks > Windows Mobile > WM HTC Devices > HTC Apache
Register Community Search

Notices


Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 08-19-2007, 06:29 PM
sublynx's Avatar
Lurker
Offline
 
Join Date: Aug 2007
Posts: 8
Reputation: 0
sublynx is a n00b
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
would it be possible to grab the source code for this application?

I'm an avid vb6/vb net developer, but haven't yet tried to write code for the ppc platform. the part I'm most interested in is how to detect the slide (you said you query the window rotation). Is that on a timer? or does it hook and get the message automatically? I'm not sure if its just my device, but on slide it takes 2-3 seconds before the messaging app appears and another 2-3 seconds for it to close/minimize.
Reply With Quote
  #12 (permalink)  
Old 08-19-2007, 07:00 PM
tiermann's Avatar
VIP Member
Offline
Pocket PC: XV6800 Titan (on Sprint) / PPC6700 (Sprint) Apache / Sprint Touch
Carrier: Sprint
Location: PA, USA
 
Join Date: Apr 2007
Posts: 815
Reputation: 3165
tiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIP
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Send a message via AIM to tiermann Send a message via Yahoo to tiermann
Quote:
Originally Posted by sublynx
would it be possible to grab the source code for this application?

I'm an avid vb6/vb net developer, but haven't yet tried to write code for the ppc platform. the part I'm most interested in is how to detect the slide (you said you query the window rotation). Is that on a timer? or does it hook and get the message automatically? I'm not sure if its just my device, but on slide it takes 2-3 seconds before the messaging app appears and another 2-3 seconds for it to close/minimize.
Since the SlideSoundService doesn't actually have a form it uses a Sub Main() with a loop sleeping for 250ms each cycle (if screen.primaryscreen.bounds.height). The most it should be off noticibly is by half a second (+ or - the processing time which isn't humanly noticeable) when running the application. The rest of the lag comes from how fast windows mobile and the device can process the shell request.

If I can clean my code up a bit, I'll post it on the ftp, but for now it's sloppy as heck, hehe.

Basically the module looks like this...
Code:
    Public running As Boolean
    Public old_height = Screen.PrimaryScreen.Bounds.Height
    Private Declare Sub sapiSleep Lib "coredll" Alias "Sleep" (ByVal dwMilliseconds As Long)



    Public Sub sSleep(ByVal lngMilliSec As Long)
        If lngMilliSec > 0 Then
            Call sapiSleep(lngMilliSec)
        End If
    End Sub

    Public Sub Main(ByVal cmdArgs() As String)
        running = True
        Registry.SetValue(regKey, "Running", True)

        Do While running = True
            If Screen.PrimaryScreen.Bounds.Height <> old_height And old_height = 240 Then
                old_height = Screen.PrimaryScreen.Bounds.Height
                If playSounds Then playIn()
                If RunApps Then launchapp(slideInApp, "In")

            ElseIf Screen.PrimaryScreen.Bounds.Height <> old_height And old_height = 320 Then
                old_height = Screen.PrimaryScreen.Bounds.Height
                If playSounds Then playOut()
                If RunApps Then launchapp(slideOutApp, "Out")
            End If
            sSleep(250)
            running = Registry.GetValue(regKey, "Running", False) 
            If running = False Then Exit Sub
            slideInApp = Registry.GetValue(regKey, "SlideInApp", "\Windows\calc.exe")
            slideOutApp = Registry.GetValue(regKey, "SlideOutApp", "\Windows\calc.exe")
            playSounds = Registry.GetValue(regKey, "PlaySounds", True)
            RunApps = Registry.GetValue(regKey, "RunApps", False)

            Application.DoEvents()
        Loop

    End Sub
SlideSound (the config panel) sets the "Running" regkey to false to stop the service.
Reply With Quote
  #13 (permalink)  
Old 08-19-2007, 08:45 PM
gguruusa's Avatar
Deep Thinker
Offline
Pocket PC: Tin Can
Carrier: Atomic Vibration
Location: Mountain top
 
Join Date: Jan 2007
Posts: 3,252
Reputation: 4726
gguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributions
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Ugh. You need to change it to be event driven. Polling should have died with VB6.
__________________
Grammar: The difference between knowing your shit and knowing you're shit.
Reply With Quote
  #14 (permalink)  
Old 08-19-2007, 08:53 PM
tiermann's Avatar
VIP Member
Offline
Pocket PC: XV6800 Titan (on Sprint) / PPC6700 (Sprint) Apache / Sprint Touch
Carrier: Sprint
Location: PA, USA
 
Join Date: Apr 2007
Posts: 815
Reputation: 3165
tiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIP
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Send a message via AIM to tiermann Send a message via Yahoo to tiermann
Which event?
Reply With Quote
  #15 (permalink)  
Old 08-19-2007, 09:03 PM
sublynx's Avatar
Lurker
Offline
 
Join Date: Aug 2007
Posts: 8
Reputation: 0
sublynx is a n00b
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
I've been researching this for several hours now, but there is very limited documentation that I've been able to come across. What I'm trying to find out is just how and where the physical act of sliding the keyboard out triggers the screen rotation. Does anyone know if its linked to a hardware button?

If i can find that button i can hook into it, if not I've been looking into writing a Today Screen plugin, which would allow me (i think) even greater flexibility. I only really want the messaging app to appear if I'm on the today screen, if I'm in my email wanting to reply its a bit of a pain. If i can write the plugin to just sit there invisible, i think you would have to be on the today screen for the ScreenOrientation event to be raised. If so i can attempt to go as far as disable the today screen while in landscape mode, thus saving the time to render it before opening the messaging app and instantly pop up my messaging. Sound feasible to anyone? Tips appreciated, as well as good sites with sample code/forums for cf2 vb net or c# programming.
Reply With Quote
  #16 (permalink)  
Old 08-19-2007, 10:04 PM
tiermann's Avatar
VIP Member
Offline
Pocket PC: XV6800 Titan (on Sprint) / PPC6700 (Sprint) Apache / Sprint Touch
Carrier: Sprint
Location: PA, USA
 
Join Date: Apr 2007
Posts: 815
Reputation: 3165
tiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIP
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Send a message via AIM to tiermann Send a message via Yahoo to tiermann
http://www.freevbcode.com/ShowCode.asp?ID=4042

If that's possible using coredll you'd be able to output the keypresses to a textbox and see what the value is for the slide function. I'm going to mess around a bit.
Reply With Quote
  #17 (permalink)  
Old 08-19-2007, 11:12 PM
gguruusa's Avatar
Deep Thinker
Offline
Pocket PC: Tin Can
Carrier: Atomic Vibration
Location: Mountain top
 
Join Date: Jan 2007
Posts: 3,252
Reputation: 4726
gguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributionsgguruusa should be added to the payroll for their contributions
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
That's unlikely to produce anything, as it is designed to tell you about key states that, when passed to the keytranslator, results in a keycode. Try this: Microsoft.WindowsMobile.Status namespace
Reply With Quote
  #18 (permalink)  
Old 08-19-2007, 11:36 PM
tiermann's Avatar
VIP Member
Offline
Pocket PC: XV6800 Titan (on Sprint) / PPC6700 (Sprint) Apache / Sprint Touch
Carrier: Sprint
Location: PA, USA
 
Join Date: Apr 2007
Posts: 815
Reputation: 3165
tiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIPtiermann is still contributing even after becoming a VIP
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Send a message via AIM to tiermann Send a message via Yahoo to tiermann
Thanks, gguruusa

That helps a lot. I'm going to try this out tonight and see if I can convert most of what I have.

Edit: This is much nicer. It's working like it did before but it's actually using the event (SystemProperty.DisplayRotation) instead of pooling from that loop. I'll see what I can come up with for tomorrow. Thanks again.

Edit: The problem I'm running into now (with the launched application not staying in foreground) seems to be that the OS is setting the last foreground application (from the previous screen orientation) as foreground after the screen update completes so it negates my foreground setting. I would have to wait until after the redraw to set the launched app to foreground.
Reply With Quote
Reply

  PPCGeeks > Windows Mobile > WM HTC Devices > HTC Apache


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 01:53 AM.


Powered by vBulletin® ©2000 - 2024, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0
©2012 - PPCGeeks.com