Results 1 to 3 of 3

Thread: opening a graphic

  1. #1

    Thread Starter
    Hyperactive Member theman32x's Avatar
    Join Date
    May 2000
    Location
    New Jersey, USA
    Posts
    305

    Question

    i made this program that opens up graphics so u can see them without having to open up adobe or such other big programs ...

    well, i manage to do this by opening the pic with the common dialog box once my program is loaded...

    but my problem is how to open up my prog n load the picture ... get me?

    i associated my program with bmp's but when i open a bmp up n my program starts up it doesn't load the graphic ... how do i go about doing this?

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    Exclamation Try this...

    You say you already associated your program with BMP's, and when you open a BMP file, your program loads. Well, you're through with the hard part. Now the easy part!

    In the opening routine (Form_Load, Sub Main or whatever) put this code:
    Code:
    Dim sFileName As String
    ' We may get an error in the LoadPicture...
    ' Because sFileName may not be a supported file type (or maybe not even a filename)
    ' So, we use the nifty On Error Resume Next statement:
    On Error Resume Next
    sFileName = Trim(Command)
    If Len(sFileName) > 0 Then
    
        ' If we get here, that means a BMP or whatever opened this program.
        ' sFileName is (maybe?) the filename of the BMP.
        ' You should add some code here which will open sFileName in your PictureBox. Example:
    
        Set MyPictureBox.Picture = LoadPicture(sFileName)
    
    End If
    That should be it! Good luck with your program.

  3. #3

    Thread Starter
    Hyperactive Member theman32x's Avatar
    Join Date
    May 2000
    Location
    New Jersey, USA
    Posts
    305

    Smile thanks

    hey thanks for that code ... it worked well ... the only way it was easy for me to associate my program with bmp's was because i did it on my system ... i didn't do it by programming ... but like i said ... thanks for your help

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