全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2351
推到 Plurk!
推到 Facebook!

請問如何將MODI之VB程式碼改為Delphi程式碼 ?

缺席
ry_lee
高階會員


發表:368
回覆:251
積分:123
註冊:2002-03-19

發送簡訊給我
#1 引用回覆 回覆 發表時間:2011-06-14 15:00:20 IP:111.253.xxx.xxx 未訂閱
Private WithEvents mmiDoc As MODI.Document
Private mblnCancel As Boolean  
Private Sub cmdCancel_Click()      
  ' Set a flag indicating that the user wants to cancel.  
  mblnCancel = True   
End Sub  
  
Private Sub cmdOCR_Click() 
   ' Load an existing TIF file.  
   Set mmiDoc = New MODI.Document   
   mmiDoc.Create "C:\document1.tif"      
   ' Perform OCR on the document   
   Screen.MousePointer = vbHourglass   
   mmiDoc.OCR    
   Screen.MousePointer = vbDefault   
   
   Set mmiDoc = Nothing    
End Sub      Private Sub mmiDoc_OnOCRProgress(ByVal Progress As Long, _        Cancel As Boolean)  
   ' Cancel if user has clicked the Cancel button. 
   If mblnCancel Then      
      Cancel = True    
   End If            ' Indicate progress on the ProgressBar control  
   pbrOCRProgress.Value = Progress  
End Sub
=======================================================================  
  
1.請問紅字體那行程式碼是什麼意思 ? 
 
2.請問如何將上面之VB程式碼改為Delphi程式碼 ?
編輯記錄
ry_lee 重新編輯於 2011-06-14 01:01:58, 註解 無‧
ry_lee 重新編輯於 2011-06-14 01:21:01, 註解 無‧
rick060
高階會員


發表:2
回覆:112
積分:217
註冊:2009-11-17

發送簡訊給我
ry_lee
高階會員


發表:368
回覆:251
積分:123
註冊:2002-03-19

發送簡訊給我
#3 引用回覆 回覆 發表時間:2011-06-14 15:25:43 IP:111.253.xxx.xxx 未訂閱
都沒講到以下兩段碼

Option Explicit
Private WithEvents mmiDoc As MODI.Document



Private Sub mmiDoc_OnOCRProgress(ByVal Progress As Long, _ Cancel As Boolean)
' Cancel if user has clicked the Cancel button.
If mblnCancel Then
Cancel = True
End If
' Indicate progress on the ProgressBar control
pbrOCRProgress.Value = Progress
End Sub

===================引 用 rick060 文 章===================
http://www.delphi3000.com/articles/article_4253.asp?SK=
http://www.delphipages.com/forum/showthread.php?t=197335
編輯記錄
ry_lee 重新編輯於 2011-06-14 01:26:21, 註解 無‧
rick060
高階會員


發表:2
回覆:112
積分:217
註冊:2009-11-17

發送簡訊給我
ry_lee
高階會員


發表:368
回覆:251
積分:123
註冊:2002-03-19

發送簡訊給我
rick060
高階會員


發表:2
回覆:112
積分:217
註冊:2009-11-17

發送簡訊給我
#6 引用回覆 回覆 發表時間:2011-06-14 23:25:43 IP:114.34.xxx.xxx 未訂閱
 以下為例,我想很容易理解。

procedure TForm1.Button1Click(Sender: TObject);
var
pButton : TButton;
begin
pButton := TButton.Create(nil); //新增 Button
pButton.Width := 250;
pButton.Top := 10;
pButton.Left := 10;
pButton.Caption := 'This is Dynamic Button';
pButton.O n K e y D o w n := CustomKeyDown; //設定 Event 進入點
pButton.SetParentComponent(Self);
pButton.Free;
end;
procedure TForm1.CustomKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
ShowMessage('This is it');
end;
編輯記錄
rick060 重新編輯於 2011-06-14 09:26:11, 註解 無‧
rick060 重新編輯於 2011-06-14 09:26:26, 註解 無‧
ry_lee
高階會員


發表:368
回覆:251
積分:123
註冊:2002-03-19

發送簡訊給我
#7 引用回覆 回覆 發表時間:2011-06-14 23:31:24 IP:111.253.xxx.xxx 未訂閱
rick060你好:

1.請問是要搭配microsoft office document imaging 11.0 type library 或 microsoft office document imaging 12.0 type library ?

2.若是microsoft office document imaging 12.0 type library,是要安裝office 2007還是office 2003還是有其他取得之方式 ?

3.以下程式碼是否是使用MODI-TLB.pas而不是MODI_TLB.pas, MODI-TLB.pas要如何產生MODI-TLB.dcu ?


===================引 用 rick060 文 章===================

procedure TMainForm.Document1OCRProgress(ASender: TObject;
Progress: Integer; var Cancel: WordBool);
begin
if mClick then
Cancel := True
else
pProgress.Position := Progress;

end;

http://msdn.microsoft.com/zh-tw/library/y9341s4f(v=vs.80).aspx
再下一行,宣告 event 的進入點



rick060
高階會員


發表:2
回覆:112
積分:217
註冊:2009-11-17

發送簡訊給我
#8 引用回覆 回覆 發表時間:2011-06-14 23:34:19 IP:114.34.xxx.xxx 未訂閱

===================引 用 ry_lee 文 章===================
rick060你好:

1.請問是要搭配microsoft office document imaging 11.0 type library 或 microsoft office document imaging 12.0 type library ?

2.若是microsoft office document imaging 12.0 type library,是要安裝office 2007還是office 2003還是有其他取得之方式 ?

3.以下程式碼是否是使用MODI-TLB.pas而不是MODI_TLB.pas, MODI-TLB.pas要如何產生MODI-TLB.dcu ?


===================引 用 rick060 文 章===================
1. 皆可,版本不同而以
2.office 2003/2007 皆可,版本不同而以 2011 已移除 modi
3.Project -> Import Type Library(d7) / Component -> Import Components 完成後就會產生相應 dcu/pas 所需檔案
ry_lee
高階會員


發表:368
回覆:251
積分:123
註冊:2002-03-19

發送簡訊給我
#9 引用回覆 回覆 發表時間:2011-06-27 19:27:43 IP:111.253.xxx.xxx 未訂閱
rick060你好:

在win xp delphi 7環境下

1.相同程式在office 2003之 MODI可執行,在office 2007之MODI執行卻有錯誤發生,不曉得你有沒有在OFFICE 2007之MODI測試過 ?

2.可否把你的程式碼給秀出來

===================引 用 ry_lee 文 章===================
rick060你好:

1.請問是要搭配microsoft office document imaging 11.0 type library 或 microsoft office document imaging 12.0 type library ?

2.若是microsoft office document imaging 12.0 type library,是要安裝office 2007還是office 2003還是有其他取得之方式 ?

3.以下程式碼是否是使用MODI-TLB.pas而不是MODI_TLB.pas, MODI-TLB.pas要如何產生MODI-TLB.dcu ?


===================引 用 rick060 文 章===================
1. 皆可,版本不同而以
2.office 2003/2007 皆可,版本不同而以 2011 已移除 modi
3.Project -> Import Type Library(d7) / Component -> Import Components 完成後就會產生相應 dcu/pas 所需檔案
編輯記錄
ry_lee 重新編輯於 2011-06-27 05:36:01, 註解 無‧
ry_lee 重新編輯於 2011-06-27 07:57:20, 註解 無‧
rick060
高階會員


發表:2
回覆:112
積分:217
註冊:2009-11-17

發送簡訊給我
#10 引用回覆 回覆 發表時間:2011-06-29 16:38:58 IP:60.250.xxx.xxx 未訂閱
 手邊沒有 office 2007 可以玩..

系統時間:2024-04-25 19:36:56
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!