Thursday, March 30, 2006

pdfFactory 的設定

若要 pdfFactory 為能將多份文件合併成一份文件,則必須於 Registry 中修改以下設定:
HKCU\Software\FinePrint Software\pdfFactory2\FinePrinters\pdfFactory\ShowDlg = 1
HKCU\Software\FinePrint Software\pdfFactory2\FinePrinters\pdfFactory Pro\ShowDlg = 1

Wednesday, March 15, 2006

在 VB 中使用 UDT 應注意事項

寄件人: Jon Mundsack
日期: 2001年12月18日(星期二) 下午10時31分
電郵地址:"Jon Mundsack"
群組: microsoft.public.vb.general.discussion


Actually, VB does allow you to use UDTs as parameters and return values.
Looking at the error, people are often confused by the terminology, in part
because of the use of the word "Public" both as a declarative statement and
as an object's scope. Let's pick apart the error a bit deeper and see how
this works:

"Only public user defined types defined in public object modules can be used
as parameters or return types for public procedures of class modules or as
fields of public user defined types."


What is a "public object module?" This terminology probably causes the most
confusion of anything in the rest of the error message. A public object
module is a class module whose "Instancing" attribute is set to something
other than Private. If you are working on a Standard EXE project, the only
Instancing value permitted by VB is Private, so this attribute is not
visible in the properties window--in fact If you've never used an ActiveX
project, you probably didn't even know the Instancing attribute exists.
When you're working on an ActiveX project (DLL, EXE, or OCX) and you have a
class module open in the IDE, you will see this Instancing attribute listed
in the properties window (F4). Classes whose Instancing is set to something
other than Private are what VB considers to be "public object modules";
therefore, it stands to reason that if you want to use a UDT as a parameter
or return value, the UDT *must* be declared within a public object module in
an ActiveX project, since ActiveX projects are the only VB projects which
support public object modules.


If you're using a Standard EXE and you don't want to involve ActiveX
components just to have the ability to use UDTs as parameters and return
values, simply declare the functions, subs, and properties with "Friend"
scope instead of "Public" scope, and you can use UDTs freely anywhere a
standard data type would fit. For example:


Friend Sub DoSomething(ByVal SomeUDT As MyUDT)


HTH-Jon