ʹÓÃ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Ö´ÐÐʱ¾ÍÊÇÔÚ·þÎñÆ÷ÉÏ´´½¨ÕâÐ
Ïà¹ØÎĵµ£º
½ñÌìÔÚµ÷ÊԵĹý³ÌÖз¢ÏÖ ÔÚvbÖÐÆ´SQLµÄʱºò·¢ÏÖ"()" ×÷Óúܴó
eg: table: T_TEST col : T_KB int ,S_CD int ,Z_SU int
dim gcstrT_1 ,gcstrT_3 as integer
gcstrT_1 = 1
gcstrT_3 = 3
strWhere = strWhere & "……"
strWhere = strWhere & "AND ((T_K ......
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 ......
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" ......