tamour2004
asked on
ras.h question
i am making a dialer i want it to run on all windows platforms 98, 2000, XP
this is part of code
#pragma warn -dup
#define WINVER 0x400
#include <ras.h>
char newentryname[100];
DWORD entrysize, configsize, error;
BYTE configbuffer[512];
bool password;
char buffer[512];
configsize = sizeof(configbuffer);
RASENTRY entry;
String name = (String)entryname;
strcpy(newentryname, name.c_str());
memset(&entry, 0, sizeof(RASENTRY));
entrysize = sizeof(RASENTRY);
entry.dwSize = sizeof(RASENTRY);
int version1=GetOSVersion();
if (version1==1)
{
entry.dwfOptions=8984;
}
else if(version1==2)
{
//entry.dwfOptions=1024197 400;
entry.dwfOptions=RASEO_SwC ompression |RASEO_IpH eaderCompr ession|RAS EO_RemoteD efaultGate way|RASEO_ ModemLight s|0x010000 00|0x04000 000;
//entry.dwType=RASET_Phone ;
}
else if(version1==3)
{
entry.dwfOptions=RASEO_SwC ompression |RASEO_IpH eaderCompr ession|RAS EO_RemoteD efaultGate way|RASEO_ ModemLight s;
}
else {ShowMessage("Can not detect OS Version");}
String strDeviceType=GetDeviceTyp e();
String strDeviceName=GetDeviceNam e();
strcpy(entry.szDeviceType, strDeviceType.c_str());
strcpy(entry.szDeviceName, strDeviceName.c_str());
strcpy(entry.szLocalPhoneN umber, "07777007");
strcpy(entry.szDeviceType, RASDT_Mode m);
entry.dwFramingProtocol=RA SFP_Ppp;
entry.dwfNetProtocols=RASN P_Ip;
error = RasSetEntryProperties (NULL, newentryname,&entry, entrysize, configbuffer, configsize);
if(error)
{
RasGetErrorString(error, buffer, sizeof(buffer));
ShowMessage(buffer);
return false;
}
return true;
but this only work on win 98 when i try to put some other properties for win 2000 the compiler stops with error message it does not understand these properties unless i change
#define WINVER 0x400
with
#define WINVER 0x500
but i want one program to run on all platforms
and when i ignore this line and dont pass it an error message is generated saying an incorrect structure size , ithink it is the RASENTRY structure
what is the solution for that problem
thx
this is part of code
#pragma warn -dup
#define WINVER 0x400
#include <ras.h>
char newentryname[100];
DWORD entrysize, configsize, error;
BYTE configbuffer[512];
bool password;
char buffer[512];
configsize = sizeof(configbuffer);
RASENTRY entry;
String name = (String)entryname;
strcpy(newentryname, name.c_str());
memset(&entry, 0, sizeof(RASENTRY));
entrysize = sizeof(RASENTRY);
entry.dwSize = sizeof(RASENTRY);
int version1=GetOSVersion();
if (version1==1)
{
entry.dwfOptions=8984;
}
else if(version1==2)
{
//entry.dwfOptions=1024197
entry.dwfOptions=RASEO_SwC
//entry.dwType=RASET_Phone
}
else if(version1==3)
{
entry.dwfOptions=RASEO_SwC
}
else {ShowMessage("Can not detect OS Version");}
String strDeviceType=GetDeviceTyp
String strDeviceName=GetDeviceNam
strcpy(entry.szDeviceType,
strcpy(entry.szDeviceName,
strcpy(entry.szLocalPhoneN
strcpy(entry.szDeviceType,
entry.dwFramingProtocol=RA
entry.dwfNetProtocols=RASN
error = RasSetEntryProperties (NULL, newentryname,&entry, entrysize, configbuffer, configsize);
if(error)
{
RasGetErrorString(error, buffer, sizeof(buffer));
ShowMessage(buffer);
return false;
}
return true;
but this only work on win 98 when i try to put some other properties for win 2000 the compiler stops with error message it does not understand these properties unless i change
#define WINVER 0x400
with
#define WINVER 0x500
but i want one program to run on all platforms
and when i ignore this line and dont pass it an error message is generated saying an incorrect structure size , ithink it is the RASENTRY structure
what is the solution for that problem
thx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.