【QBASIC互換!?】FreeBasic【GPL】 2 [無断転載禁止]©2ch.net (435レス)
【QBASIC互換!?】FreeBasic【GPL】 2 [無断転載禁止]©2ch.net http://mevius.5ch.net/test/read.cgi/tech/1482549747/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
72: デフォルトの名無しさん [] 2017/02/18(土) 07:01:46.64 ID:/R2Xi7hr Why have I been blocked? This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data. What can I do to resolve this? You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page. なんだわ。 'キーの中の値を列挙します function RegEnumValue で探して 'http://www.freebasic.net/ 内になし 'ドイツサイトより 'https://www.freebasic-portal.de/code-beispiele/system/serielle-schnittstellen-com-ports-unter-windows-ermitteln-248.html があって、コピーしたわ。 UPしたら、引っかかってしまった。 http://mevius.5ch.net/test/read.cgi/tech/1482549747/72
73: デフォルトの名無しさん [] 2017/02/18(土) 07:06:22.38 ID:/R2Xi7hr 分割すれば何とかなるかもしれぬから、20行ぐらいづつやってみる。 Public Function RegistryKeyList(RootKey as HKEY, SubKeyString As String, KeyNameString() As String, KeyValString() As String, Ierror As Long) As Wata 'キーの中の値を列挙します 'http://www.freebasic.net/ 内になし 'ドイツサイトより 'https://www.freebasic-portal.de/code-beispiele/system/serielle-schnittstellen-com-ports-unter-windows-ermitteln-248.html Dim hKey As HANDLE 'Dim Ierror As Integer 'type LPCSTR as const zstring ptr Dim SubKeyZString As ZString * 1024 Dim SubKeyZStringPtr As LPCSTR Dim KeyValStringTSU As Long, KeyValStringSU As Long, Jerror As Long SubKeyZStringPtr = @SubKeyZString RegistryKeyList = 0 'SubKeyString = "HARDWARE\DEVICEMAP\SERIALCOMM": '保守用 'RootKey = HKEY_LOCAL_MACHINE: '保守用 SubKeyZString = SubKeyString http://mevius.5ch.net/test/read.cgi/tech/1482549747/73
74: デフォルトの名無しさん [] 2017/02/18(土) 07:08:25.80 ID:/R2Xi7hr 'Schlussel offnen; Fehlermeldung ausgeben und Programm beenden falls nicht erfolgreich 'キーは開きます;エラー・メッセージは、うまくいかなければプログラムを終えます 'const KEY_QUERY_VALUE = &h0001 ''サブキーのデータを問い合わせることを許可します。 'declare function RegOpenKeyExA(byval hKey as HKEY, byval lpSubKey as LPCSTR, byval ulOptions as DWORD, byval samDesired as REGSAM, byval phkResult as PHKEY) as LONG 'declare function RegOpenKeyExW(byval hKey as HKEY, byval lpSubKey as LPCWSTR, byval ulOptions as DWORD, byval samDesired as REGSAM, byval phkResult as PHKEY) as LONG Ierror = ERROR_SUCCESS KeyValStringTSU = 10 KeyValStringSU = 0 Redim KeyValString(KeyValStringTSU) As String, KeyNameString(KeyValStringTSU) As String 'Ierror = RegOpenKeyEx(HKEY_LOCAL_MACHINE, @"HARDWARE\DEVICEMAP\SERIALCOMM", 0, KEY_QUERY_VALUE, @hKey) Ierror = RegOpenKeyEx(RootKey, @SubKeyZString, 0, KEY_QUERY_VALUE, @hKey) If (Ierror = ERROR_SUCCESS) Then Dim comCnt As Integer 'レジストリエントリの数 Dim As String comStrString 'レジストリエントリ名の最長の長さ(文字型) Dim As String comPortString 'レジストリエントリのデータの最長の長さ(文字型) Dim As Integer comStrLen Dim As Integer comPortLen Dim As Integer comStrMaxLen 'レジストリエントリ名の最長の長さ Dim As Integer comPortMaxLen 'レジストリエントリのデータの最長の長さ http://mevius.5ch.net/test/read.cgi/tech/1482549747/74
75: デフォルトの名無しさん [] 2017/02/18(土) 07:13:29.01 ID:/R2Xi7hr '鍵となる問題の局面情報 Groseninformationen des Schlussels abfragen '指定されたレジストリキーに関する情報を取得します。 'declare function RegQueryInfoKeyA((中略, C:\FreeBASIC\inc\win\winreg.bi 参照)byval lpftLastWriteTime as PFILETIME) as LONG 'declare function RegQueryInfoKeyW((中略), byval lpftLastWriteTime as PFILETIME) as LONG RegQueryInfoKey(hKey, 0, 0, 0, 0, 0, 0, @comCnt, @comStrMaxLen, @comPortMaxLen, 0, 0) comStrString = String(comStrMaxLen, 0) comPortString = String(comPortMaxLen, 0) KeyValStringTSU = comCnt + 1 KeyValStringSU = 0 Redim KeyValString(KeyValStringTSU) As String, KeyNameString(KeyValStringTSU) As String Dim IQQ As Integer http://mevius.5ch.net/test/read.cgi/tech/1482549747/75
76: デフォルトの名無しさん [] 2017/02/18(土) 07:15:43.63 ID:/R2Xi7hr For IQQ = 0 To comCnt - 1 comStrLen = comStrMaxLen + 1 'String文字数 → ZString文字数 comPortLen = comPortMaxLen / 2 'ANSI → UNICODE 文字数 'Schlusselname und -wert ermitteln und ausgeben; Fehlermeldung ausgeben wenn nicht erfolgreich 'オープンレジストリキーから値の列挙 'declare function RegEnumValueA(byval hKey as HKEY, byval dwIndex as DWORD, byval lpValueName as LPSTR, byval lpcchValueName as LPDWORD, byval lpReserved as LPDWORD, byval lpType as LPDWORD, byval lpData as LPBYTE, byval lpcbData as LPDWORD) as LONG 'declare function RegEnumValueW(byval hKey as HKEY, byval dwIndex as DWORD, byval lpValueName as LPWSTR, byval lpcchValueName as LPDWORD, byval lpReserved as LPDWORD, byval lpType as LPDWORD, byval lpData as LPBYTE, byval lpcbData as LPDWORD) as LONG Jerror = RegEnumValue(hKey, IQQ, StrPtr(comStrString), @comStrLen, 0 , 0, StrPtr(comPortString), @comPortLen) http://mevius.5ch.net/test/read.cgi/tech/1482549747/76
77: デフォルトの名無しさん [] 2017/02/18(土) 07:18:23.68 ID:/R2Xi7hr If Jerror = ERROR_SUCCESS Then KeyValStringSU = KeyValStringSU + 1 KeyValString(KeyValStringSU) = Left(comPortString, comPortLen) KeyNameString(KeyValStringSU) = Left(comStrString, comStrLen) ドイツ語のPrint文消してみた http://mevius.5ch.net/test/read.cgi/tech/1482549747/77
78: デフォルトの名無しさん [] 2017/02/18(土) 07:19:28.87 ID:/R2Xi7hr Else 'レジストリキーを読み取りでエラーが発生しました 'Print "Fehler beim Auslesen des Registry Keys (Error"; Ierror; " bei Index"; IQQ; ")" Ierror = Jerror EndIf Next 'Schlussel schliesen RegCloseKey(hKey) 'Print comCnt; " COM-Ports vorhanden" 'TakaBuff = "COM-Ports :" + Str$(comCnt) 'SetDlgItemText(TakaHWND, IDC_STC1, @TakaBuff): '枠表示用バッファ http://mevius.5ch.net/test/read.cgi/tech/1482549747/78
79: デフォルトの名無しさん [] 2017/02/18(土) 07:22:12.51 ID:/R2Xi7hr Else 'Print "Registry Keys Open (Error"; Ierror; ")" 'TakaBuff = "OpenError :" + Str$(Ierror) 'SetDlgItemText(TakaHWND, IDC_STC1, @TakaBuff): '枠表示用バッファ EndIf End Function で終わり。使いたい人は適当に使って。 http://mevius.5ch.net/test/read.cgi/tech/1482549747/79
80: デフォルトの名無しさん [] 2017/02/18(土) 07:31:41.18 ID:/R2Xi7hr このドイツ語サイトでは、'ANSI から UNICODE へ文字数の換算をしている。 FreeBasic では、区別ないで、declare 文を切り替えて使っているので、おかしくなるかもしれないし、 この参照元の著者が考慮しているのかもしれない。 それと、2バイト文字については考慮していないかもしれない。 >>77 で消したプリント文は全角で送ってみる ’Print Left(comPortString, comPortLen) + Chr(9) + Left(comStrString, comStrLen) http://mevius.5ch.net/test/read.cgi/tech/1482549747/80
81: デフォルトの名無しさん [] 2017/02/18(土) 07:53:30.15 ID:/R2Xi7hr このドイツ語サイトで゜気になるのは、>>76 RegEnumValue(hKey, IQQ, StrPtr(comStrString), @comStrLen, Dim IQQ As Integer (For 文内に有った宣言だが、自作宣言チェックルーチンが解釈できない(Dim 文だけ先読みして使用する変数をルーチン別に一覧表を作る)ので移動) RegEnumValueW(byval hKey as HKEY, byval dwIndex as DWORD, 変数型 DWORDを使うところをInteger で参照している。 Integerは、32Bit符号付整数又は64Bit符号付整数 http://makoto-watanabe.main.jp/freebasic/PgInteger.html#start Dword は、32Bit符号無整数 http://makoto-watanabe.main.jp/freebasic/PgUlong.html#start なので、引数の換算ルーチン次第でおかしなことが起こりうる。 http://mevius.5ch.net/test/read.cgi/tech/1482549747/81
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.016s