0

Visual Basic 6 のコマンド ダイアログのみであるコモン ダイアログを使用して、ファイルを開き、その内容を TextField に配置する方法を学習しようとしています。

私は eVB で同じアプリケーションを実行しようとしていますが、eVB はこれらのようなものをサポートしていないため、共通のダイアログのみを使用してこれが必要です。これにより、VB6 開発がより簡単になります。

Dim objFSO As New Scripting.FileSystemObject
Dim objStream As Scripting.TextStream
4

1 に答える 1

1

WinCE API を介した eVB File Access を確認してください。記事のサンプル コード (コモン ダイアログからファイル名 (myFileName) を既に取得していると仮定します):

Public Const GENERIC_READ As Int32 = &H80000000 
Public Const OPEN_EXISTING As Int32 = 3

' CreateFile will open a file handle (hFile) to the file in the myFileName variable
hFile = CreateFile(myFileName, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0)

lFileSize = GetFileSize(hFile, 0)

' String(lFileSize, 0) will prepare the sContents string variable 
' to hold the contents of the file
sContents = String(lFileSize, 0)

' ReadFile actually reads the file we opened earlier and puts the contents
' into the sContents variable
ReadFile hFile, sContents, lFileSize, dwRead, 0

' Put the contents we read into the textbox
myTextBox.Text = sContents
于 2009-07-14T00:21:01.873 に答える