Click here to Skip to main content
15,881,882 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Starting program with a command line parameter Pin
Dave Kreskowiak10-May-12 9:20
mveDave Kreskowiak10-May-12 9:20 
GeneralRe: Starting program with a command line parameter Pin
KreativeKai10-May-12 9:29
professionalKreativeKai10-May-12 9:29 
GeneralRe: Starting program with a command line parameter Pin
Dave Kreskowiak10-May-12 12:53
mveDave Kreskowiak10-May-12 12:53 
GeneralRe: Starting program with a command line parameter Pin
KreativeKai11-May-12 1:29
professionalKreativeKai11-May-12 1:29 
GeneralRe: Starting program with a command line parameter Pin
Dave Kreskowiak11-May-12 1:38
mveDave Kreskowiak11-May-12 1:38 
GeneralRe: Starting program with a command line parameter Pin
KreativeKai11-May-12 1:57
professionalKreativeKai11-May-12 1:57 
AnswerRe: Starting program with a command line parameter Pin
Sasha Laurel15-May-12 13:40
Sasha Laurel15-May-12 13:40 
AnswerRe: Starting program with a command line parameter Pin
pcusr806-Jun-12 3:57
pcusr806-Jun-12 3:57 
I have made a program that calls itself.
I must pass the command line to it, but the program must know in with state it is. (first call or the second on)
I think i found the ideal solution for this problem.
The global atom database!
<pre lang="vb">
Private sub main()
Nta = FndAtom("AdminRunStatus")
    If Nta = 0 Then
      Nta = SetAtom("AdminRunStatus")
      'set the status for the second run
    'do something for the first run (shell to myself)
 call shell (App.Path & "\" & App.EXEName & " " & Command)
     
        End If
        Exit Sub
    Else
        Call DelAtom(Nta)
      'second program and the command line
      call shell(Second program & " " & Command)
      'do something for the second run.
   End sub


This my created wrapper for the atom database:
VB
'---------------------------------------------------------------------------------------
' Module    : AtomDataBase Wrapper
' Author    : Pcuser80
' Date      : 03-06-2012
' Purpose   : Atom Wrapper
'---------------------------------------------------------------------------------------

Option Explicit

Private Declare Function InitAtomTable Lib "kernel32" (ByVal nSize As Long) As Long
Private Declare Function AddAtom Lib "kernel32" Alias "AddAtomA" (ByVal lpString As String) As Integer
Private Declare Function DeleteAtom Lib "kernel32" (ByVal nAtom As Integer) As Integer
Private Declare Function FindAtom Lib "kernel32" Alias "FindAtomA" (ByVal lpString As String) As Integer
Private Declare Function GetAtomName Lib "kernel32" Alias "GetAtomNameA" (ByVal nAtom As Integer, ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GlobalAddAtom Lib "kernel32" Alias "GlobalAddAtomA" (ByVal lpString As String) As Integer
Private Declare Function GlobalDeleteAtom Lib "kernel32" (ByVal nAtom As Integer) As Integer
Private Declare Function GlobalFindAtom Lib "kernel32" Alias "GlobalFindAtomA" (ByVal lpString As String) As Integer
Private Declare Function GlobalGetAtomName Lib "kernel32" Alias "GlobalGetAtomNameA" (ByVal nAtom As Integer, ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Function SetAtom(ByVal AtomStr As String) As Integer
    SetAtom = GlobalAddAtom(AtomStr)
End Function
Public Function GetAtom(ByVal Atom As Integer) As String
    Dim buFfer         As String
    Dim lRet           As Long
    buFfer = String(255, 0)
    lRet = GlobalGetAtomName(Atom, buFfer, Len(buFfer))
    If lRet > 0 Then
        buFfer = Left$(buFfer, lRet)
        GetAtom = buFfer
    Else
        GetAtom = vbNullString
    End If
End Function
Public Function DelAtom(ByVal Atom As Integer) As Integer
    DelAtom = GlobalDeleteAtom(Atom)
End Function
Public Function LocDelAtom(ByVal Atom As Integer) As Integer
    LocDelAtom = DeleteAtom(Atom)
End Function
Public Function LocSetAtom(ByVal Atom As String) As Integer
    LocSetAtom = AddAtom(Atom)
End Function
Public Function LocGetAtom(ByVal Atom As Integer) As String
    Dim buFfer         As String
    Dim lRet           As Long
    buFfer = String(255, 0)
    lRet = GetAtomName(Atom, buFfer, Len(buFfer))
    If lRet > 0 Then
        buFfer = Left$(buFfer, lRet)
        LocGetAtom = buFfer
    Else
        LocGetAtom = vbNullString
    End If
End Function
Public Function LocFndAtom(ByVal AtomStr As String) As Integer
    LocFndAtom = FindAtom(AtomStr)
End Function
Public Function FndAtom(ByVal AtomStr As String) As Integer
    FndAtom = GlobalFindAtom(AtomStr)
End Function
Public Function LocInitAtom(nSize As Long) As Long
    LocInitAtom = InitAtomTable(nSize)
End Function

QuestionDRAG & DROP LABELS SWAP Pin
User 871522210-May-12 0:57
professionalUser 871522210-May-12 0:57 
AnswerRe: DRAG & DROP LABELS SWAP Pin
Dave Kreskowiak10-May-12 2:21
mveDave Kreskowiak10-May-12 2:21 
AnswerRe: DRAG & DROP LABELS SWAP Pin
User 871522210-May-12 23:11
professionalUser 871522210-May-12 23:11 
QuestionGet currency conversion from website Pin
wouterv819-May-12 13:33
wouterv819-May-12 13:33 
AnswerRe: Get currency conversion from website Pin
Dave Kreskowiak9-May-12 18:44
mveDave Kreskowiak9-May-12 18:44 
QuestionThis row already belongs to this table error Pin
rusydan.khir9-May-12 7:03
rusydan.khir9-May-12 7:03 
AnswerRe: This row already belongs to this table error Pin
Dave Kreskowiak9-May-12 10:23
mveDave Kreskowiak9-May-12 10:23 
GeneralRe: This row already belongs to this table error Pin
rusydan.khir9-May-12 18:27
rusydan.khir9-May-12 18:27 
GeneralRe: This row already belongs to this table error Pin
Dave Kreskowiak9-May-12 18:46
mveDave Kreskowiak9-May-12 18:46 
GeneralRe: This row already belongs to this table error Pin
rusydan.khir9-May-12 18:49
rusydan.khir9-May-12 18:49 
GeneralRe: This row already belongs to this table error Pin
rusydan.khir9-May-12 19:01
rusydan.khir9-May-12 19:01 
Questionstrange behavior on adding controls to a form Pin
Ahmad_kelany8-May-12 22:22
Ahmad_kelany8-May-12 22:22 
AnswerRe: strange behavior on adding controls to a form Pin
Dave Kreskowiak9-May-12 10:20
mveDave Kreskowiak9-May-12 10:20 
QuestionHow can I get a sender object of a control handle in VB.net? Pin
Member 37460768-May-12 13:27
Member 37460768-May-12 13:27 
AnswerRe: How can I get a sender object of a control handle in VB.net? Pin
Midnight Ahri8-May-12 15:16
Midnight Ahri8-May-12 15:16 
GeneralRe: How can I get a sender object of a control handle in VB.net? Pin
Member 37460769-May-12 6:55
Member 37460769-May-12 6:55 
AnswerRe: How can I get a sender object of a control handle in VB.net? Pin
Eddy Vluggen9-May-12 0:10
professionalEddy Vluggen9-May-12 0:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.