PIXNET Logo登入

No Money No Honey

跳到主文

Just Another Beginning

部落格全站分類:

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 12月 08 週二 202016:52
  • DELPHI 寫入讀取INI範例

程式範例

uses
     inifiles;

procedure TForm1.btn3Click(Sender: TObject);
var
   inifile: TInifile;
   iniFileName,sAppPath,sMusicDir,sImageDir:string;
begin
   //獲取當前程式的路徑
   //sAppPath:=ExtractFilePath(Application.ExeName);
   iniFileName:='testset.ini'; //設定ini檔案儲存名稱

  inifile:=TInifile.Create('INI\'+iniFileName); //執行目錄下的 INI目錄內建立 testtest.ini

  //寫配置資訊
   inifile.writeString('TESTSET','123','Pictures'); // 大標籤[TESTSET] , 底下的 123=Picture 參數
   inifile.writeString('TESTSET','456','Music');

  //讀取配置資訊
   sImageDir:=inifile.readString('TESTSET','123',''); //讀取[TESTSET]底下 123='' 的''字串值
   sMusicDir:=inifile.readString('TESTSET','456','');

end;

INI檔案範例

[TESTSET]
123=Pictures
456=Music


(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(73)

  • 個人分類:DELPHI程式語言
▲top
  • 12月 07 週一 202021:04
  • DELPHI使用lkJSON多層次一般取值與陣列取值範例


文章出處
http://rakelitica.blogspot.com/2012/07/using-lkjson-example-with-google-drive.html

JSON文件範本(可貼到 https://jsoneditoronline.org/#left=local.lapedo&right=local.vaxeha 幫你線上格式化JSON比較好看懂)

{
  "kind": "drive#fileList",
  "etag": "\"ia2FS23424234234ANFYAdsc1Tyua2KKA-HnMs\"",
  "selfLink": "
https://www.googleapis.com/drive/v2/files",
  "items": [
   {
    "kind": "drive#file",
    "id": "0BwtHRVB3TFRHVllvRVE",
    "etag": "\"ia2H5NSXK_wk/MTM0MTc3MTMwMTU5Mg\"",
    "selfLink": "
https://www.googleapis.com/drive/v2/files/0BwPgllvRVE",
    "alternateLink": "
https://docs.google.com/folder/d/0BwPgllvRVE/edit",
    "permissionsLink": "
https://www.googleapis.com/drive/v2/files/0BwPgllvRVE/permissions",
    "title": "Folder0",
    "mimeType": "application/vnd.google-apps.folder",
    "description": "Folzer Zero",
    "labels": {
     "starred": false,
     "hidden": false,
     "trashed": false,
     "restricted": false,
     "viewed": true
    },
    "createdDate": "2012-07-08T18:13:51.185Z",
    "modifiedDate": "2012-07-08T18:15:01.592Z",
    "modifiedByMeDate": "2012-07-08T18:15:01.592Z",
    "lastViewedByMeDate": "2012-07-08T18:15:07.039Z",
    "parents": [
     {
      "kind": "drive#parentReference",
      "id": "0AAPgHUk9PVA",
      "selfLink": "
https://www.googleapis.com/drive/v2/files/0BwPgllvRVE1/parents/0AA6_KcYtHUk9PVA",
      "parentLink": "
https://www.googleapis.com/drive/v2/files/0AA6_KcYtHUk9PVA",
      "isRoot": true
     }
    ],
    "userPermission": {
     "kind": "drive#permission",
     "etag": "\"ia2FSHMEjvcFQvtI4rH3hoJimnEgfM\"",
     "id": "current",
     "role": "owner",
     "type": "user"
    },
    "quotaBytesUsed": "0",
    "ownerNames": [
     "Artur"
    ],
    "lastModifyingUserName": "Artur",
    "editable": true,
    "writersCanShare": true
   },
   {
    "kind": "drive#file",
   }
   {
    "kind": "drive#file",
   }
  ]
}


(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(182)

  • 個人分類:DELPHI程式語言
▲top
  • 2月 24 週一 202011:40
  • 呼叫外部程式達成SFTP連線

出處https://dotblogs.com.tw/jean/2013/11/06/126876

有些早期舊程式語言並沒有支援SFTP元件,可透過呼叫外部程式來達成


SFTP使用WinSCP

SFTP使用WinSCP

(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(365)

  • 個人分類:DELPHI程式語言
▲top
  • 2月 20 週四 202017:38
  • [Delphi 7](2014.3.3改)Indy 10 網路元件安裝-複製文章保留用

感謝作者
出處:
http://idlemanhome.blogspot.com/2013/12/delphi-7indy-10.html

Delphi 7](2014.3.3改)Indy 10 網路元件安裝

舊的方法原本是以下這樣,後來我裝新的XP系統時發現無法成功

首先從 http://www.indyproject.org/downloads/10/indy10.0.52_source.zip 下載壓縮檔。
(或是到這個網頁找
http://www.indyproject.org/sockets/download/files/indy10.en.aspx )

Indy 10 安裝步驟:

(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(1,005)

  • 個人分類:DELPHI程式語言
▲top
  • 12月 09 週四 201018:24
  • DELPHI 7 使用ADO元件寫入資料庫強制四捨五入小數到第四位問題

DELPHI 7 使用ADO元件寫入資料庫強制四捨五入小數到第四位問題

parameters.parambyname('tmpprice').datatype:=ftFloat;   <==寫入資料前先將欄位設定成 Float 型態即可解決此問題。

參考:http://jzinfo.javaeye.com/blog/432853

  1. var   
  2.     adoquery1:Tadoquery;   
  3. begin   
  4.     adoquery1:=Tadoquery.create(nil);   
  5.     try   
  6.        if not DM.adonconnection1.connected then   
  7.            DM.adoconnection1.connected:=true;   
  8.        adoquery1.connection:=DM.adoconnection1;   
  9.        adoquery1.enableBCD:=False;       //禁用bcd类型   
  10.        with adoquery1 do   
  11.        begin   
  12.            close;   
  13.            sql.clear;   
  14.            sql.add('insert into materialInfo values(:tmppno,:tmpvendor,:tmpdesc,:tmpprice)');   
  15.            parameters.parambyname('tmppno').value:=trim(edit1.text);   
  16.            parameters.parambyname('tmpvendor').value:=trim(edit2.text);   
  17.            parameters.parambyname('tmpdesc').value:=trim(edit3.text);   
  18.            parameters.parambyname('tmpprice').datatype:=ftFloat;       //设置下数据类型   
  19.            parameters.parambyname('tmpprice').value:=trim(edit4.text);   
  20.            execsql;   
  21.        end;   
  22.     finally   
  23.         adoquery1.free;   
  24.     end;   
  25. end; 

(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(448)

  • 個人分類:DELPHI程式語言
▲top
  • 10月 11 週一 201018:14
  • DELPHI下使用FileSetDate()函式修改檔案的”修改日期”

Delphi下使用function FileSetDate(Handle: Integer; Age: Integer): Integer; overload;函式修改檔案的”修改日期”:

參考:http://delphi.ktop.com.tw/board.php?cid=30&fid=70&tid=37667

procedure TForm1.Button1Click(Sender: TObject);
Var
    FileHandle : Integer;
    Str : String;
begin
    FileHandle := FileOpen('D:\prog\1.txt', fmOpenReadWrite);
    if FileHandle = -1 then
      ShowMessage('開啟檔案失敗')
    else
    begin
      Str := '檔案原來日期時間: '+ DateTimeToStr(FileDateToDateTime(FileGetDate(FileHandle)))+#10#13;
      if FileSetDate(FileHandle, FileAge('D:\prog\AMS.exe')) = 0 then
        Str := Str+DateTimeToStr(FileDateToDateTime(FileAge('D:\prog\AMS.exe')))
      else
        Str := Str+'新的日期時間設定失敗';
      ShowMessage(Str);
    end;
    FileClose(FileHandle);
end;

(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(564)

  • 個人分類:DELPHI程式語言
▲top
  • 7月 12 週一 201015:46
  • DELPHI寫入EXCEL時,寫入速度緩慢問題

最近在修改使用者提出 EXCEL 報表欄位,發現有幾支 procedure 轉出 EXCEL 的速度非常龜,而這幾支 procedure 是前輩所留下的產物,跟自己最近寫的轉 EXCEL 報表速度上差很多,以為是卡在SQL查詢,如果查詢條件KEY值給不齊全,有可能因為資料過多,查詢變很慢,但是測試後應該不是SQL查詢的問題,再對照前輩與自己的程式,感覺不出差異,最後看到 DELPHI 內設定EXCEL時前面通常會有一些基本設定,發現了這幾支程式都有設定列印範圍,姑且註解掉試試看,果然...............兇手就是它!

PageSetup.PrintArea := 'A:R';  //設定列印範圍

建議把它移到資料轉完後,最後在給上這個參數就好了。

(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(589)

  • 個人分類:DELPHI程式語言
▲top
  • 6月 30 週三 201012:01
  • DELPHI 7 下將文字存成UTF8格式

(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(7,410)

  • 個人分類:DELPHI程式語言
▲top
  • 6月 14 週一 201017:48
  • DELPHI7 使用TIdWatch 元件抓本機IP

使用 TIdIPWatch 元件即可直接抓取執行程式的本機IP。

showmessage(IdIPWatch1.LocalIP);

會想要本基IP是想要讓自動更新程式自動判斷使用者電腦所在位置,因公司有很多據點,如果大家都回來抓更新檔,頻寬會.......

(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(127)

  • 個人分類:DELPHI程式語言
▲top
  • 4月 12 週一 201019:07
  • [Delphi]讓Windows捲軸捲動時,資料內容同時跟著平滑捲動。

讓Windows捲軸捲動時,資料內容同時跟著平滑捲動。

出處:

http://delphi.ktop.com.tw/board.php?cid=168&fid=918&tid=100386

http://delphi.ktop.com.tw/board.php?cid=30&fid=66&tid=70761


   TDBGrid = Class(DBGrids.TDBGrid)
    Protected
    procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
    end;
    TForm1 = class(TForm)
    ....
...
procedure TDBGrid.WMVScroll(var Message: TWMVScroll);
begin
    if Message.ScrollCode = SB_THUMBTRACK then Message.ScrollCode := SB_THUMBPOSITION;
    inherited;
end;

(繼續閱讀...)
文章標籤

NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣(358)

  • 個人分類:DELPHI程式語言
▲top
123»

自訂側欄

自訂側欄

個人資訊

NoMoney NoHoney
暱稱:
NoMoney NoHoney
分類:
好友:
累積中
地區:

熱門文章

  • ()Windows系統日誌管理
  • ()公司部門英文縮寫簡稱大全(1)
  • ()簡單公式實現Excel自動編號
  • ()免費的頻寬限速軟體
  • ()DELPHI 字串函式大全
  • ()Delphi控制Excel範例大全
  • ()Client端GPO群組原則派送結果查詢(使用控制台的方式)
  • ()20170421-BENZ線上車身碼零件料號查詢系統
  • ()Chrome Line 無法複製訊息問題處理(更新重開機免重設方式)
  • ()如何從Windows 7升級到Windows 10 出現 0x80072F8F - 0x20000 問題排除

文章分類

  • 未分類文章 (1)

最新文章

    動態訂閱

    文章精選

    文章搜尋

    誰來我家

    參觀人氣

    • 本日人氣:
    • 累積人氣: