CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Weird Error

  1. #1
    Join Date
    Apr 2004
    Posts
    95

    Angry Weird Error

    When I launch a .EXE from my program, it errors..(see attachment)

    and here is the code that executes the .exe:
    Code:
    Private Sub cmd_hostRS_Click()
    If host = True Then
        If frm_host.lbl_rsStatus.Caption = "The host has launched the game." Then
            txt_log = txt_log & "You can not host a game, someone is already hosting!" & vbNewLine
            Exit Sub
        End If
    Else
        If frm_client.lbl_rsStatus.Caption = "The host has launched the game." Then
            txt_log = txt_log & "You can not host a game, someone is already hosting!" & vbNewLine
            Exit Sub
        End If
    End If
    
    For i = 0 To 15
        If frm_log.check_status(i).Value = 0 And frm_log.txt_username(i).Text <> "" Then
            GoTo notrdy
        End If
    Next
    GoTo rdy
    notrdy:
    txt_log = txt_log & "You can not host a game, someone has not checked their ready button." & vbNewLine
    Exit Sub
    rdy:
    Randomize
    Retry:
    portnum = Int((6000 * Rnd) + 1)
    If portnum < 3001 Then GoTo Retry
    HostLaunched = True
    RsP = portnum
    Debug.Print RsP
    SaveString HKEY_LOCAL_MACHINE, "SOFTWARE\Red Storm Entertainment\Rogue Spear", "FootstepSoundVolume", "100.000000"
    SaveString HKEY_LOCAL_MACHINE, "SOFTWARE\Red Storm Entertainment\Rogue Spear", "FullScreen", "FALSE"
    SaveString HKEY_LOCAL_MACHINE, "SOFTWARE\Red Storm Entertainment\Rogue Spear", "MultiplayerAnnounceGames", "FALSE"
    SaveString HKEY_LOCAL_MACHINE, "SOFTWARE\Red Storm Entertainment\Rogue Spear", "MultiplayerMessageName", "FXL Server: " & Mid(RsP, 2, 2) & " FXL"
    
    Ret = GetString(HKEY_LOCAL_MACHINE, "SOFTWARE\Red Storm Entertainment\Rogue Spear", "MultiplayerPlayerName")
    SaveString HKEY_LOCAL_MACHINE, "SOFTWARE\Red Storm Entertainment\Rogue Spear", "MultiplayerPlayerName", Mid(RsP, 2, 2) & " " & alias
    Shell ChosenRsPath & "ROGUESPEAR.EXE" & " -server " & RsP, vbNormalFocus
    
    Launched = True
    frm_log.Visible = False
    If host = True Then
        frm_host.Visible = False
    Else
        frm_client.Visible = False
    End If
    
    StartInSysTray
    End Sub


  2. #2
    Join Date
    Apr 2004
    Location
    Austria
    Posts
    43
    there is no attachmend..

    but I guess your problem is here:

    Shell ChosenRsPath & "ROGUESPEAR.EXE" & " -server " & RsP, vbNormalFocus

    and I think I can also guess why..

    You are trying to start an exe file and give it some parameters.

    if you use shell "notepad.exe" it will work perfectly.. but pass a parameter you would have to execute a string like that:

    "C:\Programs\RainbowSix\Roguespear.exe" -server & rSP

    So you have to get the double quotas into your string.. If I remember correctly it was done somehow like that:

    Shell """" & ChosenRsPath & "ROGUESPEAR.EXE""" & " -server " & RsP, vbNormalFocus

    Or like that (it's been some time since I programmed VB6)

    Shell "''" & ChosenRsPath & "ROGUESPEAR.EXE[COLOR=blue]''[/COLOR" & " -server " & RsP, vbNormalFocus

    what's painted blue isn't one double quota but two ' single quotas...

    greetings UNI

  3. #3
    Join Date
    Apr 2004
    Posts
    95
    ah sorry forgot attachment. here..

    but i did what you said and it still gives that error
    Attached Images Attached Images  
    Last edited by DarkLotus; April 28th, 2004 at 06:07 PM.

  4. #4
    Join Date
    Apr 2004
    Location
    Austria
    Posts
    43
    have you tried the Application on another machine yet?
    because that doesn't seem to be an error that has anything to do with your code

    greetings uNI

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured