Google
 
Web itpro-blogger.blogspot.com
金曜日, 7月 15, 2005

[.NET共通]セットアップ作成方法

■メモ
◎インストールするフォルダ構成はセットアップのプロジェクトの中で作成する。そのとき、ターゲットとなる
 インストール先を考慮しなくてはならない。
 「アプリケーション フォルダ」のプロパティ「DefaultLocation」を設定する。

◎ショートカットもセットアップのプロジェクトの中で作成する。アイコン表示は、プロパティの「Icon」で
 リンクするEXEなどを指定する。

◎空のフォルダを作成したいときは、作成したフォルダのプロパティの「AlwaysCreate」を「True」に設定
 する。

◎アンインストールのショートカットを「ユーザのプログラム メニュー」に作成する方法
1.「ファイルシステム」->「対象コンピュータ上のファイルシステム」を右クリックし、
 「特別なフォルダの追加」で「システム フォルダ」を選択しフォルダを追加する。
2.システムフォルダ配下の「system32」フォルダにある「msiexec.exe」を実行環境
 フォルダにコピーする。
3.コピーした「msiexec.exe」を「アプリケーション フォルダ」に追加する。
4.「msiexec.exe」を指定したショートカットを作成する。
5.ショートカットのプロパティ「Arguments」にパラメータを追加する。
例:/x{CA7FD919-BDB6-43B0-96DF-5782FE49CA74} /qb
6.ショートカットのプロパティ「WorkingFolder」に「システム フォルダ」を指定する。

■msiexec.exeのヘルプ

Windows (R) インストーラ. V 3.01.4000.1823

msiexec /Option <必須パラメータ> [省略可能なパラメータ]

インストール オプション

製品をインストールまたは構成します。
/a
管理用ツール - ネットワーク上の製品をインストールします。
/j [/t <変換一覧>] [/g <言語 ID>]
製品をアドバタイズします - すべてのユーザーには m、現在のユーザーには u を指定します。

製品をアンインストールします。

表示オプション
/quiet
Quiet モード - ユーザーの操作なし
/passive
無人モード - 進行状況バーのみ
/q[nbrf] ユーザー インターフェイスのレベルを設定します。
n - なし b - 基本 r - 簡易 f - 完全 (既定)
/help ヘルプ情報

再起動オプション
/norestart
インストール完了後に再起動しません。
/promptrestart
再起動が必要な場合は、ユーザーに再起動を要求します。
/forcerestart
常に、インストール後コンピュータを再起動します。

ログ オプション
/l[iwearucmopvx+!*]
i - 状態メッセージ
w - 致命的ではない警告
e - すべてのエラー メッセージ
a - 操作のスタートアップ
r - 特定の操作の記録
u - ユーザーの要求
c - UI パラメータの初期値
m - メモリ不足または致命的な終了に関する情報
o - ディスク領域不足メッセージ
p - ターミナルのプロパティ
v - 詳細出力
x - 詳細デバッグ情報
+ - 既存のログ ファイルに追加
! - 各行をログにフラッシュ
* - v オプションと
x オプションを除くすべての情報をログに記録します。
/log <ログ ファイル>
/l* <ログ ファイル> と指定したときと同じ情報がログに記録されます。

更新オプション
/update [;Update2.msp]
更新を適用します。
/uninstall <修正プログラム コード GUID>[;Update2.msp]
/package
製品の更新を削除します。

修復オプション
/f[pecmsodauv]
製品を修復します。
p - ファイルが見つからない場合のみ
o - ファイルが見つからない、または古いバージョンがインストールされている場合 (既定)
e - ファイルが見つからない、同じバージョンまたは古いバージョンがインストールされている場合
d - ファイルが見つからない、または違うバージョンがインストールされている場合
c - ファイルが見つからない、またはチェックサムと計算された値が一致しない場合
a - すべてのファイルをインストールする u - すべてのユーザー固有の必須レジストリ エントリ (既定)
m - すべてコンピュータ固有の必須レジストリ エントリ (既定)
s - すべての既存のショートカット (既定)
v - ソースから実行して、パッケージをローカルに再キャッシュする

パブリック プロパティの設定 [PROPERTY=プロパティ値]

コマンド ラインの構文の詳細については、Windows (R) インストーラ SDK を参照してください。

Copyright (C) Microsoft Corporation. All rights reserved.Portions of this software are based in part on the work of the Independent JPEG Group.

■参考サイト
【[HOW TO] Visual Studio .NET でセットアップ パッケージを作成する方法】
http://support.microsoft.com/?scid=kb;ja;307353&spid=3039&sid=global
【ベース ドライバと Intel(R) PROSet のコマンドライン インストール:
                インテル(R) ネットワーク アダプタ ユーザ ガイド】
http://support.jp.dell.com/docs/NETWORK/9195P/intel_ug/ja/cmd_ln.htm

■インストールしたファイルをアンインストールで削除しない方法
ファイルプロパティにある「Permanent」プロパティを「True」にする。デフォルトは、アンインストール対象
の「False」が設定されている。

■参考サイト
【Permanent プロパティ】
http://s.microsoft.com/japan/msdn/library/default.asp?url=/japan/msdn/library/ja/vsintro7/html/vxgrfpermanentproperty.asp


[VB.NET]ExcelのArray関数

ExcelのArray関数はObject型に置き換える。


[VB.NET]ExcelのPrintOutメソッド

■PrintOutメソッド
選択したオブジェクトを印刷することができる。パラメータには、
印刷するページ (印刷開始ページから終了ページまでを指定)->From:=開始ページ, To:=終了ページ
部数->Copies:=部数
印刷前のプレビュー->Preview:=「プレビュー有り:True、プレビュー無し:False」
使用するプリンタの名前->ActivePrinter:=「"PrinterName"、省略のときデフォルトプリンタ使用」
ファイルの印刷か、
部数単位印刷->Collate:=「部単位印刷有り:True(-1)、部単位印刷無し:False(0)、既定値はTrue」
プリントするファイルの名前など、
数多くの任意パラメータを指定することができます。

■例
指定したファイルの最初のページのみを 2 部、印刷前にプレビューした後に指定のプリンタで印刷します。

[VB.NET]
DirectCast(ThisWorkbook.Sheets(1), Excel.Worksheet).PrintOut(From:=1, To:=1,Copies:=2, Collate:=True, Preview:=True, ActivePrinter:="PrinterName")

// C#
((Excel.Worksheet)ThisApplication.Sheets[1]).
PrintOut(1, 1, 2, true, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);


■参考サイト
【.NET 開発者の観点から捉えた Excel オブジェクト モデル】
http://www.microsoft.com/japan/msdn/office/vsto2003/ExcelObj.asp


[VB.NET]タスクスケジュール

[参照設定」->「参照の追加」->「COM」->「Microsoft WMI Scripting V1.1 Library」を追加する。

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strErrMsg As String
Dim intErrNo As Integer
Dim strErrDetail As String
Dim strErrType As String
Dim Job As WbemScripting.SWbemObject
Dim Locator As WbemScripting.SWbemLocator
Dim Service As Object

Try

Dim Ret As Int32
Dim ID As Int32
Dim MesStr As String

Locator = New WbemScripting.SWbemLocator
'Set Service = Locator.ConnectServer("ComputarName","root\cimv2","UserName","Password")
Service = Locator.ConnectServer(".")
Job = Service.Get("Win32_ScheduledJob")

'Command    :Name of the executable program, batch file, or script to be run.
'StartTime   :UTC time to run the job. This is of the form YYYYMMDDHHMMSS.MMMMMM(+-)OOO,
' where YYYYMMDD must be replaced by ********. Example: ********123000.000000-420,
' which implies 12:30 P.M. Pacific time with daylight saving time in effect.
'RunRepeatedly :Indicates whether the scheduled job should run repeatedly on the days that
' the job is scheduled. The default is FALSE. This parameter is optional.
'DaysOfWeek   :Days of the week when the task should be run. Values are:
' 1 - 月曜日、2 - 火曜日、4 - 水曜日、8 - 木曜日、16 - 金曜日、32 - 土曜日、64 - 日曜日
' To run the task on multiple days, use a logical OR to combine values.
' For example, to run a task on Tuesday, Thursday, and Saturday, use the following code:
' 2 OR 8 OR 32
' To run a task on multiple days, you must set the RunRepeatedly parameter to True.
'DaysOfMonth  :Days of the month when the job is scheduled to run;
' used only when the RunRepeatedly parameter is True. This parameter is optional.
'InteractWithDesktop:Indicates whether the specified job should be interactive
' (meaning that a user can give input to the scheduled job while it is executing).
' The default is False. This parameter is optional and is rarely set to True. In general,
' the reason to use a scheduled task is to allow a task to be carried out without any user interaction.
'JobID     :Identifier number of the job. This parameter is a handle to the job being scheduled on this computer.

'Ret = Job.Create("Command", "StartTime[YYYYMMDDHHMMSS.MMMMMM(+-)OOO]", RunRepeatedly, DaysOfWeek, DaysOfMonth, InteractWithDesktop, JobID)
Ret = CLng(Job.Create("notepad.exe", "********123000.000000-900", False, 1, 1, False, ID))

If Ret = 0 Then
MsgBox("タスクを ID:" & ID & " で追加しました。")
Else
MsgBox("タスク追加に失敗しました。")
End If


Catch ex As Exception

strErrMsg = Err.Description
intErrNo = Err.Number
strErrDetail = ex.ToString()
strErrType = ex.GetType().ToString()

MsgBox(strErrMsg & vbCrLf & intErrNo & vbCrLf & strErrDetail & vbCrLf & strErrType)

Finally

Job = Nothing
Service = Nothing
Locator = Nothing

End Try

End Sub

■参考サイト
【- タスクスケジュールを追加する [Win32_ScheduledJob] -】
http://wmifun.atinfinity.net/sample/win32_scheduledjobb.html
【VBS for WMI】
http://www.geocities.jp/maru3128/wmi.html
Microsoft Windows 2000 Scripting Guide - Creating Scheduled Tasks
http://www.microsoft.com/technet/scriptcenter/guide/sas_man_rsxs.mspx
Windows 2000 タスク スケジューラ
http://www.microsoft.com/japan/
technet/prodtechnol/windows2000serv/maintain/featusability/tsksched.mspx

Hey, Scripting Guy!
http://www.microsoft.com/japan/
technet/scriptcenter/resources/qanda/sept04/hey0922.mspx


木曜日, 7月 14, 2005

[VB.NET or VB2005]例外処理

■エラー取得
Dim strErrMsg As String
Dim intErrNo As Integer
Dim strErrDetail As String
Dim strErrType As String

Try

       ' 処理内容

Catch ex As Exception

strErrMsg = Err.Description
intErrNo = Err.Number
strErrDetail = ex.ToString()
strErrType = ex.GetType().ToString()

MsgBox("エラー内容:" & Err.Description & "(" & Err.Number & ")" & vbCrLf & _
"詳細内容:" & ex.ToString() & "(" & ex.GetType().ToString() & ")")

End Try

■Throwステートメント:プログラムの実行を中断し、プログラム内の関連するCatchブロックに制御を移す。


■参考サイト
【VB 例外 - Throw】
http://homepage1.nifty.com/rucio/main/dotnet/shokyu/standard33.htm


[VB.NET]プリンタ

■参考サイト
【DOBON.NET .NET Tips - プリンタのポート、状態を取得する】
http://dobon.net/vb/dotnet/graphics/printerport.html

【OpenPrinter関数】
http://www.microsoft.com/JAPAN/developer/library/jpgdipf/_win32_openprinter.htm

【GetPrinter関数】
http://www.microsoft.com/JAPAN/developer/library/jpgdipf/_win32_getprinter.htm

【ClosePrinter関数】
http://www.microsoft.com/JAPAN/developer/library/jpgdipf/_win32_closeprinter.htm

【SetPrinter関数】
http://www.microsoft.com/JAPAN/developer/library/jpgdipf/_win32_setprinter.htm

【テクニカルライティング VBで賢く印刷しよう】
http://www.galliver.co.jp/writing/nikkei_tokushu/prn908/

【AB-023:制御データを直接プリンタに送る】
http://abfan.mxm-wk.com/023.html

【テクニカルライティング Win32 APIによるプリンタ制御】
http://www.galliver.co.jp/writing/vbm_tokushu/print/index.html


火曜日, 7月 05, 2005

[ORACLE]インストール・テーブル作成

初期サイズ
Data Warehouse 400MB
General Purpose 400MB
New Database の Default 250MB
Transaction Processing 330MB

■参考ページ
http://www.oracle.co.jp/2shin/ora76/16_17.html

▼問題
インストーラのスワップ領域のエラー。

▼解決策
インストールしているユーザ名に日本語(全角文字)を使用しない。

■参考サイト
http://forums.belution.com/ja/oracle/000/000/06s.shtml


▼問題
『OIP-04117: 更新可能なセットではありません。』のエラーがDbEditとDbAddNewで起きる。
環境:Oracle9i Database 9.2.0.1.0

▼解決策
Oracle Objects for OLE 9.2.0.4.8 patchモジュールを適用すると解決する。


▼問題
フィールド名に『ROW』を使用するとテーブル作成でエラーとなる。

▼解決策
ダブルコーテイションで囲えば作成できる。


▼問題
フィールド名に『ROW』を使用すると『OIP-04117: 更新可能なセットではありません。』のエラーが起きる。
環境:Oracle9i Database 9.2.0.1.0

▼解決策
フィールド名に『ROW』の使用をやめるか、Oracle Objects for OLE 9.2.0.4.8 patchモジュールを
適用する。


タスクのスケジュール

【TechNet ホーム > スクリプト センター >
          スクリプト一覧 > オペレーティング システム > タスクのスケジュール】
http://www.microsoft.com/japan/technet/scriptcenter/scripts/os/tasks/default.mspx

【スクリプト一覧】
http://www.microsoft.com/japan/technet/scriptcenter/scripts/default.mspx

【WMI Fun !! ~ WMI に興味がある方・システム管理者必見 !! ~】
http://wmifun.atinfinity.net/


This page is powered by Blogger. Isn't yours?