|
-
February 18th, 2008, 09:18 AM
#31
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.
-
February 18th, 2008, 12:22 PM
#32
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
-
February 19th, 2008, 02:57 AM
#33
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
-
February 19th, 2008, 07:25 AM
#34
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.
-
February 19th, 2008, 12:09 PM
#35
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
-
February 19th, 2008, 02:12 PM
#36
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?
-
February 20th, 2008, 12:15 AM
#37
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
-
February 20th, 2008, 04:31 AM
#38
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
-
February 20th, 2008, 08:38 PM
#39
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...
-
February 21st, 2008, 12:38 AM
#40
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
-
February 21st, 2008, 07:35 AM
#41
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
-
February 21st, 2008, 01:14 PM
#42
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
-
February 22nd, 2008, 07:59 AM
#43
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...
-
February 22nd, 2008, 12:19 PM
#44
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
-
February 22nd, 2008, 06:41 PM
#45
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|