Configuring (GPRS) connections (programmatically)

Posted on 2006-03-29
Last Modified: 2013-12-27
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..
Question by:OnixExp
    LVL 4

    Author Comment

    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.

    Accepted Solution

    Closed, 500 points refunded.
    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    I think the most popular question in our Windows Mobile Programming zone is about the backlight - we all want to keep it on when our application is running. Few years ago the function SystemIdleTimerReset() did this job. On our side we had to detec…
    I recently asked a question ( about Computer Inventory applications for Mobile Devices.  I was specifically interested in an app I could use on my android phone.  The be…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 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

    17 Experts available now in Live!

    Get 1:1 Help Now