ʹÓÃVB½«ASP´úÂë·â×°µ½DLLÎļþÍêÕûʵÀý
ʹÓÃVB½«ASP´úÂë·â×°µ½DLLÎļþÍêÕûʵÀý
http://blog.csdn.net/cncco/archive/2007/10/20/1834865.aspx
ÓÃVB·â×°ASP£¬½¨Á¢SayHello²âÊÔ³ÌÐò
1¡¢´ò¿ªVB6£¬Ð½¨ActiveX DLL
2¡¢ÔÚ¹¤³ÌÒýÓÃÖмÓÈëMicrosoft Active Server Pages Object LibraryÑ¡Ôñ
3¡¢Ìî¼Ó´úÂëÈçÏ£º
'Code Start
'ÉùÃ÷²¿·Ö
Private MyScriptingContext As ScriptingContext
Private MyApplication As Application
Private MyRequest As Request
Private MyResponse As Response
Private MyServer As Server
Private MySession As Session
'ÏÂÃ涨Ò幫Óú¯Êý£¨ÔÚVBÖзÃÎÊASP¶ÔÏ󣬼´ÔÚVBÖпÉÒÔÓÃMyApplicationµÈͬÓÚASPÖеÄApplication¡¢MyRequestµÈͬÓÚASPÖеÄRequest¡¢ MyResponseµÈͬÓÚASPÖеÄResponse¡¢ MyServerµÈͬÓÚASPÖеÄServer¡¢ MySessionµÈͬÓÚASPÖеÄSession ʹÓã©
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set MyScriptingContext = PassedScriptingContext
Set MyApplication = MyScriptingContext.Application
Set MyRequest = MyScriptingContext.Request
Set MyResponse = MyScriptingContext.Response
Set MyServer = MyScriptingContext.Server
Set MySession = MyScriptingContext.Session
End Sub
Public Sub OnEndPage()
Set MyScriptingContext = Nothing
Set MyApplication = Nothing
Set MyRequest = Nothing
Set MyResponse = Nothing
Set MyServer = Nothing
Set MySession = Nothing
End Sub
'½¨Á¢×Ô¶¨Ò庯ÊýSayHello
Public Sub SayHello()
MyResponse.Write ("Hello World")
End Sub
'Code End
4¡¢½«ÀàÃû¸ÄΪ£ºHelloWorld ½«¹¤³ÌÃû¸ÄΪ£ºTestVBCode
5¡¢Éú³ÉTestVBCode.DLLÎļþ£¬²¢Ê¹ÓÃWindowsÔËÐÐ×¢²á×é¼þÃüÁîRegsvr32 ·¾¶\TestVBCode.DLL×¢²áºó¼´¿ÉʹÓᣣ¨Ð¶ÔØ×é¼þÃüÁîΪRegsvr32 /u ·¾¶\TestVBCode.DLL£©
6¡¢½¨Á¢Test.aspÎļþ£¬´úÂëÈçÏÂ
<%
'VB×Ô½¨º¯Êýµ÷Óøñʽ
'Set ¶ÔÏóÃû=Server.CreateObject("¹¤³ÌÃû.ÀàÃû")
'¶ÔÏóÃû.×Ô½¨º¯ÊýÃû
Set MyTestObj = Server.CreateObject("TestVBCode.HelloWorld")
MyTestObj .SayHello
%>
7¡¢ÔËÐÐTest.aspÎļþ½á¹ûÏÔʾÈçÏ£º
Hello World
=================
ÒÔÉÏ´úÂëÔÚVB6,Win2003ϲâÊÔͨ¹ý.
˵Ã÷:
ÉùÃ÷²¿·Ö:ÎÒÃÇÔÚµ÷ÓÃ×Ô¼ºµÄaplactionʱ,ÏÈÒªÉùÃ÷
OnStartPage²¿·Ö:µ±ASPÖ´ÐÐʱ¾ÍÊÇÔÚ·þÎñÆ÷ÉÏ´´½¨ÕâÐ
Ïà¹ØÎĵµ£º
Option Explicit
Private Const ERROR_CACHE_FIND_FAIL As Long = 0
Private Const ERROR_CACHE_FIND_SUCCESS As Long = 1
Private Const ERROR_FILE_NOT_FOUND As Long = 2
Private Const ERROR_ACCESS_DENIED As Long = 5
Private Const ERROR_INSUFFICIENT_BUFFER As Long = 122
Private Const MAX_PATH As Long ......
1.ÓïÑÔ/»·¾³»ù´¡
--ÏîÄ¿µÄ×é³É
--ÓïÑÔ»ù´¡
----±äÁ¿µÄ×÷ÓÃÓòºÍÉú´æÆÚ
----»ù±¾Óï¾ä(forÑ»·,¸³ÖµÓï¾älet(ÆÕͨ±äÁ¿¸³Öµ),set(¶ÔÏóµÄ¸³Öµ,Ö»ÓÃset),·ÖÖ§Óï¾ä)
----¾²Ì¬Êý×éºÍ¶¯Ì¬Êý×é(Êý×éµÄÉùÃ÷,ÉÏϽçÈ·¶¨,¶¯Ì¬Êý×éµÄʹÓÃ,¶¨ÒåеÄÖ®ºó,Ôõô±£ÁôÒÔÇ°µÄÊý¾Ý)
----Ö÷ÒªµÄϵͳº¯ÊýºÍ¹ý³Ì(By ......
GetAllSettings£¨appname£¬section£©
GetSetting£¨appname£¬section£¬key[£¬default]£© £º¶Áȡע²á±íÐÅÏ¢
SaveSetting appname£¬section£¬key£¬setting£ºÏò×¢²á±íÖÐдÈëÒ»¸ö×¢²áÐÅÏ¢
deletesetting appname£¬section£¬key£¬setting£ºÉ¾³ý×¢²á±íÐÅÏ¢
·appname£ºÓ¦ÓóÌÐòÃû£¬×Ö·û´®ÀàÐÍ£¬Óû§Ö¸¶¨
·sec ......
ÒýÑÔ
²ÉÓÃWEB¼¼ÊõʵÏÖB/S£¨ä¯ÀÀÆ÷/·þÎñÆ÷£©½á¹¹µÄ¹ÜÀíϵͳÊǰ칫×Ô¶¯»¯µÄ·¢Õ¹Ç÷ÊÆ¡£»ùÓÚWEB¼¼ÊõµÄ¹ÜÀíϵͳ£¬ÓÉÓÚ¿ª·¢ÖÜÆڶ̣»ÓëÓû§Æ½Ì¨Î޹أ»Ò×ÓÚʵÏÖ½»»¥Ê½Ó¦Óã»ÄܶÔÐÅÏ¢½øÐпìËÙ¡¢¸ßЧµÄÊÕ¼¯¡¢´¦ÀíºÍ·¢²¼£¬½ü¼¸ÄêÀ´µÃµ½ÁËѸËÙ·¢Õ¹¡£¶øASP¼¼ÊõÓÉÓÚÆ俪·¢Ð§Âʸߡ¢½»»¥ÐԺ㬰²È«ÐÔÇ¿µÈÌص㣬Öð½¥³ÉΪ¿ª·¢¹ÜÀíϵͳ ......