• 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!

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "So I'm using this thingie called PSET..."

Collapse

  • zeitghost
    replied
    Originally posted by xoggoth View Post
    I gave a load of old books including a beginner's guide to VB3 to the Barnardo's charity shop last year. If you hurry Z it may still be there.
    Thanks, Xogg, I'll pop along tomorrow morning. Probably gone though...

    Leave a comment:


  • xoggoth
    replied
    I gave a load of old books including a beginner's guide to VB3 to the Barnardo's charity shop last year. If you hurry Z it may still be there.

    Leave a comment:


  • zeitghost
    replied
    Originally posted by NickFitz View Post
    HTH

    You'd never guess that I've never done any VB programming, would you



    Not really, no... it seemed your usual sort of now you mention it...



    I'm moving on now to the 4046 PLL setup, coz it's set for a centre frequency of about 4.5kHz, which is far too high.

    I shall have to redimension things a bit... to bring it down to say 2.5kHz...



    Well, I've done that & it does appear to receive stuff...

    After much frigging around with pixel counts, it displays stuff.

    Oddly, the timing seems very variable... I can't decide if VB is dropping characters or if the PIC16F88 is sampling randomly... I find it difficult to believe that the pic could be as far out as it looks on the screen... but I may well be wrong there.


    It is indeed very odd... if I make the display window larger, the timing goes all to pot...

    How weird is that?


    Down to the speed of the pc, I've migrated the code on a floppy over to a slightly faster machine & the scan rate doesn't change any more.

    Since it's running XP, however, the serial handling seems to have slowed to a crawl...
    Last edited by zeitghost; 15 June 2017, 08:00.

    Leave a comment:


  • DaveB
    replied
    Originally posted by NickFitz View Post
    HTH

    You'd never guess that I've never done any VB programming, would you
    Tell Bob and the rest of the Mumbai posse well done

    Leave a comment:


  • NickFitz
    replied
    Originally posted by zeitghost
    Muchos gracias...
    HTH

    You'd never guess that I've never done any VB programming, would you

    Leave a comment:


  • zeitghost
    replied
    Danke.

    I shall try that tomorrow.

    I frigged about with that image thingie last week to no great avail... but then I don't know what I'm doing anyway...

    I loaded up my, er, "copy" of VB3 pro today, coz it's got the MSCOMM thingie in it...

    I've hacked about with the VBTERM example & have it writing stuff to a Picture that I've added.

    It actually shows the range of the pll chip is quite limited, I may have to shift some bits in the PIC to restore it to something more applicable.

    Or alternatively, I may attempt to use the external VRef I designed onto the board...



    Originally posted by NickFitz View Post
    First, you need to set the AutoRedraw property to True before you do the drawing - the system then knows to keep track of what you draw. Otherwise, it expects you to have a Paint event handler that will redraw it every time.

    You can check if this is the problem by hiding the window behind another window and then bringing it to the front again - if the PictureBox isn't redrawn, then change the code to set AutoRedraw before drawing, and try again - it should now work as expected.
    Yup.

    Did that, it now redraws ok... still doesn't save the image though...

    I'm onto the next suggestion now, with the .Image thingie instead of the .Picture thingie...

    This is so exciting...


    Yes! Yes! Yes!.... the .Image thing does the business...

    Muchos gracias...
    Last edited by zeitghost; 15 June 2017, 08:01.

    Leave a comment:


  • NickFitz
    replied
    First, you need to set the AutoRedraw property to True before you do the drawing - the system then knows to keep track of what you draw. Otherwise, it expects you to have a Paint event handler that will redraw it every time.

    You can check if this is the problem by hiding the window behind another window and then bringing it to the front again - if the PictureBox isn't redrawn, then change the code to set AutoRedraw before drawing, and try again - it should now work as expected.

    (The hide/show test may also be graphics-driver-dependant, so do the AutoRedraw thing even if it seems unnecessary after the first hide/show test.)

    If that's working but it's still not saving correctly, try changing
    Code:
    SavePicture frmWfaxdisp.picDisplay.Picture, filetosave
    to
    Code:
    SavePicture frmWfaxdisp.picDisplay.Image, filetosave
    and see if that works.

    Finally, some people claim that setting the PictureBox's Picture property to the value of its Image property will work, but that sounds a bit voodoo chicken to me - also, the VB docs seem to suggest that the Picture property is read-only at runtime. But if all the above fails, give that a try - revert the change to the SavePicture call as well if you try this.

    Leave a comment:


  • zeitghost
    replied
    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.

    Leave a comment:


  • DaveB
    replied
    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?

    Leave a comment:


  • zeitghost
    replied
    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.

    Leave a comment:


  • NickFitz
    replied
    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!

    Leave a comment:


  • Diver
    replied
    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?

    Leave a comment:


  • zeitghost
    replied
    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.

    Leave a comment:


  • NickFitz
    replied
    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?

    Leave a comment:


  • Churchill
    replied
    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?

    Leave a comment:

Working...
X