このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。

翻訳前ページへ


DLLs: 前進するd level help on using 機能(する)/行事s and 手続きs from them in ooCalc, etc- Open Office Tutorials - opof6dll AUTHOR'S MAIN SITE   > > > > >   TABLE OF CONTENTS for Open Office database tutorials.
MACROS section, Open Office tutorials.    Delicious Bookmark on Delicious    Recommend to StumbleUpon

Open Office Tutorials- 大型のs...

Using them to 接近 機能(する)/行事s and subroutines
in 外部の DLLs- 前進するd help

This page is one of several trying to help you get the most out of the splendid Open Office. They are 連合した with a larger 始める,決める concentrating on ooBase.

Remember that Open Office, 含むing ooBase, is 解放する/自由な! But don't let that fool you. And it's not new. Big organizations, 政府 and 非軍事の, are 可決する・採択するing it as their 基準 office 控訴... and saving million$, and still Getting The 職業 Done.

There's more about ooBase in the main 索引 to this 構成要素.

This page is "browser friendly". Make your browser window as wide as you want it. The text will flow nicely for you. It is easier to read in a 狭くする window. With most browsers, 圧力(をかける)ing 加える, minus or 無 while the 支配(する)/統制する 重要な (ctrl) is held 負かす/撃墜する will change the texts size. (大きくする, 減ずる, 回復する to default, それぞれ.) (This is more fully explained, and there's another tip, at my 力/強力にする Browsing page.)

Page contents © TK Boyd, Sheepdog ソフトウェア ®, 3/11.



Introduction

This tutorial is written for an audience that is already reasonably comfortable with OpenOffice 大型の work. If you 港/避難所't done much with 大型のs, you might want to visit some of my "getting started with 大型のs" tutorials. The tutorial you are reading now jumps into some 比較して 前進するd topics 公正に/かなり quickly... I have an 中間の level tutorial about using DLLs which you may want to look at too, 特に if the に引き続いて, at first, is too difficult. The other tutorial should help you get ready for what follows, if you aren't ready now.

ありふれた introduction

If you have read my 中間の "using 機能(する)/行事s and 手続きs in DLLs" tutorial, the next few paragraphs will look familiar... the same text appears in both tutorials because I can't be sure that every reader will read these tutorials in the same order.

This tutorial is going to show you how 機能(する)/行事s and 手続きs within an 外部の DLL can be 接近d from an Open Office 文書. In the tutorial, I am going to be using an ooCalc worksheet... but the 原則s 適用する to other Open Office 文書s, too. And you might even find that what we are doing here would work in Excel... but I make no 約束s, as ooCalc takes care of all my spreadsheet needs without the expense of supporting Microsoft!

The 機能(する)/行事s and 手続きs used for the examples aren't very exciting, but there are things which can be 配達するd 経由で DLL that are 価値(がある) doing that way, for a variety of 推論する/理由s.

How do you 令状 your own DLL? That is a much bigger question. I have written a guide to 令状ing a DLL with Delphi. There are general points in that which may help people working in other languages.

But you don't have to 令状 your own DLL to work through this tutorial on using a DLL from within an Open Office 文書. You just download the zip とじ込み/提出する that goes with my "令状ing DLLs" tutorial, and 抽出する from that just the とじ込み/提出する called "dd50demo.dll". 蓄える/店 it in the root of your C: 運動. (It shouldn't be necessary to be so 天然のまま... but I 港/避難所't 割れ目d doing something more elegant yet!)

現実に... on second thoughts... I've just created another 古記録 with a DLL which might be better. In it you will find the dd50demo.dll, and a とじ込み/提出する called DD88.exe. Copy both of them to the same folder, the root of your C; 運動 might be "best" (sorry). The .exe is just a little "実験(する)" program you can use... if you wish... to see the DLL is working. You don't need to run it if you don't want to. (The other とじ込み/提出するs in the .zip are of 利益/興味 only to Delphi programmers, although you can open DD88.pas with any text editor to see the code at the heart of DD88.exe.) Nota Bene: You need to put a second copy of dd50demo.dll in the root of your C: 運動 for the Open Office work we are about to 乗る,着手する upon 正確に/まさに as 現在のd. By all means try to master "the tricks" which 許す you to put the DLL in a more sensible 場所, but that is a 詳細(に述べる) I leave as an 演習 for the student!



Getting started with using a 機能(する)/行事 from a DLL

I lied. You should already be "started". If you 港/避難所't put a copy of "dd50demo.dll" in the root of your C: 運動 yet, (explained above), do it now.

Now start up ooCalc, and open a new worksheet. We're going to go rather slowly at first, just to cover some basics "gotchas", but don't go to sleep... the pace 選ぶs up before long.

Create a little OpenOffice Calc worksheet. I was using Open Office 3.0.0 on a Windows XP machine.

Save it as TstUserCreatedFunction.

(In this work, you will find ooCalc "doing things" to your capitalizations... just type what I 示唆する, but don't worry too much when ooCalc changes things on you! But remember that there ARE places in 大型の work where the 事例/患者 DOES 事柄, e.g. MyVariable isn't always 受託するd if MYVARIABLE is what is 手配中の,お尋ね者. 避ける using ALL CAPS, or all-lower-事例/患者, but don't "fight" the machine.)

Once again... for a while... the 構成要素 below will seem familiar if you read my other 'Open Office and DLLs' tutorial. Don't worry... things will get harder soon enough!

Invoke....

道具s | 大型のs| 組織する 大型のs | OpenOffice.org Basic...

... which will open a dialog. In the left 手渡す pane, 演習 負かす/撃墜する (you'll click on a little "+" 調印する at one point.. or 二塁打-click on a "folder" 指名する) to TstUserCreatedFunction.ods/基準. Click on the "New" button. This will let you create a new "module". 割り当てる "tkbUsrFuncs" as its 指名する. (If you save your 大型の modules inside the 文書, as we are going to do here, you can have different 始める,決めるs of 大型のs for different 状況/情勢s, and the modules can even have the same 指名する. Don't go off there now and get distracted from the joys of using 大型のs, and using 機能(する)/行事s and 手続きs from 外部の DLLs, but when you're ready, I've done 公式文書,認めるs for you on the プロの/賛成のs and 反対/詐欺s of the ways to saving Open Office 大型のs in different places.(That link will open in a new tab or window, if you want to get it 負担d now for later 言及/関連.)) As soon as you've done that, a window will open. It will have...

REM  *****  BASIC  *****

Sub Main

End Sub

... already typed for you; that is a 骸骨/概要 for a 大型の.

Rather than a 大型の, we're creating a 使用者 defined 機能(する)/行事. But we're going to do it "in" the "part" of ooCalc 始める,決める up for doing 大型のs. That's okay... just a little 混乱させるing, maybe.

Our first 機能(する)/行事 isn't going to do very much... Just return the 伝統的な "Hello World". (Something very like it has a 価値のある use: You can make a 使用者 defined 機能(する)/行事 報告(する)/憶測 the 見解/翻訳/版 ID for collections of 機能(する)/行事s you've put together.)

取って代わる EVERYTHING that the system "pre-typed" for you with....

機能(する)/行事 tkbHello()
tkbHello="Hello World"
end 機能(する)/行事

That will create a new 機能(する)/行事, 利用できる to this worksheet (not across all your ooCalc work... but while we're finding our feet, we don't want to "mess with" the underlying, 全世界の, 取り付け・設備 of ooCalc, do we?) which will 追加する two numbers.

In the "edit 大型の" window, where we've just created our 使用者-defined 機能(する)/行事, find the "収集する" button (first on my toolbar... three "sheets of paper" in a stack, with a blue arrow pointing 負かす/撃墜する.)

Click it. You should see nothing. If you have typos, you may get an error message.

At this 行う/開催する/段階, I would be inclined to click とじ込み/提出する| Save... but you don't have to. Leave the "大型の" editing window (which we are using to edit a 機能(する)/行事) open, go 支援する to the main worksheet window.

Enter....

=tkbHello()

... in a 独房, and 圧力(をかける) "Enter"... "Hello World" (without the quotation 示すs) should appear in the 独房. 公式文書,認める the "()" after the "tkbHello". For this simple 機能(する)/行事, the parentheses are empty, but you still need them in the contents of the 独房 which calls the 機能(する)/行事. It is part of how ooCalc knows that "tkbHello" is a 機能(する)/行事. Later we are going to put things inside the parentheses.

出口 out of all you've done, 説 "Save" if you get a "you've made changes, don't you want to save them?" 警告.

Re-open the worksheet. You may 井戸/弁護士席 get a "This 文書 含む/封じ込めるs 大型のs.... 死刑執行 of 大型のs is 無能にするd..." message.

If you do, follow the 指示/教授/教育s for enabling 大型のs 死刑執行, re-の近くに the worksheet, re-open it. (I wish I could show you how to 永久的に 権限を与える 大型の 死刑執行 at a 文書-by-文書 level. However, the "medium" 安全 level seems good to me. It will be tedious to say "yes, okay" each time I open a worksheet with 大型のs... but I don't use them much (yet), and it will create a tripwire if someone tries to (打撃,刑罰などを)与える a malicious 大型の on me.)

Start made

Okay so far, I hope? If you are already struggling, maybe you should work through my 中間の level tutorial on 使用者 defined 機能(する)/行事s, and then return to the one you are reading now? (That page will open in a new window or tab, so you can get 支援する to this easily, if you wish to.) But if all you want to know is how to 接近 things inside an 外部の DLL, then that won't give you any direct help. The good news is that you'll be able to skim the start of the 中間の level tutorial, because it is very 類似の to what you've read so far. 類似の, but not the same... do look out for the differences.

Yes, I realize that we 港/避難所't used the 機能(する)/行事 and 手続き in the DLL yet. Be careful what you wish for.

In the same "大型の module" where you defined "tkbHello()", enter the に引き続いて, 近づく the 最高の,を越す....

宣言する 機能(する)/行事 pcDLLVersion lib "C:/dd50demo.dll" as string

That gives you some 接近 to the 機能(する)/行事 "pcDLLVersion", which is inside the DLL. (The 指名する arises as follows:

*** "pc" for "pchar", the Delphi data-type that the 機能(する)/行事 returns, when you are talking in Delphi 条件... which you don't need to know about... I just didn't want you wondering about or ms-解釈する/通訳するing the "pc"

*** DLL: for "dynamic link library"

*** 見解/翻訳/版: for "this 機能(する)/行事 will return a string telling you the 見解/翻訳/版, the "id" of the particular DLL that you are 接近ing. (What comes out of the DLL when you call pcDLLVersion is hard-coded within the DLL. The DLL programmer should remember to alter the 見解/翻訳/版 (警察などへの)密告,告訴(状) when he/ she alters the DLL. At the moment, the DLL 答える/応じるs with "1.0.0"

------------------

I said "that gives you some 接近. You don't yet have enough 接近 to be able to get the string from the DLL with anything you can (yet) put in a worksheet. So now we move on to the other step in the 過程....

In the same "大型の module" where you defined "tkbHello()", enter the に引き続いて, somewhere below the 宣言 you just 挿入するd....

機能(する)/行事 VerInfo()
VerInfo="見解/翻訳/版, from DLL:"+pcDLLVersion
end 機能(する)/行事

Now you can put something in a 独房 of the worksheet....

=VerInfo()

... and when you do, from your 大型の, you get "見解/翻訳/版, from DLL:", and from inside the DLL you get "1.0.0", resulting in....

見解/翻訳/版, from DLL: 1.0.0

... appearing in the 独房 that has "=VerInfo()" 運動ing it. 冷静な/正味の! You wouldn't believe how long it took me to get "all the bits" of that collected up and 保安官d for this essay! The "as sting" bit was the last 成分. (Without it, you can get gibberish, and are ありそうもない to get anything の近くに to "1.0.0".)

Now for invoking a 手続き inside a DLL

広大な/多数の/重要な! We can get "stuff" out of a DLL, massaged by code inside it. (There are ways to pass things into the DLL... but I'm still getting the last 詳細(に述べる)s of that 権利, sorry)

What about invoking a 手続き inside a DLL? Our デモ DLL has inside it the code necessary to 原因(となる) a little message box to pop up on the 審査する, 説 "Hello World". How do we make that happen from an Open Office 文書, say a worksheet managed by ooCalc?

What I called a 手続き a moment ago would usually be called a 大型の, in an Open Office 状況. 大型のs "do things" 反して 機能(する)/行事s return values, as you learned above, or in my introduction to 使用者 defined 機能(する)/行事s for Open Office tutorial. What sort of things go 大型のs do? They can 原因(となる) little messages to pop up, they can go through a worksheet changing things. Etc, etc. But I realized just in time that there is a separate and 完全にする tutorial all about using 大型のs, so I didn't repeat that here. Whew.

But I didn't, in that tutorial, talk about using 手続きs (大型のs) inside a DLL, so here we go...

First, we have to tell ooCalc about the 手続き 含む/封じ込めるd within the DLL, and give it a way to invoke it.

To your 大型の module "tkbUsrFuncs", 追加する...

宣言する sub SayHi lib "C:/dd50demo.dll"

... and....

sub tkbSayIt
SayHi
end sub

That's all that's needed to 準備する the way. 公式文書,認める we've used "宣言する sub" and "sub tkbSayIt...", rather than the "宣言する 機能(する)/行事" and "機能(する)/行事 ver()..." that we needed 以前. A 機能(する)/行事 returns a value (or values). If we are invoking some code to "do something", in Open Office 条件 we are creating a 大型の, and use "sub", taken from "subroutine".

Now to put that 大型の/ subroutine/ 手続き to work...

Put a button on your worksheet. The "toggling icon" (on/off) for "edit とじ込み/提出する" on the main toolbar will be 決定的な in getting the に引き続いて working. 陳謝s for not having all of the 詳細(に述べる)s worked out yet... but you should be able to muddle through, based on the に引き続いて.

Once you have your button on the worksheet, when you have the "edit とじ込み/提出する" button in the 権利 明言する/公表する ("負かす/撃墜する"), if you 権利 click on the button, it becomes selected (drag 示すs in corners), and a pop-up menu arises, giving "支配(する)/統制する..." as one of your choices. Click it to open the 支配(する)/統制する's 所有物/資産/財産s. (A button is "a 支配(する)/統制する").

Go to the "events" tab, and on that, click on the ellipsis ("...") to the 権利 of the Mouse Button 圧力(をかける)d event.

That will open an "割り当てる 活動/戦闘" dialog, with "Mouse Button 圧力(をかける)d" selected. Click on "大型の..." (over at the 権利, below "割り当てる"). That will open the 大型の Selector... and you should see your 大型のs module, the one called "tkbUsrFuncs"... but it isn't always shown, when I look! If it isn't shown, 取り消す out until you can do 道具s | 大型のs| 組織する 大型のs... When you've done that, select "tkbUsrFuncs"... and then go 支援する, go through the steps to get to the assignment of a 大型の to "Mouse Button 圧力(をかける)d" again. 演習 負かす/撃墜する to your 大型のs module ("tkbUsrFuncs"), 最高潮の場面 "tkbSayIt", click "承認する"

Click the "edit とじ込み/提出する" button, to change it's 明言する/公表する. You'll probably be asked if you want to save your work. (Do that.) And you'll get the 警告 about 大型のs, if you have 安全 始める,決める to "medium", but in 予定 course you'll be looking at your worksheet. Try clicking your button. A message box should come up on the 審査する, 説 "Hello World".

Fancier: "On startup" calling of 手続きs from within DLLs...

Suppose you want a particular 大型の to "解雇する/砲火/射撃" each time you open a 文書? How you go about that is 演説(する)/住所s in my tutorial about where 大型のs are 蓄える/店d, in the "虫垂" at the 底(に届く), at the moment.

Other 資源s

I didn't understand everything I read in the に引き続いて two days ago when I started on this 追求(する),探索(する)... but it did give me ideas of things to try, and might be useful to you too, 関心ing calling DLL 機能(する)/行事s from a spreadsheet 文書.

http://msdn.microsoft.com/en-us/library/bb687915.aspx



A "little mystery" I 港/避難所't 割れ目d yet....

Suppose I 手配中の,お尋ね者 the tkbSayHi 大型の to 解雇する/砲火/射撃, and 原因(となる) the 手続き inside the DLL to 遂行する/発効させる when, say, the contents of 独房 D4 was equal to 42. How would I 達成する that? Answers on a postcard, or, if you prefer, 接触する me by my 返答 form or email. Please?




"And so, to bed...

While I 港/避難所't, I'm sure, got all of the above "perfect", or answered every question, I hope it has brought you closer to where you want to be?





編集(者)の Philosophy

I dislike 'fancy' websites with more 関心 for a flashy 外見 than for good content. For a pretty picture, I can go to an art gallery. Of course, an attractive 場所/位置 WITH content deserves 賞賛する... as long as that pretty 直面する doesn't cost download time. In any 事例/患者....

I am trying to 現在の this 構成要素 in a 判型 which makes it 平易な for you to USE it. There are two 面s to that: The way it is 分裂(する) up, and the way it is 地位,任命するd. See the main 索引 to this 構成要素 for more (警察などへの)密告,告訴(状) about the way it is 分裂(する) up, and the way it is 地位,任命するd.


広告 from page's editor: Yes.. I do enjoy 収集するing these things for you... I hope they are helpful. However.. this doesn't 支払う/賃金 my 法案s!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and 循環させる it for me? Links on your page to this page would also be 高く評価する/(相場などが)上がるd!

PLEASE >>> Click here to visit editor's Sheepdog ソフトウェア (tm) freeware, shareware pages <<< PLEASE


If you liked this ooBase tutorial, see the main 索引 for (警察などへの)密告,告訴(状) other help from the same author.

Editor's email 演説(する)/住所. Suggestions welcomed!     - - -    Want a 場所/位置 hosted, or email? I like 1&1's services.




Valid HTML 4.01 Transitional Page 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org


One last bit of advice: Be sure you know all you need to about spyware.

. . . . . P a g e . . . E n d s . . . . .