Send a USSD via Windows Mobile in C#

Posted on 2011-10-08
Last Modified: 2013-12-21

I am looking to be able to send a USSD command such as *101# in a Windows Mobile app using C#.

I have built up the string I need to send via USSD, but the question is how. I have found very little information on the internet or MSDN. I know that I need to use the lineSendUSSD  function in Windows Mobile as shown here:

However, I am not sure how to get started using that function and there doesnt seem to be any helpful sample code on MSDN. - they dont make it easy for developers to create things!

I wonder if anyone could shed any light on how best to get started sending a USSD code on WM6 using C#?

Many Thanks :)
Question by:OMDBot
    LVL 24

    Accepted Solution

    you need some TAPI lib for C# for that, eg from OpenNETCF (

    then you have to follow regular flow, ie initialize TAPI, open data line and then you get hLine handle that you can use with lineSendUSSD() function - and have a look in above lib which might have some helper function for that purpose already

    Author Comment

    Hi Alexey, that is very interesting. They do have a file which opens TAPI lines but sadly they marked LineSendUSSD as "to do" in the project - perhaps it was more tricky than first thought!

    Will have a look for any alternate libraries, hopefully someone has used LineSendUSSD before!
    LVL 24

    Expert Comment

    you can add missing P/Invoke call yourself, after all, the following Win32 definition

      HLINE hLine,
      const BYTE * const lpbUSSD,
      DWORD dwUSSDSize,
      DWORD dwFlags

    Open in new window

    can be defined as

    extern static private long lineSendUSSD(
      IntPtr hLine,
      byte[] lpbUSSD,
      uint dwUSSDSize,
      uint dwFlags

    Open in new window

    give it a go and see what happens
    LVL 16

    Expert Comment

    Here you can find a complete sample app (just googled for it):


    Author Comment

    Thanks for the help with this both. I'm definitely going to get back on this project over the next few days and will update you both shortly.

    Apologies for the delay!

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now