ʹÓÃ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Ö´ÐÐʱ¾ÍÊÇÔÚ·þÎñÆ÷ÉÏ´´½¨ÕâÐ
Ïà¹ØÎĵµ£º
ÊÔ×ÅÓÃÁËÒ»ÏÂMindManager,ʹÓúÜÈÝÒ×,ÏÂÃæÊÇÎÒÁ·Ï°×Å×öµÄÒ»¸öͼÐÎ,Ï£ÍûÒÔºó»áÔ½ÓÃÔ½ÊìÁ·,×öµÃ¸üºÃ!
& ......
VBÎÞËù²»ÄÜÖ®Î壺½¨Á¢“±ê×¼”DLL¶¯Ì¬Á´½Ó¿âÎļþ£¨2£©
——×÷ÕߣºÖÓÉù
²©¿ÍµØÖ·£ºhttp://blog.csdn.net/useway
×òÌìÎÒÃǽ²µ½£¬ÈçºÎͨ¹ýÌØÊâ·½·¨»ñÈ¡OBJÎļþ£¬ÄÇô½ñÌìÎÒÃǼÌÐø½²ÈçºÎ½øÐбàÒëÁ¬½Ó¡£
  ......
GetAllSettings£¨appname£¬section£©
GetSetting£¨appname£¬section£¬key[£¬default]£© £º¶Áȡע²á±íÐÅÏ¢
SaveSetting appname£¬section£¬key£¬setting£ºÏò×¢²á±íÖÐдÈëÒ»¸ö×¢²áÐÅÏ¢
deletesetting appname£¬section£¬key£¬setting£ºÉ¾³ý×¢²á±íÐÅÏ¢
·appname£ºÓ¦ÓóÌÐòÃû£¬×Ö·û´®ÀàÐÍ£¬Óû§Ö¸¶¨
·sec ......
Option Explicit
Private Declare Function CreatePipe Lib "kernel32" (phReadPipe As Long, phWritePipe As Long, lpPipeAttributes As SECURITY_ATTRIBUTES, ByVal nSize As Long) As Long
Private Declare Function WriteFile Lib "kernel32" ......
dim conn,connstr
Set conn = Server.CreateObject("ADODB.Connection")'´´½¨Ò»¸öÊý¾Ý¿âÁ´½Ó¶ÔÏóconn£¬·½±ãºóÃæµ÷ÓÃ
connstr="Provider=SQLOLEDB;Data Source=(local);Initial Catalog=111;User ID=sa;Password=1234;" '´´½¨Ò»¸öÊý¾Ý¿âµÄrecordset¶ÔÏ󣬷½±ãÒÔºóµ÷ÓÃ
conn.Open connstr'´ò¿ªÊý¾Ý¿â ......