Article ID: 163236
Article Last Modified on 7/11/2005
// Device setting information.
typedef struct tagDEVCFGDR {
DWORD dwSize;
DWORD dwVersion;
WORD fwOptions;
WORD wWaitBong;
} DEVCFGHDR;
typedef struct tagDEVCFG {
DEVCFGHDR dfgHdr;
COMMCONFIG commconfig;
} DEVCFG, *PDEVCFG, FAR* LPDEVCFG;
To find more information on this structure, query on "comm/datamodem" in
Microsoft Developer Network or in the Win32 SDK documentation. DEVCFG is a
complex structure that consists of many other structures and some driver
specific information fields. Follow these steps when you create new Dial-Up
phone book entries:
TERMINAL_PRE (0x00000001) Displays the pre-terminal screen. TERMINAL_POST (0x00000002) Displays the post-terminal screen. MANUAL_DIAL (0x00000004) Allows manual Dialing, if possible. LAUNCH_LIGHTS (0x00000008) Displays the modem tray icon.Many more serial port specific parameters (such as parity, flow control, etc.) are set via the "dcb" structure field, which is nested in the "commconfig" field of the DEVCFG. Please see the Win32 SDK documentation for the COMMCONFIG structure.
...
RASENTRY Info = {0};
PDEVCFG pDevCfg;
DWORD dwSize, dwDevInfo;
dwSize = Info.dwSize = sizeof (RASENTRY);
dwDevInfo = 0;
// First find out the size of the device-specific structure.
// This call will fail, but dwDevInfo will return the correct size.
RasGetEntryProperties (NULL, "My Entry", (BYTE *) &Info,
&dwSize, NULL, &dwDevInfo );
if (! (pDevCfg = (LPDEVCFG) LocalAlloc (LPTR, dwDevInfo ) ) )
{
printf ("LocalAlloc error: %d", GetLastError());
return 0;
}
if (code = RasGetEntryProperties (NULL, "My Entry", (BYTE *) &Info,
&dwSize, (LPBYTE) pDevCfg, &dwDevInfo ))
{
printf ("RasGetEntryProperties failed: %d\n", code);
return 0;
}
// Verify that the TAPI provider used is the correct version of the
// Unimodem driver. Check the size of the structure, version. and
// provider sub-type.
if ( ( ( pDevCfg->dfgHdr).dwSize < sizeof (DEVCFG) ) ||
( ( pDevCfg->dfgHdr).dwVersion != 0x00010003) ||
( (pDevCfg->commconfig).dwProviderSubType != PST_MODEM) )
{
printf ("TAPI provider is not UNIMODEM\n");
return 0;
}
// Set the "Manual Dial" bit flag.
(pDevCfg->dfgHdr).fwOptions |= 4;
if (code = RasSetEntryProperties (NULL, "My Entry", (BYTE *) &Info,
dwSize, (LPBYTE) pDevCfg, dwDevInfo))
{
printf ("RasSetEntryProperties failed: %d\n", code);
return 0;
}
....
Keywords: kbhowto kbtapi kbapi kbnetwork kbcode KB163236