[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 693
  • Last Modified:

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..
0
OnixExp
Asked:
OnixExp
1 Solution
 
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,
                MB_OK);
    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,
                 (LPARAM)lpRasEntryName[index].szEntryName);
  }

  return TRUE;
}

So it seems like I've foudn the answer to my questions.
0
 
PAQ_ManCommented:
Closed, 500 points refunded.
PAQ_Man
Community Support Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now