Improving TwitToday – more Today Screen coding

Twitter client for Windows MobileApart from adding the ability to initiate an internet connection, my Twitter widget for Windows Mobile Today screens is still virtually the same code as I wrote in a few hours overnight at the Over The Air hackday.

Which isn’t great – as I know there have been a bunch of people waiting for me to make some fixes and add some basic features.

Tonight I had a bit of time to spare, so I finally dug out the code to start making a few improvements:

  • Background worker thread
    Today screen widgets are compiled into DLLs. They aren’t a separate executable, and are run by the Today Screen in the Today screen’s (i.e. explorer.exe’s) flow of execution. When the code tries to post to, explorer can’t do anything else until that’s finished.

    That might even be tolerable with most websites, but with twitter – which is known to fall over from time to time! – it means TwitToday could effectively hang your phone for ages until the HTTP post timed-out.

    Not good. Now it does all the HTTP work in a background thread, so you can get on with other stuff while it tries to send your tweet.

  • SIP support
    This was asked for a lot. The Today screen doesn’t include the button to show/hide the on-screen stylus/finger keyboard. So if your mobile doesn’t have a keyboard, TwitToday wasn’t much use.

    I’ve added a setting now that lets you programmatically show the SIP keyboard when you tap on the text box.

If you want to try the new version, you can download it from here. If you want to see how I did it, read on.

This is easy

g_hThread = CreateThread(NULL,

Showing the SIP
Showing and hiding the SIP is straightforward – just leaving some work to figure out the right time to do it.

This gives us:

        case BN_CLICKED:
            if (LOWORD(wParam) == ID_MYBUTTON)
                DWORD dwID[1];
                DWORD dwRetVal = 0;
                if (g_hThread != NULL)

                g_hThread = CreateThread(NULL,

                if (g_bNeedsSIP)
        case WM_KEYDOWN:
            if (g_bNeedsSIP && (LOWORD(wParam) == ID_MYTEXTBOX))

Tags: , , , , , ,

16 Responses to “Improving TwitToday – more Today Screen coding”

  1. Michele says:

    Hi Dale,

    Thanks heaps for this new version – it’s perfect!
    Gonna tweet about it now…
    You’ve made my (otherwise hair-pulling-out) day. 🙂

    Ciao for now,

  2. Muckdog says:

    I added this on the other thread, but I’m having trouble with Windows Mobile 6 on a ATT 8525. It won’t install to either device or storage card. Initially, it worked briefly from the storage card, but then when I went to the Today items screen to enter login info, it “disappeared.” It wasn’t there and then it vanished from the Today menu.

    there are no files in the program files folder, either.

  3. dale says:

    @Muckdog – Sorry you’re having problems with it. I’ll try and help clear a few things up.

    1 – Install to device not storage card. (Behaviour from Storage Card will be erratic, based on how quickly the storage card is ready when you switch your device on – because if it’s not ready quickly enough, and the Today Screen cant get the DLL when it goes looking for it, it wont check again later – assumes it’s no longer available and boots it out).

    2 – The file should be in \Program Files\TwitToday, but the file is a DLL. By default, your File Explorer is set up not to show you DLL files. Tick the “Show all files” menu option in File Explorer, and you should be able to see it then.

    Hope that helps

  4. muckdog says:

    Thanks, Dale. Got it working.

    So, retracing my steps… Initially I installed it to the device, and nothing showed up. I should’ve rebooted after this, and it probably would’ve shown up. But since it didn’t show up, I then tried installing to the storage card. It didn’t show up at first, but then when I rebooted, it showed up. But then it disappeared, most likely for the reason you mentioned (slow storage card retrieval). Then I tried various combos of installs, uninstalls, reinstalls, etc… Got frustrated, then I commented here. LOL.

    Today, I uninstalled it. Checked to make sure there were no files or folders left over. Rebooted the phone. Then I installed it to the device. It didn’t show up, but then rebooted the phone again. Voila, there it is. Went to the Today Items settings, entered in name/pass.

    Very nice.

    Thanks for the reply. Looks like a great and easy way to twit on the go.

  5. Vince says:

    Hi Dale, I’m the author of ceTwit and wondered if you would be interested in doing some integration so say if someone has ceTwit in the background running TwitToday would show the unread Tweet Reply DM counts on the today screen. And clicking those would focus ceTwit ? Seems like that would make for a real nice integration allowing unread count plus direct posting from the today screen.

    Drop me an email or follow me back on twitter @vkoser and we can chat if your interested.

  6. dale says:

    @Vince – Hmmm… interesting idea – could be the best of both worlds. Today screen for when you’re in a hurry, combined with features of a full app. (Particularly, seeing replies. Why doesn’t do that yet?!)
    Replied by email with some implementation thoughts.

  7. dale says:

    Moving discussion of ceTwit integration off the blog to GetSatisfaction

  8. Olle says:

    Installed TwitToday on my Xperia X1 with WM 6.1, typed in my user name and password, but when I have try to tweet I get an error saying “No path to the destination could be found”.

    Am I missing something?

  9. Olle says:

    Update: I now see the tweets are actually published despite the warning.

  10. dale says:

    @Olle – if this is still a problem, please let me know. I could send you an updated version which doesn’t return that error message.

  11. Olle says:

    It is still a problem, I’d love an updated version! I think you have my e-mail address?!

  12. dale says:

    @Olle – Sure, I’ll send it to you when I get home tonight.

    To clarify, the app as it currently stands displays any ConnectionManager error messages received from the Windows Mobile OS.

    However, it appears that on some WM models, error codes are returned even when everything worked okay. So what I will do is tweak the code for you so that it ignores this specific error message – assuming that when it gets that error code, it is safe to silently ignore.

  13. Andrew says:

    Hi Dale, I’ve got TwitToday working on my HTC touch Dual, the defining moment was using control panel to configure it above the calendar on the today screen. (It also needed a reboot)

    My big request would be to enable the selection button for the SIP. If the last IM used was the HTC finger keyboard (which is huge), the IM entirely covers over TwitToday, meaning you have to hope you don’t make any mistakes typing. Or, open up some other app, change the input type to letter recogniser or something, and then go back to twit today.

    Part of the problem is that HTC forces you to have a huge widget on your today screen which can’t be moved down. But I like to change IM depending on what I’m doing anyway, so this would be a very nice feature.

    Thanks – Andrew.

  14. dale says:

    @Andrew – I totally agree. Not including the SIP button isn’t by choice or design… it’s cos I can’t figure out how to do it! Sorry. 🙁

  15. Andrew says:

    Hi Dale,

    Ahh sorry. I admit I had a look on MSDN and a bit of a google and couldn’t find anything either, so I just shirked the difficult research and posted an unhelpful comment 🙂

    Thanks for the great app.


  16. […] wrote it at a hackday, but I’ve since come back to tweak it a couple of times to get it to spawn background worker threads, add SIP on-screen keyboard support, and improve support for sending special and accented […]