婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 用ASP+DLL實(shí)現(xiàn)WEB方式修改服務(wù)器時間

用ASP+DLL實(shí)現(xiàn)WEB方式修改服務(wù)器時間

熱門標(biāo)簽:怎么在地圖標(biāo)注自己 外呼系統(tǒng)API接口 縣域地圖標(biāo)注打印店 鳳臺百度地圖標(biāo)注店 萊西電子地圖標(biāo)注 個人可以辦理400電話么 金昌電話機(jī)器人價格 武夷山旅游地圖標(biāo)注 修改地圖標(biāo)注
昨天一個朋友有個需求,是要通過WEB方式,修改IIS服務(wù)器上的時間,由于他的系統(tǒng)是ASP 3.0下開發(fā)的,所以本例子的代碼是ASP的,不是ASP.NET,但是本人寫這個文章是想拋磚引玉,畢竟編寫程序關(guān)鍵的不是語言,更重要的是一種思想,把程序語言理解為一種工具,把編程思想理解為解決問題的思路和方法,那么編寫出來的程序就是:利用“工具”按照解決問題的“思想”去解決一個問題。

首先,要感謝網(wǎng)友“小虎”,我是在網(wǎng)上看了他寫的一篇關(guān)于用VB 6.0編寫DLL組件FOR ASP的文章改寫的,他的DLL代碼只實(shí)現(xiàn)了改寫小時和分鐘,我增加了年、月、日、秒的修改。

首先,在VB 6.0中建立一個ActiveX Dll工程項(xiàng)目,信息如下:

工程名稱:systimeset
類模塊名稱:timeset

VB 6.0的類模塊代碼如下:
復(fù)制代碼 代碼如下:

Option Explicit
Private SystemTime As SystemTime
Private Declare Function SetSystemTime()Function SetSystemTime Lib "kernel32" (lpSystemTime As SystemTime) As Long
Private Type SystemTime
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Integer
End Type

Dim tmp

Private m_Hour As Integer
Private m_Minute As Integer
Private m_Year As Integer
Private m_Month As Integer
Private m_Day As Integer
Private m_Second As Integer

'由李錫遠(yuǎn)修改     修改日期:2006-08-31     修改項(xiàng)目:增加對年、月、日、秒的操作
'--------------------
'年
Public Property Get()Property Get Year() As Integer
Year = m_Year
End Property
Public Property Let()Property Let Year(tmp_Year As Integer)
m_Year = tmp_Year
End Property
'--------------------
'月
Public Property Get()Property Get Month() As Integer
Month = m_Month
End Property
Public Property Let()Property Let Month(tmp_Month As Integer)
m_Month = tmp_Month
End Property
'--------------------
'日
Public Property Get()Property Get Day() As Integer
Day = m_Day
End Property
Public Property Let()Property Let Day(tmp_Day As Integer)
m_Day = tmp_Day
End Property
'--------------------
'秒
Public Property Get()Property Get Second() As Integer
Second = m_Second
End Property
Public Property Let()Property Let Second(tmp_Second As Integer)
m_Second = tmp_Second
End Property



Public Property Get()Property Get Hour() As Integer
Hour = m_Hour
End Property
Public Property Let()Property Let Hour(tmp_Hour As Integer)
m_Hour = tmp_Hour
End Property
Public Property Get()Property Get Minute() As Integer
Minute = m_Minute
End Property
Public Property Let()Property Let Minute(tmp_Minute As Integer)
m_Minute = tmp_Minute
End Property

Public Function setup()Function setup() As Integer
SystemTime.wDay = Day
'SystemTime.wDayOfWeek = 1
SystemTime.wMilliseconds = 0
SystemTime.wMonth = Month
SystemTime.wSecond = Second
SystemTime.wYear = Year
SystemTime.wHour = Hour
SystemTime.wMinute = Minute
setup = SetSystemTime(SystemTime)
End Function

將其編譯為systimeset.dll的文件。

關(guān)于DLL的注冊,通常VB在本機(jī)上編譯后,會自動將DLL注冊;但如果你要放到IIS服務(wù)器上,請使用如下方法:
1、將systimeset.dll拷貝到c:\WINDOWS\system32下;
2、在開始菜單的運(yùn)行里面輸入:regsvr32 systimeset.dll     (敲回車啊)
3、因?yàn)樾薷姆?wù)器的時間,INTERNET來賓帳戶不具有該權(quán)限,設(shè)立權(quán)限請打開控制面版中的“管理工具”,然后打開“本地安全策略”--“用戶權(quán)力指派”,雙擊“更改系統(tǒng)時間”,在彈出的對話框中點(diǎn)“添加用戶或組”,將INETNET來賓帳戶加入進(jìn)來。
4、一切完畢后,將IIS服務(wù)重新啟動一次。


在上面的設(shè)置完畢后,使用systimeset.dll組件的ASP代碼頁面如下:

復(fù)制代碼 代碼如下:

% @language="vbscript" %>
%
function SetTime(strYear,strMonth,strDay)
response.Expires=0
set obj=server.createobject("systimeset.timeset")
    obj.Year=strYear
   obj.Month=strMonth
    obj.Day=strDay
   if Hour(now())-8>0 then
    obj.Hour=Hour(now())-8
    else
    obj.Hour=8
    end if
    obj.Minute=Minute(now())
    obj.Second=Second(now())
    obj.setup

set obj=Nothing
end function

if request("act")="modi" then
    call SetTime(request.Form("strYear"),request.Form("strMonth"),request.Form

("strDay"))
end if
%>
form id="form1" name="form1" method="post" action="?act=modi">
  table width="290" border="0">
    tr>
      td width="77">input name="strYear" type="text" id="strYear" value="%=Year(now())%>" size="8" />/td>
     td width="49">input name="strMonth" type="text" id="strMonth" value="%=Month(now())%>" size="5" />/td>
     td width="48">input name="strDay" type="text" id="strDay" value="%=Day(now())%>" size="5" />/td>
     td width="98">input type="submit" name="Submit" value="修改日期" />/td>
   /tr>
 /table>
/form>

以上是所有實(shí)現(xiàn)的代碼,有問題可以加我QQ:17020415

將上面的ASP代碼頁面粘貼到一個空的ASP文件中,然后在IIS中將站點(diǎn)設(shè)置好就可以了。(設(shè)置IIS虛擬目錄也可以的。)


標(biāo)簽:通遼 南京 邢臺 涼山 清遠(yuǎn) 赤峰 楚雄 上海

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《用ASP+DLL實(shí)現(xiàn)WEB方式修改服務(wù)器時間》,本文關(guān)鍵詞  用,ASP+DLL,實(shí)現(xiàn),WEB,方式,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《用ASP+DLL實(shí)現(xiàn)WEB方式修改服務(wù)器時間》相關(guān)的同類信息!
  • 本頁收集關(guān)于用ASP+DLL實(shí)現(xiàn)WEB方式修改服務(wù)器時間的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 霍州市| 双柏县| 沁阳市| 邻水| 黄冈市| 大冶市| 宿松县| 徐闻县| 甘泉县| 沽源县| 木兰县| 民县| 横山县| 上蔡县| 南江县| 东乡县| 重庆市| 洮南市| 开化县| 崇左市| 葵青区| 湛江市| 三原县| 红桥区| 宝兴县| 盱眙县| 县级市| 千阳县| 沂水县| 洛宁县| 永修县| 长岭县| 远安县| 瓦房店市| 五峰| 芮城县| 宝山区| 宁明县| 山东省| 辰溪县| 炉霍县|