CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 48
  1. #31
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Code not running Win98

    This is weird...
    Try to put a delay in instead of the MsgBox
    Code:
    'top of form
    Private Declare Sub Sleep Lib "kernel32" (ByVal ms as Long)
    
    'in your code instead of MsgBox
    Sleep 1000 'wait 1 second
    see what happens.

  2. #32
    Join Date
    Aug 2007
    Posts
    445

    Re: Code not running Win98

    i will try it tommorow in office, but do you think this is good to sleep for 1 second? if it works

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  3. #33
    Join Date
    Aug 2007
    Posts
    445

    Re: Code not running Win98

    not working with sleep API, but works onmousemove()
    Last edited by chunks; February 19th, 2008 at 12:04 PM.

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  4. #34
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Code not running Win98

    Try shorter delay times if 1 second seems to much. You can find the minimum required delay by trial.

    Or just a thought: try a DoEvents instead of the sleep. Maybe that helps already.

    What do you mean by onmousemove() ? I don't understand... sorry.

  5. #35
    Join Date
    Aug 2007
    Posts
    445

    Re: Code not running Win98

    this code is working on mousemove event on RTB like in Win98SE
    Code:
    Private Sub RTB_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim f&
      Dim h%
      h = Me.TextHeight("A")
      Do
        RichBox.SelStart = 0
        RichBox.SelStart = Len(RichBox.Text)
        f = SendMessage(RichBox.hWnd, EM_GETFIRSTVISIBLELINE, 0&, 0&)
        If f > 0 Then RichBox.Height = RichBox.Height + h * f
      Loop While f > 0
    End Sub
    but i want it to work on

    Code:
    Private Sub RTB_Change()
    
    End Sub
    i tried it with sleep API instead of msgbox but does not works

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  6. #36
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Code not running Win98

    Ok. Let's see if the Change() event fires at all.
    Put a Beep command in and then type something. You should hear an acoustic signal every time the contents of the box changes. If the event fires, then put the code you postet into the event.

    On the other hand, I see something in the code, which makes me wonder if there is some other error:

    Your event handler has the name of RTB_Change(). That makes me think, the name of your RichTextBox is RTB.
    BUT in your loop you are adressing a control named RichBox (as was a parameter in my original code as I recall).
    Code:
      Do
        RichBox.SelStart = 0
        RichBox.SelStart = Len(RichBox.Text)
        f = SendMessage(RichBox.hWnd, EM_GETFIRSTVISIBLELINE, 0&, 0&)
        If f > 0 Then RichBox.Height = RichBox.Height + h * f
      Loop While f > 0
    Maybe there is the problem. Replace RichBox by RTB?

  7. #37
    Join Date
    Aug 2007
    Posts
    445

    Re: Code not running Win98

    this is not the problem actully i wrote this manully did not copy it from the code window
    Code:
    Private Sub RTB_Change()
    
    End Sub
    this is my real project code
    Code:
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    
    Private Const EM_GETFIRSTVISIBLELINE = &HCE
    
    Private Sub RTBQUE_Change()
    Dim f As Long
      Dim h As Long
      h = Me.TextHeight("A")
      Do
        RTBQUE.SelStart = 0
        RTBQUE.SelStart = Len(RTBQUE.Text)
        f = SendMessage(RTBQUE.hwnd, EM_GETFIRSTVISIBLELINE, 0&, 0&)
        If f > 0 Then RTBQUE.Height = RTBQUE.Height + h * f
      Loop While f > 0
     
    
    End Sub

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  8. #38
    Join Date
    Aug 2007
    Posts
    445

    Re: Code not running Win98

    only this line is not working
    Code:
    RTBQUE.Height = RTBQUE.Height + h * f

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  9. #39
    Join Date
    Apr 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    1,792

    Re: Code not running Win98

    if f = SendMessage(RTBQUE.hwnd, EM_GETFIRSTVISIBLELINE, 0&, 0&)
    returns a 0, then your line
    RTBQUE.Height = RTBQUE.Height + h * f
    will also return 0

    Put a breakpoint on the sendmessage line, and see what f is once its been executed.
    Be nice to Harley riders...

  10. #40
    Join Date
    Aug 2007
    Posts
    445

    Re: Code not running Win98

    f is also returning 0 in Win98 but it does not return 0 in XP or other OS. I have same copy of example in both OS

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  11. #41
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Code not running Win98

    I would rather check again in your Win98 if the RICHTX32.ocx is really the same as in XP.

    I reported how I replaced it in my Win98 which turned out not to be Win98SE. In my system RICHTX32.ocx was in the windows\system folder...

    Please check if your Win98SE does not have a RICHTX32.ocx in the windows\system32 folder.
    If it has, replace this with the one from your XP in the same way I described before.
    unregister the existing, typing regsvr32 richtx32.ocx /u
    copy the XP one to system32
    register the new one, typing regsvr32 richtx32.ocx

  12. #42
    Join Date
    Aug 2007
    Posts
    445

    Re: Code not running Win98

    i did everything you said before of replacing .ocx but that is not working with my Win98SE, richtx32.ocx is located in System folder.

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  13. #43
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Code not running Win98

    I will try to get access to a Win98SE system at the weekend.
    Otherwise I'm at my wit's end, or so it seems...

  14. #44
    Join Date
    Aug 2007
    Posts
    445

    Re: Code not running Win98

    this will not work in Win98SE if the code is just written on RTB_Change() and Rtb is being changed at form_load(), But on the other hand if you call Rtb_change() on Form_Load() or Form_Activate() then you will see code will show Rtb(S) last line, but will not change the height of RTB. Thanks WoF for being with this thread and for your great help

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  15. #45
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Code not running Win98

    You're welcome. *phew* Finally a result.
    Because I can't get to a working Win98Se installation currently. Everybody has upgraded to at least WinXP, see?

Page 3 of 4 FirstFirst 1234 LastLast

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

Featured