음. ActiveX를 안써도 되겠거니 했지만, 테스트 해보니 클라이언트쪽 레지스트리를 가져오는게 아니고

서버 쪽의 레지스트리 값을 가져오네요.. (뭐... 당연한거지만....)

 

출처 : http://support.microsoft.com/kb/316151/ko

 

Imports System.Diagnostics
Imports Microsoft.Win32

 

    Sub WriteRegistry(ByVal ParentKey As RegistryKey, ByVal SubKey As String, _
    ByVal ValueName As String, ByVal Value As Object)

        Dim Key As RegistryKey

        Try
            'Open the registry key.
            Key = ParentKey.OpenSubKey(SubKey, True)
            If Key Is Nothing Then 'if the key doesn't exist.
                Key = ParentKey.CreateSubKey(SubKey)
            End If

            'Set the value.
            Key.SetValue(ValueName, Value)

            Console.WriteLine("Value:{0} for {1} is successfully written.", Value, ValueName)
        Catch e As Exception
            Console.WriteLine("Error occurs in WriteRegistry" & e.Message)
        End Try
    End Sub

 

    Sub ReadRegistry(ByVal ParentKey As RegistryKey, ByVal SubKey As String, _
        ByVal ValueName As String, ByRef Value As String)

        Dim Key As RegistryKey

        Try
            'Open the registry key.
            Key = ParentKey.OpenSubKey(SubKey, True)
            If Key Is Nothing Then 'if the key doesn't exist
                Throw New Exception("The registry key doesn't exist")
            End If

            'Get the value.
            Value = Key.GetValue(ValueName)

            'Console.WriteLine("Value:{0} for {1} is successfully retrieved.", Value, ValueName)
        Catch e As Exception
            'Console.WriteLine("Error occurs in ReadRegistry" & e.Message)
        End Try
    End Sub

 

 

Sub Main()
    WriteRegistry(Registry.CurrentUser, "Software\MySoftware", "Count", 123)

    Dim Value As Object
    ReadRegistry(Registry.CurrentUser, "Software\MySoftware", "Count", Value)

    Console.ReadLine()
End Sub

 

설명은 생략...

해외에서는 IE점유율이 없어서...

즉, ActiveX를 싫어해서, Asp.net 을 이용해서 레지스트리 값을 얻어온뒤 게임을 실행하는 방법을 연구중...

 

이전에 구글링해서 얻은 자료는 2001년꺼라... 작동도 안되고 ㅠㅠ..

 

어쨋든... 이후 프로그램 실행은..

Dim gamePath As String
gamePath = ""
ReadRegistry(Registry.CurrentUser, "Software\OceanFishing", "Path", gamePath)
Shell(gamePath + " " + GameLauncherIncode(id, 12345678), AppWinStyle.NormalFocus)

 

이런식으로 실행시키면 ok.....

 

+ Recent posts