Configuring (GPRS) connections (programmatically)

Fellow Experts,

Assuming a freshly installed Windows Mobile 2003/2005 device, I need to programmatically add/configure connections. I think the settings are normally done through the Settings / Connections / "Add a new modem connection" menu, so I figured there must be a way to let an application do that.

My question is two-fold:
1a. Can I get some specific pointers on which methods/API's I should look into to accomplish this (i.e. not just "TAPI" or something but necessary methods)?

1b. Partially or fully working examples?

I'm looking to add a GPRS / UMTS connection, and later also a WiFi connection (but that probably needs to be a different Q, if somebody knows this though I can setup that Q for points). Shouldn't be that difficult but it's a short term thing..
Who is Participating?
Closed, 500 points refunded.
Community Support Moderator
OnixExpAuthor Commented:
Found this example in the SDK:

BOOL GetPhonebookEntries (HWND hDlgWnd)
  int index;
  DWORD dwSize, dwEntries;
  HWND hWndListBox;

  // Allocate an array of RASENTRYNAME structures. Assume
  // no more than 20 entries to be configured on the
  // Windows CE-based device.

  if (!(lpRasEntryName = new RASENTRYNAME [20]))
    MessageBox (hDlgWnd, TEXT("Not enough memory"), szTitle, MB_OK);
    return FALSE;

  // Initialize the dwSize member of the first RASENTRYNAME structure
  // in the array to the size of the structure to identify
  // the version of the structure being passed.
  lpRasEntryName[0].dwSize = sizeof (RASENTRYNAME);

  // Size of the array, in bytes
  dwSize = sizeof (RASENTRYNAME) * 20;

  // List all entry names in a remote access Phone book.
  if ((RasEnumEntries (
          NULL,               // Reserved, must be NULL
          NULL,               // Phone book is stored in the Windows CE
                              // registry.
          lpRasEntryName,     // Pointer to structure to receive entries
          &dwSize,            // Size of lpRasEntryName, in bytes
          &dwEntries)) != 0)  // Number of entries placed in array
    MessageBox (hDlgWnd, TEXT("Could not obtain RAS entries"), szTitle,
    return FALSE;

  // Get the HWND of the list box control.
  hWndListBox = GetDlgItem (hDlgWnd, IDC_RASNAMES);

  // Remove all items from a list box.
  SendMessage (hWndListBox, LB_RESETCONTENT, 0, 0);

  // Add the names of each RAS connection to the list box.
  for (index = 0; index < (int)dwEntries; ++index)
    SendMessage (hWndListBox, LB_INSERTSTRING, index,

  return TRUE;

So it seems like I've foudn the answer to my questions.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.