📄 rasapi.txt
字号:
WIN32 RAS API SAMPLE
This is a sample that demonstrates accessing RAS functions from Visual Basic 4.0 32 bit. This sample is unsupported and
not fully tested.
***************************************************************************************************************************************************
INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY ACCOMPANY THIS DOCUMENT
(collectively referred to as VB32RAS.EXE) IS PROVIDED "AS IS" WITHOUT WARRANTYANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
FITNESS FOR A PARTICULAR PURPOSE. The user assumes the entire risk as to the accuracy and the use of this file.
This MSL file may be copied and distributed subject to the following conditions:
1) This file may not be distributed for profit.
Copyright 1994 Microsoft Corporation. All Rights Reserved.
Microsoft is a registered trademark of Microsoft Corporation.
****************************************************************************************************************************************************
Although the sample is unsupported, it should be as robust as possible. You can report bugs and suggestions to
Visual Basic support and they will be fixed as time allows.
About this release:
1. The sample contains an automation server and a client. Both were built with Visual Basic 4.0a 32 bit. The client contains only
interface code (no RAS code). The server contains all of the RAS code. It is a little convoluted, due to Visual Basic OLE
Automation server restrictions, and problems.
Here is a list of where the RAS stuff is located:
Server: RAS_AUTO.VBP
RAS Function: Module: Procedure:
RAS declares, constants and types: RAS_GLB.BAS
RasCreatePhonebookEntry: PhoneEntries AddEntry
RasDial: Connections AddConnection (async and sync)
RasEditPhonebookEntry: PhoneEntry EditEntry
RasEnumConnections: Connections fcnRASEnumConnections (called from AddConnection/Count/etc.)
RasEnumEntries: PhoneEntries fcnRASEnumEntries (called fromAddEntry/Count/etc.)
RasGetConnectStatus: Connection fcnRASGetConnectionStatus (called from hRasConn property Let)
frmAsycDial tmrGetConnStatus_Timer (for async connection polling)
RasGetEntryDialParams: PhoneEntry fcnRasGetEntryDialParams (called fromEntryName prop. Let/etc.)
RasGetErrorString: RASError fcnRASErrorString (called from Description property Get)
RasGetProjectionInfo: Connection fcnRASGetProjectionInfo(called from hRasConn property Let)
RasHangUp: Connections RemoveConnection
RasSetEntryDialParams: PhoneEntry fcnRasSetEntryDialParams(called from most property Lets)
Client: RASAPI.VBP
Error Checking: frmRASMAIN fcnErrorHandler
The rest is pretty self explanitory and related to the UI, not RAS.
2. The server is compiled as a DLL. It can be modified slightly, compiled as an EXE and called from 16 bit applications running
on NT or 95 to provide RAS functionality. The only modifications that should be needed are the Asynchronous RASDial calls. The
code displays a modal dialog that would be in a different process so it may not show up and if the user clicks on the client then an
error will be displayed. One could modify the code to pass in a control to update and a window to send the RAS_EVENT messages.
3. The client requires the Professional edition of Visual Basic due to use of treeview controls.
How to use the executable:
In order to run the rasapi.exe executable, the automation server must be registered. Use REGSVR32.EXE as follows:
Run REGSVR32.EXE RAS_AUTO.DLL
This will create an entry in the CLSID key in the registry "RAS.RasEngine" use this in calls to CreateObject or GetObject.
If Visual Basic 4.0 Professional is not installed on the machine the following files must be copied to the system directory and
registered if indicated:
COMCTL32.OCX
OLEPRO32.DLL
MFC40.DLL Register with REGSVR32.EXE
MSVCRT40.DLL
VB40032.DLL
VEN2232.OLB
How to use the source files:
Load RAS_AUTO.VBP in one instance of Visual Basic 4.0 32 bit. Go to the Advanced Tab of the Options dialog and choose
"Break on unhandled errors". Run the application.
Load RASAPI.VBP in another instance of Visual Basic 4.0 32 bit. Go to the References Dialog and point to the RAS type library
for the running RAS_AUTO server. Run the application.
Common Questions:
How do I dial?
There are 2 ways to dial using the objects that I have exposed. Connections.AddConnection and SomePhonebookEntry.DialEntry. The
latter merely calls AddConnection passing the Entry Name and whether or not to use asyncronous. AddConnection is far more flexible.
It can be used to dial a Phonebook entry by specifying one or to dial any number by specifying "" for the entry and specifying the number.
UserName, Password, Domain and CallbackNumber can also be specified or left blank ("").
How do I see the Object Hieirarchy?
Add it as a reference in Visual Basic and Use Object Browser. Use the client to see actual usage.
Can I use the server 'as is'?
Yes, but being a sample, using the code 'as is' is not recommended. It has not been fully tested, but it does appear to be pretty reliable.
Be sure to create a new CLSID, DLL name and Project Namer. This will help avoid conflicts. Being a sample, it may be updated in such a
manner that backwards compatibility is broken.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -