漫坊亭@ウィキ
http://w.atwiki.jp/jfactory/
漫坊亭@ウィキ
ja
2014-01-06T10:34:48+09:00
1388972088
-
トップページ/INNO
https://w.atwiki.jp/jfactory/pages/75.html
|&big(){Inno Setup}|
[[Download Inno Setup>http://www.jrsoftware.org/isdl.php]]から、ispack-5.5.4-unicode.exeをダウンロードする。
#contents()
----
*Inno Script Studioの日本語化
こんな感じで、とりあえず目についた部分のみ日本語にしてみた。
#ref(Inno Script Studio.png)
これ&ref(InnoScriptStudio5.5.4.Japanese.zip)を展開して、
Languagesにコピーすると、日本語が選べるようになる。
デフォルトのインストールフォルダ
C:\Program Files (x86)\Inno Script Studio\Languages
2014-01-06T10:34:48+09:00
1388972088
-
トップページ/CSHARP/WINFORM/PropertyGrid
https://w.atwiki.jp/jfactory/pages/74.html
|&big(){Windows.Forms.PropertyGrid}|
#contents()
----
*データをセットする
this.PropertyGrid.SelectedObject = データの入っているクラスのインスタンス
*デフォルト値
[DefaultValue(false)]
public bool Foo { get; set; }
*表示しない
[Browsable(false)]
public bool Foo { get; set; }
*説明表示
[Description("ここに説明を書く")]
public bool Foo { get; set; }
*グループ
FooとBarは同じグループとして表示される
[Category("友達")]
public bool Foo { get; set; }
[Category("友達")]
public bool Bar { get; set; }
*書き込めなくする
[ReadOnly(true)]
public bool Foo { get; set; }
*デフォルトプロパティ
Barにフォーカスがある状態で開始する
[DefaultProperty("Bar")]
public class Settings
{
public bool Foo { get; set; }
public bool Bar { get; set; }
}
*内包クラスを展開できるようにする
[TypeConverter(typeof(ExpandableObjectConverter))]
public class Foo { get; set; }
*ファイルを開く
参照設定にSystem.Designを追加が必要
using System.Drawing.Design;
using System.Windows.Forms.Design;
[Editor(typeof(FileNameEditor), typeof(UITypeEditor))]
public string Foo { get; set; }
2013-03-15T08:56:38+09:00
1363305398
-
トップページ/CSHARP/Tips
https://w.atwiki.jp/jfactory/pages/73.html
|&big(){小技}|
#contents()
----
*数値をbyte配列に変換(byte配列)
uint numver = 1;
byte[] byteArray = BitConverter.GetBytes(number);
*byte配列を数値に変換(byte配列)
var byteArray = new byte {0,1,2,3};
uint dwValue = BitConverter.ToUInt32(byteArray, 0);
*CSV形式の文字列をbyte配列に変換(csv,byte配列)
byte[] byteArray =
text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select((x) => Convert.ToByte(x, 16))
.ToArray();
*byte配列をCSV形式の文字列に変換(csv,byte配列)
string.Join(",", byteArray.Select(x => x.ToString("X2")));
2013-01-25T15:37:45+09:00
1359095865
-
トップページ/CSHARP/WpfLivet
https://w.atwiki.jp/jfactory/pages/72.html
|&big(){WPF+Livet}|
#contents()
----
*フォルダ選択(Livet.Extensions)
View
<Button Content="FolderDialog" Width="75">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<l:FolderBrowserDialogInteractionMessageAction>
<l:DirectInteractionMessage CallbackMethodTarget="{Binding}" CallbackMethodName="FolderSelected">
<l:FolderSelectionMessage Description="フォルダーの選択" DialogPreference="None"/>
</l:DirectInteractionMessage>
</l:FolderBrowserDialogInteractionMessageAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
ViewModel
public void FolderSelected(FolderSelectionMessage m)
{
System.Diagnostics.Debug.WriteLine(m.Response);
}
2013-01-11T09:26:11+09:00
1357863971
-
トップページ/VB6/SAMPLE_PATH
https://w.atwiki.jp/jfactory/pages/71.html
|&big(){ファイルに関するサンプルコード}|
#contents()
----
*フルパスファイル名のパス名部分を得る
' IN: fullPathName フルパス名
' OUT: String パス名
Public Function GetPathName(ByVal fullPathName As String) As String
If PathName = "" Then Exit Function
'fullPathNameを'\'で分解する
Dim Files() As String
Files = Split(PathName, "\")
If (UBound(Files) > 0) Then
'最後の要素を削除する
ReDim Preserve Files(UBound(Files) - 1)
'Files()を連結する
GetPathName = Join(Files, "\")
Else
GetPathName = PathName
End If
End Function
----
*フルパスファイル名のファイル名部分を得る
Public Function GetFileName(ByVal fullPathName As String) As String
If PathName = "" Then Exit Function
'FileNameを'\'で分解する
Dim Files() As String
Files = Split(PathName, "\")
'最後の要素を返す
GetFileName = Files(UBound(Files))
End Function
2010-12-28T09:23:51+09:00
1293495831
-
トップページ/VB6/SAMPLE_FILE
https://w.atwiki.jp/jfactory/pages/70.html
|&big(){ファイルに関するサンプルコード}|
#contents()
----
*
2010-12-28T09:21:24+09:00
1293495684
-
トップページ/WIN/ETC64
https://w.atwiki.jp/jfactory/pages/69.html
|&big(){64bit版Windows}|
とくに断りがない場合は、Windows7ネタです。
#contents()
----
*regsvr32の謎
64bit版Windows上のC#から、VB6のActiveX DLLを使用する場合は、
+ActiveX DLLは、32bit版regsvr32で登録しなくてはならない。
+C#をx86でコンパイルしなくてはならない
+ただし、32bit版Windowsで動かす予定がなければ、その限りでない
64bit版Windowsでは32bitと64bitのCmd.exeが存在し、デフォは64bit版である。
バッチファイルをダブルクリックして起動した場合、
64bit版のコマンドプロンプト上で起動する。
そして、regsvr32も2種類ある。
32ビット版 %systemroot%\SysWoW64\regsvr32.exe
64ビット版 %systemroot%\System32\regsvr32.exe
バッチファイル内にregsvr32がある場合、当然64ビット版が呼ばれる。
C#でVB6のActiveX DLLをつかうときに、
x64でコンパイルすると、64bit版で登録したActiveX DLLを探す。
x32でコンパイルすると、32bit版で登録したActiveX DLLを探す。
AnyCpuでコンパイルすると、x64でコンパイルしたことになる。
rem バッチファイルのサンプル
rem (どこで見つけたかわからなくなりました。作者さん、ありがとうございます)
@echo off
rem もし64ビット版cmdのときは、32ビットで起動しなおす
if "%PROCESSOR_ARCHITECTURE%" NEQ "x86" (
C:\Windows\SysWOW64\cmd.exe /C %0
exit
)
regsvr32 xxx.dll
余談ですが、スタブライブラリ(Interop.xxx.dll)の配布もお忘れなく……
2010-11-30T16:12:37+09:00
1291101157
-
トップページ/VB6/BASIC
https://w.atwiki.jp/jfactory/pages/68.html
|&big(){基本的なこと}|
#contents()
----
*forループ
Dim i as Integer
For i = 0 To 10
'
Next i
-continueはない
-breakは"exit for"と書く
2010-08-14T16:59:28+09:00
1281772768
-
トップページ/VB6/SAMPLE
https://w.atwiki.jp/jfactory/pages/67.html
|&big(){サンプルコード}|
#contents()
----
*自己再起動
If Not (0 = Shell(App.Path & "\" & App.EXEName)) Then End
----
*空の配列
C#でいうところの、nullが入った状態のことである。
基本的にVB6では、空っぽの配列を作成することはできない。
しかし、偉大な先人達が、いくつかの方法を見つけている。
-null?を入れておく方法
VB6にはnullなどないので、それに変わる方法を使う。
いちおうmsdnにも記載されているらしいが、かなり裏技っぽい
'Variant型の空の配列を作る
Dim arr() As Variant
arr = Array()
'空っぽの判定
On Error Resume Next
If (UBound(arr)) Then
Debug.Print "配列は空っぽ"
End If
'String型の空の配列を作る
Dim StringArray() As String
StringArray = Split("")
'Byte型の空の配列を作る
Dim ByteArray() As Byte
ByteArray = ""
'Object型の空の配列を作る
Dim ObjectArray() As Object
Call IsArray(ObjectArray)
-APIを使う方法
Private Declare Function SafeArrayAllocDescriptor Lib "oleaut32" ( _
ByVal cDims As Long, ByRef ppsaOut() As Any) As Long
Private Declare Sub GetMem4 Lib "msvbvm60" ( _
ByVal ptr As Long, ByRef ret As Long)
-「常に目的のサイズ+1とし、サイズが1を空と
2011-04-06T13:59:21+09:00
1302065961
-
トップページ/VB6/ETC
https://w.atwiki.jp/jfactory/pages/66.html
|&big(){いまさらVB6}|
#contents()
----
|str|数値を文字列に変換|
|val|文字列を数値に変換|
2010-07-26T09:41:13+09:00
1280104873