導航:首頁 > 文件管理 > ahk讀取配置文件

ahk讀取配置文件

發布時間:2024-07-15 20:19:40

Ⅰ VB闂棰 錛氭柊寤哄伐紼嬩腑鐨勯棶棰

淇濆瓨灞炴х殑鍙樺寲銆 娉ㄦ剰Property DataServerName鏂規硶鐨勭敤娉曪紝姝ゆ柟娉曚笌ReadProperties 鍜學riteProperties浜嬩歡鍦ㄤ竴璧蜂嬌鐢ㄣ 姝ゆ椂闇瑕佷嬌鐢ㄧ敤鎴鋒帶浠剁殑InitProperties浜嬩歡鎸囧畾姝ゅ睘鎬х殑鍒濆嬪礆細 Private Sub UserControl_InitProperties() m_DataServerName = m_def_DataServerName End Sub 鍗充嬌鐢ㄦ埛娌℃湁璁劇疆鍒濆嬪礆紝榪欎簺浠g爜涔熶細紜淇濊劇疆浜嗕竴涓鍒濆嬪箋 鑷充簬DataBaseName銆丄dministratorName銆丳asseordName 灞炴х殑鍒涘緩榪囩▼璺烡ataServername灞炴х殑鍒涘緩榪囩▼瀹屽叏涓鏍鳳紝榪欓噷灝變笉鍐嶉噸澶嶅彊榪般 鈼嗕嬌鐢≒ropertyBag瀵硅薄 鐢ㄦ埛榪橀渶瑕佷負WriteProperties鍜孯eadProperties浜嬩歡鍒涘緩浠g爜,浠庤屼繚鎶DataServername銆丏ataBaseName銆丄dministratorName銆丳asseordName灞炴у湪璁捐¢樁孌電殑灞炴у箋傝繖涓や釜浜嬩歡閮戒嬌鐢≒ropertyBag 瀵硅薄淇濆瓨鍜屾緔DataServername銆丏ataBaseName銆丄dministratorName銆丳asseordName灞炴х殑鍊箋侾ropertyBag瀵硅薄鑳藉熶繚鎸丏ataServername銆丏ataBaseName銆 AdministratorName銆丳asseordName鐨勮捐″箋傚叿浣撳疄鐜頒唬鐮佸備笅錛 Private Sub UserControl_ReadProperties(PropBag As PropertyBag) m_DataServerName = PropBag.ReadProperty("DataServerName", m_def_DataServerName) m_DataBaseName = PropBag.ReadProperty("DataBaseName", m_def_DataBaseName) m_AdministratorName = PropBag.ReadProperty("AdministratorName", m_def_AdministratorName) m_PasswordName = PropBag.ReadProperty("PasswordName", m_def_PasswordName) End Sub Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("DataServerName", m_DataServerName, m_def_DataServerName) Call PropBag.WriteProperty("DataBaseName", m_DataBaseName, m_def_DataBaseName) Call PropBag.WriteProperty("AdministratorName", m_AdministratorName, m_def_AdministratorName) Call PropBag.WriteProperty("PasswordName", m_PasswordName, m_def_PasswordName) End Sub 鐢變簬榪欎袱涓榪囩▼鏄閽堝"瀹瑰櫒"瀵硅薄鐨勶紝鍥犳ゆ墍鏈夊睘鎬у肩殑淇濆瓨鍜岃誨彇閮介氳繃榪欎袱涓榪囩▼鏉ュ疄鐜幫紝鑰屼笉鏄姣忎釜灞炴ч兘闇瑕佸崟鐙鐨勪袱涓榪囩▼銆傚叾涓錛孭ropertyBag灝辨槸"瀹瑰櫒瀵硅薄"鐨勫悕縐般 WriteProperty鏂規硶鏈変笁涓鍙傛暟錛氱涓涓瀛楃︿覆鏍囪瘑闇瑕佷繚瀛樼殑灞炴э紝絎浜屼釜鍙傛暟鏄闇瑕佷繚瀛樼殑鍊礆紝鏈鍚庣殑鍙傛暟鏄灞炴х殑緙虹渷鍊箋 ReadProperty 鏂規硶闇瑕佷袱涓鍙傛暟錛氫竴涓瀛楃︿覆鐢ㄦ潵淇濆瓨灞炴х殑鍚嶇О錛屽彟涓涓涓虹己鐪佸箋 鍦ㄧ獥浣撲笂緇樺埗ActiveX鎺т歡鐨勯偅涓鍒伙紝灝變細寮濮嬫墽琛孉ctiveX鎺т歡鐨勪唬鐮併傚湪鎺т歡璁捐¤繃紼嬩腑錛屽皢DataServername銆丏ataBaseName銆丄dministratorName銆丳asseordName灞炴х殑榛樿ゅ艱劇疆涓猴細 Const m_def_DataServerName = "lyc" Const m_def_DataBaseName = "pubs" Const m_def_AdministratorName = "sa" Const m_def_PasswordName = "" 褰撶劧錛屼篃鍙浠ュ湪紼嬪簭榪愯屾椂澶氭′慨鏀瑰畠銆傛帶浠剁殑姝e父琛屼負鏄褰撶▼搴忕粓姝㈡椂鎮㈠嶅叾榛樿ゅ礆紝榪欐牱澧炲姞浜嗕繚鎸佸睘鎬х殑涓ょ嶇嫭絝嬬姸鎬佺殑瑕佹眰銆 綆璦涔嬶紝濡傛灉鍦ㄨ捐¢樁孌墊敼鍙樹簡涓涓灞炴у礆紝閭d箞鎺т歡蹇呴』寰楀埌榪欎釜鏂板礆紝鑰屼笉鏄浣跨敤榛樿ゅ箋傜浉鍙嶏紝濡傛灉鍦ㄧ▼搴忚繍琛屾椂鏀瑰彉灞炴у礆紝閭d箞褰撹繑鍥炶捐$姸鎬佹椂錛屾帶浠跺繀欏繪緔㈡ゅ睘鎬у箋 PropertyBag瀵硅薄鍏佽窤ctiveX鎺т歡瀛樿串鏈夊叧瀹冭嚜宸辯殑灞炴у礆紝浣垮畠鑳芥墽琛岃繖涓鍔ㄤ綔銆侾ropertyChanged 鏂規硶浼氶氱煡鐢ㄦ埛宸茬粡鏀瑰彉浜嗕竴涓灞炴с傞氳繃浜嗚В紼嬪簭鐨勭姸鎬佷互鍙婃槸鍚﹁皟鐢ㄤ簡PropertyChanged鏂規硶錛孷B 灝卞彲浠ユ縺鍙慦riteProperties鍜孯eadProperties浜嬩歡銆 鈼嗕負ShowDataBase鏂規硶緙栧啓浠g爜 ShowDataBase鏂規硶瀹炵幇鍦↙istView鎺т歡涓鏄劇ずSelect鍛戒護鎵鎵ц岀殑鏁版嵁搴撴搷浣滅粨鏋溿傚湪鍏跺叿浣撳疄鐜拌繃紼嬩腑閲囩敤浜 ADO錛圓ctiveX Data Objects錛夌殑鏁版嵁瀛樺彇鏂規硶銆侫DO鐨勪富瑕佺壒鐐規槸浣跨敤鏇村姞瀹規槗錛岃塊棶閫熷害鏇村揩,鑰屽圭佺洏鍜屽瓨鍌ㄥ歸噺鐨勮佹眰鏇村皬,ADO鏀鎸佸緩絝嬪悇縐嶅㈡埛/鏈嶅姟鍣ㄦā寮忎笌鍩轟簬Web鐨勫簲鐢ㄧ▼搴忥紝鍏鋒湁榪滅▼鏁版嵁鏈嶅姟RDS錛圧emote Data Service錛夌殑鐗規э紝閫氳繃RDS鑳藉熷湪涓嬈″線榪斾腑灝嗘湇鍔″櫒絝鐨勬暟鎹浼犻佸埌瀹㈡埛絝鐨勫簲鐢ㄧ▼搴忔垨Web欏甸潰涓錛屽苟鍦ㄥ㈡埛絝瀵規暟鎹榪涜屽勭悊鍚庯紝絝嬪嵆鏇存柊鏈嶅姟鍣ㄧ鐨勬暟鎹銆傞噰鐢ˋDO鎵鍩轟簬鐨凮LE DB鎶鏈錛屽彲浠ュ圭數瀛愰偖浠躲佹枃鏈鏂囦歡銆佹暟鎹琛ㄦ牸絳夊悇綾繪暟鎹閫氳繃緇熶竴鐨勬帴鍙API鎺ュ彛榪涜屽瓨鍙栵紝鏄榪滅▼鏁版嵁瀛樺彇鐨勪竴涓涓昏佸彂灞曟柟鍚戙係howDataBase鏂規硶鍏鋒湁涓涓瀛楃︿覆鍙傛暟錛屼絾鏃犱換浣曡繑鍥炲礆紝鍏蜂綋浠g爜濡備笅鎵紺猴細 Public Sub showdatabase(ssql As String) Dim AdoDatabase As New ADODB.Connection Dim AdoTable As New ADODB.Recordset Dim scnn As String Dim response As String Dim I As Integer On Error GoTo errorhandle scnn = "Provider=SQLOLEDB;Data Source=" & Trim(m_DataServerName) & "; Initial Catalog=" & Trim(m_DataBaseName) & "; User Id=" & Trim(m_AdministratorName) & "; Password=" & Trim(m_PasswordName) & ";" AdoDatabase.Open scnn AdoTable.CursorType = adOpenKeyset AdoTable.LockType = adLockOptimistic AdoTable.CursorLocation = adUseClient AdoTable.Open ssql, AdoDatabase, , , adCmdText If AdoTable.BOF And AdoTable.EOF Then response = MsgBox("娌℃湁絎﹀悎鏉′歡鐨勮板綍錛侊紒", vbOKOnly + vbInformation, "鏁版嵁搴撴帶浠") AdoTable.Close Set Adotable=Nothing AdoDatabase.Close Set AdoDataBase=Nothing Exit Sub End If ListView1.ColumnHeaders.Clear ListView1.ListItems.Clear Dim clmX As ColumnHeader For I = 0 To AdoTable.Fields.Count - 1 Set clmX = ListView1.ColumnHeaders.Add() With clmX .Text = AdoTable.Fields(I).Name End With Next Dim itmX As ListItem AdoTable.MoveFirst Do While Not AdoTable.EOF Set itmX = ListView1.ListItems.Add() With itmX If IsNull(AdoTable.Fields(0).Value) Then .Text = "NULL" Else .Text = AdoTable.Fields(0).Value End If End With For I = 1 To AdoTable.Fields.Count - 1 If IsNull(AdoTable.Fields(I).Value) Then itmX.SubItems(I) = "NULL" Else itmX.SubItems(I) = AdoTable.Fields(I).Value End If Next AdoTable.MoveNext Loop ListView1.View = lvwReport AdoTable.Close Set Adotable=Nothing AdoDatabase.Close Set AdoDataBase=Nothing Exit Sub errorhandle: RaiseEvent Errordatabase End Sub 褰撳規暟鎹搴撶殑鎿嶄綔鍙戠敓閿欒鍚庯紝闄や簡涓嶈兘姝e父鏄劇ず浠ュ栵紝榪樺簲閫氱煡瀹誇富紼嬪簭鐢ㄦ埛銆傚彲浠ラ氳繃鍒涘緩涓涓鍙鍋欵rrordatabase鐨勪簨浠跺疄鐜頒笂榪板姛鑳姐傝佸壋寤鴻繖涓浜嬩歡錛屾妸涓嬭堪浠g爜娣誨姞鍒癠serControl瀵硅薄鐨凣eneralDeclarations孌典腑銆 Public Event Errordatabase() 姝や簨浠剁殑宸ヤ綔鍍忓叾浠栨帶浠剁殑浜嬩歡涓鏍楓備嬌鐢ㄦ帶浠剁殑鐢ㄦ埛鍙浠ュ皢浠g爜鏀懼埌榪欎釜浜嬩歡涓錛岀敤鎴瘋佸仛鐨勫敮涓鐨勪簨鎯呭氨鏄鐢≧aiseEvent鏂規硶嬋鍙戞や簨浠躲 錛7錛夌紪璇戞帶浠墮儴浠訛紙.ocx 鏂囦歡錛夈 鐜板湪宸茬粡瀹屾垚浜咲ataListView鎺т歡鐨勫壋寤哄伐浣滐紝涓轟簡鍦―ataLV宸ョ▼澶栦篃鍙浠ヤ嬌鐢ㄨユ帶浠訛紝鍙闇灝咲ataLV宸ョ▼緙栬瘧.ocx鎺т歡閮ㄤ歡鍗沖彲銆 鍦ㄣ愬伐紼嬬粍銆戠獥鍙e崟鍑匯怐ataLV銆戜互閫夋嫨璇ュ伐紼嬶紝鍦ㄣ愭枃浠躲戣彍鍗曚笂鍗曞嚮銆愮敓鎴怐ataLV.ocx銆戱紝鍦ㄣ愮敓鎴愬伐紼嬨戝硅瘽妗嗕腑閫夋嫨鎺т歡瀛樻斁鐨勭洰褰曞悗錛 鍗曞嚮銆愮『瀹氥戝嵆鍙鍒涘緩.ocx 鏂囦歡銆 涓鏃︾敓鎴愪簡.ocx鏂囦歡鐨勬帶浠訛紝灝卞彲浠ヨ薄浣跨敤鍏跺畠鎺т歡涓鏍鋒潵闅忓績鎵嬈插湴浣跨敤瀹冧簡銆 4錛夌粨鏉熻 ActiveX鎶鏈鍙浠ョ伒媧匯侀珮鏁堢殑瀹炵幇鍙浜や簰銆侀噸鍏ャ侀噸鐢ㄣ佸畬鍏ㄥ垎甯冨紡銆佷笌璇璦鏃犲叧鐨勫悇縐嶅簲鐢ㄣ傞殢鐫ActiveX鎶鏈鐨勫彂灞曪紝ActiveX鎺т歡鍦ㄥ簲鐢ㄧ▼搴忎腑鐨勪綔鐢ㄥ皢浼氭樉寰楄秺鏉ヨ秺 閲嶈侊紝閭d箞鍒涘緩涓涓鍔熻兘瀹屽杽銆佸叿鏈夎嚜宸辯壒鑹茬殑ActiveX鎺т歡灝遍潪甯稿叿鏈夌幇瀹炴剰涔夈傚彧瑕佹帉鎻′簡鍒涘緩ActiveX鎺т歡鐨勫熀鏈鏂規硶錛屽氨涓嶉毦鍒涘緩鑷瀹氬埗鐨勫彲鍦ㄥ悇縐嶅簲鐢ㄩ嗗煙浣跨敤鐨凙ctiveX鎺т歡銆 浣嗘槸錛孉ctiveX鎶鏈涔熸湁涓浜涙槑鏄劇己鐐癸紝ActiveX鎶鏈渚濊禆浜嶹indows騫沖彴錛屽瑰箍娉涘簲鐢ㄧ殑UNIX騫沖彴鐩鍓嶄粛涓嶅吋瀹癸紝鍙﹀ ActiveX鍦ㄨ稿氭柟闈㈢殑鎬ц兘榪樿緝寮憋紝ActiveX鎶鏈浠嶉渶瑕佷笉鏂瀹屽杽鍜屽彂灞

閱讀全文

與ahk讀取配置文件相關的資料

熱點內容
看直播數據用哪個平台最好 瀏覽:730
win10晶元驅動程序版本 瀏覽:763
如何給word添加公式編輯器 瀏覽:666
iphone桌面文件夾怎樣合並 瀏覽:919
要我蘋果賬號密碼忘記了怎麼辦 瀏覽:578
快快卡在配置游戲文件 瀏覽:393
數據包重發時間怎麼調整 瀏覽:882
youtubeapp怎麼下載 瀏覽:366
編程檢測是什麼 瀏覽:753
網路攝像機的傳輸距離 瀏覽:941
超值貓qq群購秒殺群 瀏覽:138
pdf文件能備注嗎 瀏覽:174
html可視化數據源碼在哪裡 瀏覽:387
adobereader專用卸載工具 瀏覽:28
vivo手機數據如何備份 瀏覽:888
ithmb文件轉換器 瀏覽:66
看病找什麼網站好 瀏覽:579
linux如何查看文件系統 瀏覽:581
linux統計點頻率 瀏覽:627
全民泡泡大戰安琪兒升級 瀏覽:620

友情鏈接