• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

So I'm using this thingie called PSET...

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    So I'm using this thingie called PSET...

    in my Weather fax display program in VB3, see...

    And it's setting pixels in a Picture thingie as part of my form...

    Quite successfully, it shows the image much as I think it should...

    However, it ain't writing it on the bitmap thingie in the Picture... it's doing it somewhere else...

    So when I save the bitmap, there isn't one there, or if I've loaded a blank bitmap into the picture and attempted to write on it, then it saves a blank bitmap.

    Confused of Gamma Centauri.

    Things were much simpler with a 286, dos, MASM, and a hercules display.

    #2
    I have a book or two.

    Using Visual Basic 5, with enterprise edition disk + Visual basic (5) in easy steps.

    Where shall I post it ?
    Confusion is a natural state of being

    Comment


      #3
      Originally posted by zeitghost View Post
      in my Weather fax display program in VB3, see...

      And it's setting pixels in a Picture thingie as part of my form...

      Quite successfully, it shows the image much as I think it should...

      However, it ain't writing it on the bitmap thingie in the Picture... it's doing it somewhere else...

      So when I save the bitmap, there isn't one there, or if I've loaded a blank bitmap into the picture and attempted to write on it, then it saves a blank bitmap.

      Confused of Gamma Centauri.

      Things were much simpler with a 286, dos, MASM, and a hercules display.
      Originally posted by Diver View Post
      I have a book or two.

      Using Visual Basic 5, with enterprise edition disk + Visual basic (5) in easy steps.

      Where shall I post it ?
      The clue was in the original post...

      Anyway, back to the original question.

      Are you constructing a "windows" bitmap?

      Comment


        #4
        Microsoft's MSDN Library, unsurprisingly, no longer has documentation for VB 3...

        How are you attempting to save the image? Are you using the SavePicture statement?

        If you are, and this is what's giving you the result you describe, perhaps you need to set the AutoRedraw property of the PictureBox to True?

        Comment


          #5
          Yup.

          Using SavePicture.

          If I don't have anything loaded into the Picture, then it goes tits up with an error.

          If I have a bitmap loaded, then it just saves it unchanged.

          Tried the autoredraw thingie and it didn't do anything.

          Ho hum.

          I'm sure I'll get my head around it soon.

          If I was writing it in VC++, then I'd expect to have created my very own DIB or something & be merrily setting pixels in that...

          Ho hum. Squared.

          I had a feeling that doing this sort of thing with VB was a bit outside the box...

          It's ever so funny that the thing displays perfectly well, but it's not being written to the bitmap.

          Comment


            #6
            Originally posted by Churchill View Post
            The clue was in the original post...

            Anyway, back to the original question.

            Are you constructing a "windows" bitmap?
            Maybe I should have read it?
            Confusion is a natural state of being

            Comment


              #7
              Originally posted by zeitghost View Post
              Yup.

              Using SavePicture.

              If I don't have anything loaded into the Picture, then it goes tits up with an error.

              If I have a bitmap loaded, then it just saves it unchanged.

              Tried the autoredraw thingie and it didn't do anything.

              Ho hum.

              I'm sure I'll get my head around it soon.

              If I was writing it in VC++, then I'd expect to have created my very own DIB or something & be merrily setting pixels in that...

              Ho hum. Squared.

              I had a feeling that doing this sort of thing with VB was a bit outside the box...

              It's ever so funny that the thing displays perfectly well, but it's not being written to the bitmap.
              Post some code!

              We can't debug it if we can't see it

              Oh hang on, isn't that the point of Visual BASIC - you can't see the code...

              Notwithstanding, GIVE US CODE!

              Comment


                #8
                I'll have to find a floppy disk first so I can transfer it...


                P.S. I'm only using VB3 coz it happens to be on the junk machine in my project room.

                I suppose I could load up something a bit more modern... except there's been dire warnings from the IT lot about sticking unaproved stuff on machines...
                Last edited by zeitghost; 15 June 2017, 08:04.

                Comment


                  #9
                  Originally posted by zeitghost View Post
                  I'll have to find a floppy disk first so I can transfer it...
                  White heat of technology and all that, eh ZG?
                  "Being nice costs nothing and sometimes gets you extra bacon" - Pondlife.

                  Comment


                    #10
                    Indeed.

                    It's a 3.5" floppy, I'll have you know... really up to the minute here...




                    Code:
                    VERSION 2.00
                    Begin Form frmWfaxdisp 
                       Caption         =   "Weather Fax Display Program"
                       ClientHeight    =   5820
                       ClientLeft      =   1095
                       ClientTop       =   1770
                       ClientWidth     =   7365
                       Height          =   6510
                       Left            =   1035
                       LinkTopic       =   "Form1"
                       ScaleHeight     =   388
                       ScaleMode       =   3  'Pixel
                       ScaleWidth      =   491
                       Top             =   1140
                       Width           =   7485
                       Begin CommonDialog CMDialog1 
                          Left            =   2160
                          Top             =   6600
                       End
                       Begin PictureBox picDisplay 
                          Align           =   1  'Align Top
                          AutoSize        =   -1  'True
                          BorderStyle     =   0  'None
                          DrawMode        =   4  'Not Copy Pen
                          Height          =   9000
                          Left            =   0
                          Picture         =   WFAXDISP.FRX:0000
                          ScaleHeight     =   600
                          ScaleMode       =   3  'Pixel
                          ScaleWidth      =   491
                          TabIndex        =   0
                          Top             =   0
                          Width           =   7365
                       End
                       Begin Menu mnuFile 
                          Caption         =   "File"
                          Begin Menu mneSelect 
                             Caption         =   "Select File"
                          End
                          Begin Menu mnuSep2 
                             Caption         =   "-"
                          End
                          Begin Menu mnuSave 
                             Caption         =   "Save File"
                          End
                          Begin Menu mnuSep1 
                             Caption         =   "-"
                          End
                          Begin Menu mnuExit 
                             Caption         =   "E&xit"
                          End
                       End
                    End
                    Option Explicit
                    'File Open/Save Dialog Flags
                     Const OFN_READONLY = &H1&
                     Const OFN_OVERWRITEPROMPT = &H2&
                     Const OFN_HIDEREADONLY = &H4&
                     Const OFN_NOCHANGEDIR = &H8&
                     Const OFN_SHOWHELP = &H10&
                     Const OFN_NOVALIDATE = &H100&
                     Const OFN_ALLOWMULTISELECT = &H200&
                     Const OFN_EXTENSIONDIFFERENT = &H400&
                     Const OFN_PATHMUSTEXIST = &H800&
                     Const OFN_FILEMUSTEXIST = &H1000&
                     Const OFN_CREATEPROMPT = &H2000&
                     Const OFN_SHAREAWARE = &H4000&
                     Const OFN_NOREADONLYRETURN = &H8000&
                    
                    Sub mneSelect_Click ()
                    'dim nestring( 800,400 ) as string
                     Dim filenum As Integer
                     Dim input_char As String
                     Dim R, G, B As Integer       'point colour
                     Dim X, Y           'point location
                     Dim loop_count As Long
                     Dim file_byte_count As Long
                     
                     frmGetFile.cboFileType.AddItem "Fax Files (*.DUP)"
                     frmGetFile.cboFileType.ListIndex = 0
                     frmGetFile.Show 1
                    
                     MsgBox frmGetFile.Tag
                     If frmGetFile.Tag = "" Then Exit Sub
                    
                     filenum = FreeFile
                    
                     Open frmGetFile.Tag For Binary As #filenum
                     file_byte_count = LOF(filenum)
                    
                     Debug.Print file_byte_count
                    
                     X = 1
                     Y = 1
                    
                     For loop_count = 1 To file_byte_count Step 1
                     input_char = Input$(1, #filenum)
                    
                     'MsgBox "input char " + Hex$(Asc(input_char))
                     R = Asc(input_char)
                     G = Asc(input_char)
                     B = Asc(input_char)
                    
                     frmWfaxdisp.picDisplay.PSet (X, Y), RGB(R, G, B) 'firkle pixel
                    
                     X = X + 1
                     If X > 1599 Then 	'end of line?
                        X = 0
                        Y = Y + 1		'new line
                        DoEvents
                     End If
                    
                     If Y > frmWfaxdisp.picDisplay.ScaleHeight Then 'bottom of window?
                     MsgBox "got to end of picturebox"
                     Y = 0
                     End If
                    
                     Next
                    
                     'frmWfaxdisp.picDisplay.AutoRedraw = True 'didn't work...
                    
                    End Sub
                    
                    Sub mnuExit_Click ()
                     End
                    End Sub
                    
                    Sub mnuSave_Click ()
                    
                    Dim filetosave As String
                    
                    
                    CMDialog1.DialogTitle = "Save As"
                    CMDialog1.Flags = OFN_FILEMUSTEXIST Or OFN_PATHMUSTEXIST
                    CMDialog1.Filter = "All Pictures|*.bmp;*.wmf;*.ico"
                    CMDialog1.Action = 2
                    
                    'store name of file to save
                    filetosave = CMDialog1.Filename
                    If filetosave = "" Then Exit Sub
                    
                    MsgBox filetosave
                    'just in case, set up error handler
                    On Error GoTo notSaved
                    
                    'save the picture in picDisp to the file specified in filetosave
                    SavePicture frmWfaxdisp.picDisplay.Picture, filetosave
                    Exit Sub
                    
                    notSaved:
                    MsgBox "Could not save file " + filetosave, 48, "File Save Error"
                    Resume Next
                    
                    End Sub
                    
                    Sub picDisplay_Change ()
                     MsgBox "changed"
                    End Sub


                    There you are... have a good larf...
                    Last edited by zeitghost; 15 June 2017, 08:03.

                    Comment

                    Working...
                    X