Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27020

[VB2010] - how execute a program with ShellExecute()?

$
0
0
heres how i declare the ShellExecute() API function:
Code:

Private Declare Function ShellExecute Lib "shell32" _
        Alias "ShellExecuteA" (ByRef hwnd As Integer, ByVal Operation As String,
                              ByVal Filename As String, ByVal Parameters As String,
                              ByVal Directory As String, ByVal ShowCommand As Integer) _
                                As Integer

heres how i use it:
Code:

Private Sub btnConvertCode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvertCode.Click


        Dim strCompilerName As String
        Dim strCPPFonteName As String
        Dim strEXEFileName As String
        Dim App_Path As String
        Dim strMainIcon As String
        Dim strRC As String
        Dim strResCompilerName As String

        App_Path = Application.StartupPath


        ConvertCode(rtbConvertedCode, rtbCode)


        rtbConvertedCode.SaveFile(App_Path & "\test.cpp", RichTextBoxStreamType.PlainText)
        strCompilerName = """" & App_Path & "\MinGW32\bin\g++.exe" & """"
        strEXEFileName = """" & App_Path & "\test" & """"
        strCPPFonteName = """" & App_Path & "\test.cpp"
        strMainIcon = """" & App_Path & "\MainIcon.res" & """"
        strRC = """" & App_Path & "\MainIcon.rc" & """"
        strResCompilerName = """" & App_Path & "\MinGW32\bin\windres.exe" & """"

        ShellExecute(Me.Handle, "open", strCompilerName, "-o " & strEXEFileName & " " & strCPPFonteName, App_Path & "\MinGW32\bin", 10)

    End Sub

my problem is:
- or the declaration isn't correct;
- or my strings aren't incorrect:(
can anyone advice me?

Viewing all articles
Browse latest Browse all 27020

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>