Results 1 to 9 of 9

Thread: A couple of questions..

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 1999
    Location
    Skudeneshavn, Norway
    Posts
    38
    Hi

    Can someone please tell me why my code don't work

    Shell (App.Path + "Tit_edit.exe")

    I need to start a little prog I made from another.
    any clues.

    And another question.

    the Tit_edit.exe is a small text editor, and it is
    missing a function I'd like it to have. FIND & REPLACE

    Any clues to find & replace in a selected text.

    hope you can help.


    Best regards,

    Chris




    Christian Davidsen

    If you go to sleep with an itchy
    ass, you wake up with smelly fingers.

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    87
    This should work
    Shell (App.Path + "\Tit_edit.exe")
    I think you forgot slash.

  3. #3
    Guest

    try this

    hi there...try this code instead...
    put your path and app name in the brackets

    returnvalue = Shell("c:\app.exe", 1)
    AppActivate returnvalue


    john

  4. #4
    Lively Member
    Join Date
    May 2000
    Location
    Norway
    Posts
    112
    Try looking up the ShellExecute API-command to, while you are at it.

  5. #5
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Originally posted by Thomas Halsvik
    Try looking up the ShellExecute API-command to, while you are at it.
    Why? The code of the other people that have posted works.

  6. #6
    Guest

    jump in

    hi..i think what thomas means is that you should also look up the shell api and see for yourself.one learns by doing and seeing. so go on...look it up anyway and you might just learn a few more tricks


    john

  7. #7
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    'use this to set App.Path to inclued \ if not present
    
    Dim AppPath$
                
    If Right(App.Path, 1) <> "\" Then 
        AppPath = App.Path & "\" 
    Else 
        AppPath = App.Path        
    End If
    
    'notice the AppPath is your version with the \ and not App.Path
    
    	Shell (AppPath + "Tit_edit.exe") 
    
    
    'Shelldef works like this.
    
    Option Explicit
    'put this in a bas module
    '
     Public Declare Function ShellEx Lib "shell32.dll" Alias _
     "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
     ByVal lpFile As String, ByVal lpParameters As Any, _
     ByVal lpDirectory As Any, ByVal nShowCmd As Long) As Long
     '
     Sub ShellDef(strFileName)
       x = ShellEx(Me.hwnd, "open", strFileName, "", "", 1)
     End Sub
    
    '''''''''''''''''''''''''''''''''''''''
    'form code
    
    Option Explicit
    
    Private Sub Form_Load()
    '
     Dim strYourFileVariable$
      strYourFileVariable = "Tit_edit.exe"
      ShellDef strYourFileVariable
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  8. #8
    Guest
    Thomas could be a tough VB teacher because he wants everyone to look up themselves.

    The last time I posted about a VB Bug, he didn't tell me to look it up.

    Anyway, it's:

    Code:
    Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
    ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
    ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    
    'hwnd: Handle of the Object
    'lpOperation: open, print, or explore
    'lpFile: Name of the File
    'lpParameters: Parameters to put BEHING the name of the app.
    lpDirectory: Directory of the File or Folder
    nShowCmd: Windowstate, see: ShellExecute in MSDN.

  9. #9
    Guest
    To answer your second question, you can use the Instr and Replace functions.

    Code:
    If Instr(Text1.text, "MyText") Then
    Text1.text = Replace(Text1.text, "MyText", "YourText")
    End If

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