?
Solved

Send a USSD via Windows Mobile in C#

Posted on 2011-10-08
5
Medium Priority
?
2,307 Views
Last Modified: 2013-12-21
Hi,

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:

http://msdn.microsoft.com/en-us/library/ms862581.aspx

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 :)
0
Comment
Question by:OMDBot
  • 2
  • 2
5 Comments
 
LVL 24

Accepted Solution

by:
alexey_gusev earned 2000 total points
ID: 36935913
you need some TAPI lib for C# for that, eg from OpenNETCF (http://tapi.codeplex.com/)

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
0
 

Author Comment

by:OMDBot
ID: 36936011
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!
0
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 36936357
you can add missing P/Invoke call yourself, after all, the following Win32 definition

LONG WINAPI lineSendUSSD(
  HLINE hLine,
  const BYTE * const lpbUSSD,
  DWORD dwUSSDSize,
  DWORD dwFlags
);

Open in new window


can be defined as

[DllImport("coredll")]
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
0
 
LVL 16

Expert Comment

by:hjgode
ID: 36939051
Here you can find a complete sample app (just googled for it): http://www.krvarma.com/2009/01/sending-ussd-message-using-tapi/

0
 

Author Comment

by:OMDBot
ID: 36958613
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!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
Learn how to use the free Acronis True Image app to easily transfer data between iPhones and Android phones.
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Suggested Courses
Course of the Month16 days, 4 hours left to enroll

850 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