Results 1 to 6 of 6

Thread: Newbie quetsion, startup arguments

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    1

    Newbie quetsion, startup arguments

    Hi,

    I new to VB, and have a question. If start an application by dropping a file or files on the icon of the program created in VB, how do I access these files inside the application?

    Best regards,
    Adam Ek

  2. #2
    Megatron
    Guest
    The command line arguments are stored in the Command$ variable
    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3.     'Display the command line arguments
    4.     MsgBox Command$
    5.    
    6. End Sub

  3. #3
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Did you want to include drag and drop? Set OLEDropMode of a textbox to Manual, Multiline to True and use this code
    VB Code:
    1. Private Sub Text1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.  
    3. Dim intFF As Long
    4. intFF = FreeFile
    5.  
    6. Open Data.Files(1) For Input As #intFF
    7. Text1.Text = Input(LOF(intFF), #intFF)
    8. Close #intFF
    9.  
    10. End Sub

  4. #4
    DaoK
    Guest
    How can I modified that code to be able to paste picture in a rtb1.

    This is what I made to change the TEXT1 >> RTB!

    VB Code:
    1. 'Chrishjk code
    2. Private Sub rtb1_OLEDragDrop(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
    3. Dim intFF As Long
    4. intFF = FreeFile
    5.  
    6. Open Data.Files(1) For Input As #intFF
    7. rtb1.Text = Input(LOF(intFF), #intFF)
    8. Close #intFF
    9. End Sub

    When I drop image it give me an error How can I stop taht error by simply put the picture in ?

  5. #5
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    I wouldn't expect that to work for pictures (being .Text and all)

    This might work
    VB Code:
    1. Private Sub RichTextBox1_OLEDragDrop(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
    2.  
    3. RichTextBox1.OLEObjects.Add , , Data.Files(1)
    4.  
    5. End Sub

  6. #6
    DaoK
    Guest
    Thank you,

    Daok

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