Solved

RAS Win32 API:  Does anyone have experience with RasEnumConnections?

Posted on 1998-09-16
4
456 Views
Last Modified: 2012-06-21
Does anyone have experience with RasEnumConnections?  I need to get all the connections and see if one of the existing connections is the connection I am trying to make.  The reason I need this is that I get a non-zero (failure) return code when I call RasDial on  a specific phonebook entry if the connection for this entry already exists.  Does anyone know a workaround for this or do I have to use RasEnumConnections?  If so, anyone have any sample implementations of this method?

Thank you
0
Comment
Question by:ext3awf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
agreen earned 100 total points
ID: 1172908
Take a look at the RASberry sample:
http://192.116.171.100/rasberry.zip
0
 

Expert Comment

by:msiegenthaler
ID: 1172909
try this. It should work correctly.

  RASCONN l_RASConnections[10];
  l_RASConnections[0].dwSize=sizeof(l_RASConnections[0]);
  DWORD l_BufferSize=sizeof(l_RASConnections);
  DWORD l_ConnectionCount=0;

  if (RasEnumConnections(&l_RASConnections[0], &l_BufferSize, &l_ConnectionCount)==0)  
  {
    for (DWORD i=0; i<l_ConnectionCount; i++)
    {
      if (m_CheckAll || l_RASConnections[i].szEntryName==m_Line)
        RasHangUp(l_RASConnections[i].hrasconn);
    }
  }
0
 

Author Comment

by:ext3awf
ID: 1172910
msiegenthaler,
When I try this code I get the following errors:

1. I get an Unknown character 0x0a0  for  l_RASConnections[10]

2. I get no conversion from int to char* for
if (m_CheckAll || l_RASConnections[i].szEntryName == m_Line)

3. What are m_CheckAll and m_Line defined as?

4. When I make the call to DWORD rc = RasDIAL(NULL, NULL, &rdParams, NULL, NULL, l_RASConnections[i].hrasconn);      It doesn't like the
last parameter.  The complier gives me: struct HRASCONN__ *' to 'struct HRASCONN__ ** '                                                   
0
 

Expert Comment

by:msiegenthaler
ID: 1172911
The part inside the FOR doesn't matter. I've copied this code out of one of my programs.'l_RASConnections[i].szEntryName' is the name of RAS connections and 'l_RASConnections[i].hrasconn' can be used for dial or hang up a connection.
To the 4. question: I'm not sure what's up, but I'd recommend you to read to help

U understand how the stuff works?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to convert MFC::CString to UTF8 wchar_t* 10 387
Create a path if not exists 7 108
why doesn't assert terminate here? 2 11
Need some help with design 17 22
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

726 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