Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
GeneralRe: inheritance from an interface and base class problem Pin
sreejith ss nair3-Nov-04 3:06
sreejith ss nair3-Nov-04 3:06 
QuestionUPNP anyone? Pin
Assaad Chalhoub3-Nov-04 1:42
Assaad Chalhoub3-Nov-04 1:42 
AnswerRe: UPNP anyone? Pin
sreejith ss nair3-Nov-04 3:10
sreejith ss nair3-Nov-04 3:10 
QuestionHow to use "RasGetProjectionInfo" in C#??? Pin
hailei3-Nov-04 0:55
hailei3-Nov-04 0:55 
AnswerRe: How to use "RasGetProjectionInfo" in C#??? Pin
Alex Korchemniy3-Nov-04 8:08
Alex Korchemniy3-Nov-04 8:08 
GeneralRe: How to use "RasGetProjectionInfo" in C#??? Pin
hailei3-Nov-04 14:27
hailei3-Nov-04 14:27 
GeneralRe: How to use "RasGetProjectionInfo" in C#??? Pin
Alex Korchemniy3-Nov-04 15:32
Alex Korchemniy3-Nov-04 15:32 
AnswerRe: How to use "RasGetProjectionInfo" in C#??? Pin
Marcco13-Jan-05 5:57
Marcco13-Jan-05 5:57 
Hello all, when I tried the solution as it was posted it did not work for me Frown | :( I am trying to call RasGetProjectionInfo by Pinvoking the rasapi32.dll on WinXP. I have no problem connecting to my RAS server but When I pass it back the appropriate params and structures I get back empty strings for szIpAddress and szServerIpAddress or if I modify my code to CharSet=CharSet.Unicode I get nulls.. ( listed below is the code )

Any help would be appreciated.., Thanks Smile | :)

[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Auto)]
public class RASPPPIP
{
public uint dwSize = 72;
public uint dwError;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=16)]
public string szIpAddress;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=16)]
public string szServerIpAddress;
}

public enum RASPROJECTION:uint
{
RASP_AMB = 0x10000,
RASP_PppNbf = 0x803F,
RASP_PppIpx = 0x802B,
RASP_PppIp = 0x8021,
RASP_PppCcp = 0x80FD,
RASP_PppLcp = 0xC021,
RASP_Slip = 0x20000

}
[DllImport("rasapi32.dll",CharSet=CharSet.Auto)]
public extern static uint RasGetProjectionInfo(
IntPtr hRasConn,
RASPROJECTION projection,
[In,Out] RASPPPIP pppip,
ref uint ppipSize
);



and the calling function ...

public void Dial()
{
if(_Handle!=IntPtr.Zero)
{
RASCONNSTATUS status=new RASCONNSTATUS();
uint res=Ras.RasGetConnectStatus(_Handle,status);

if(res==6) //res=ERROR_INVALID_HANDLE
_Handle=IntPtr.Zero;
else
return;
}
try
{
Ras.RasCheck(Ras.RasDial(null,_Phonebook,_Params,1,_DialNotifyDelegate,ref _Handle));
Ras.RasConnectionNotification(_Handle,this._DisconnEvent.Handle,RASNOTIFICATION.RASCN_Disconnection);
RASPPPIP pppip = new RASPPPIP();
uint size = pppip.dwSize;
uint ipstatus = 0;
ipstatus = Ras.RasGetProjectionInfo(this._Handle,RASPROJECTION.RASP_PppIp,pppip,ref size);
StartWatch();
}
catch(RasException e)
{
OnError(e.ErrorCode,e.Message);
}
}


AnswerRe: How to use "RasGetProjectionInfo" in C#??? Pin
Marcco14-Jan-05 4:32
Marcco14-Jan-05 4:32 
GeneralSharePoint and Active Directory Pin
robmekong3-Nov-04 0:24
robmekong3-Nov-04 0:24 
GeneralGrid problem Pin
babeng3-Nov-04 0:17
babeng3-Nov-04 0:17 
GeneralRe: Grid problem Pin
Alex Korchemniy3-Nov-04 7:58
Alex Korchemniy3-Nov-04 7:58 
GeneralRe: Grid problem Pin
Huseyin Altindag4-Nov-04 1:28
Huseyin Altindag4-Nov-04 1:28 
Generaldatagrid problem Pin
babeng3-Nov-04 0:14
babeng3-Nov-04 0:14 
GeneralMDI headscratcher Pin
m0nkeybot2-Nov-04 23:35
m0nkeybot2-Nov-04 23:35 
GeneralDate Time Picker Control Pin
manoj_kr742-Nov-04 23:31
manoj_kr742-Nov-04 23:31 
GeneralRe: Date Time Picker Control Pin
Alex Korchemniy3-Nov-04 7:50
Alex Korchemniy3-Nov-04 7:50 
Generalclass problem!! Pin
xiaowenjie2-Nov-04 21:56
xiaowenjie2-Nov-04 21:56 
GeneralRe: class problem!! Pin
Stefan Troschuetz2-Nov-04 22:33
Stefan Troschuetz2-Nov-04 22:33 
GeneralRe: class problem!! Pin
Ketty Avashia3-Nov-04 8:16
Ketty Avashia3-Nov-04 8:16 
GeneralDistibute My Exe Pin
amalatsliit2-Nov-04 19:21
amalatsliit2-Nov-04 19:21 
GeneralRe: Distibute My Exe Pin
Alex Korchemniy3-Nov-04 7:42
Alex Korchemniy3-Nov-04 7:42 
GeneralAdo.net Client Application may not trap SQL Server Error Messages When a Stored Procedure is Used in the SqlDataAdapter Pin
Sanjay Rastogi2-Nov-04 19:04
Sanjay Rastogi2-Nov-04 19:04 
GeneralRe: Ado.net Client Application may not trap SQL Server Error Messages When a Stored Procedure is Used in the SqlDataAdapter Pin
Dave Kreskowiak3-Nov-04 3:43
mveDave Kreskowiak3-Nov-04 3:43 
GeneralProgrammatically Adding Items Pin
eDip2-Nov-04 18:45
eDip2-Nov-04 18:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.