|
This is a rich edit, right? Normal text boxes require a different use of the lParam parameter.
Check your lPoint value in hex and make sure it looks OK, in case the attempt to form lPoint went wrong - if it did, try using "&h10000&" instead of "65536", and try using "Or" instead of "+".
|
|
|
|
|
Thanks for your response.
Actually it is a Normal TextBox. I looked over the documentation on MSDN and found that there was a slight problem. I was passing lPoint as ClientCoordinates not ScreenCoordinates, so I fixed that, yet SendMessage is still returning -1.
MSDN Says....
"Edit controls: The low-order word contains the horizontal coordinate. The high-order word contains the vertical coordinate."
It appears that is what I am doing.....
GetCaretPos ptCaret
ClientToScreen txtPrice.hwnd, ptCaret
lPoint = (ptCaret.y * &H10000) Or (ptCaret.x And &HFFFF&)
lIndex = SendMessage(txtPrice.hwnd, EM_CHARFROMPOS, 0, lPoint)
If lIndex And &H8000& Then
nCharIndex = lIndex Or &HFFFF0000
Else
nCharIndex = lIndex And &HFFFF&
End If
Thanks
Chris Mancini
|
|
|
|
|
Ignore my rich edit comment... for some reason I thought you were passing lParam incorrectly, but you are not - my mistake.
I see no reason why this would not work then. You checked lPoint in hex to make sure it was formed right, did you? Other than that the only other reason I can think of that it would return this (it's actually returning two short integers, both -1: for line number and char number) is if there was no text in the control at the specified point... are you clicking within a portion you KNOW contains text, or are you cliking beyond the text it contains?
|
|
|
|
|
Yes I did check the lPoint value in Hex. It was set up correctly.
I am not clicking in the control to trigger the code I am doing the code within KeyPress. I know the textbox has text. And I have tried it when the cursor is at the end of the text as well as in the middle of the text.
I am stumped.
Chris Mancini
|
|
|
|
|
I'm stumped too. If you had only tried with the caret at the end, I might have understood; MSDN also says:
"The index indicates the line delimiter if the specified point is beyond the last visible character in a line."
which might explain the -1.
But if you've tried it from the middle...
I'm not sure what you're trying to achieve, but an alternative might be to keep a copy of the text box's text each time a key is pressed. Then when the next key is pressed, you can get its current contents and compare to the contents saved from last time. That will tell you what character has been deleted or added...
|
|
|
|
|
If you are interested I put together a simple demo which is shows this happening.
Chris Mancini
|
|
|
|
|
Yes, OK - throw it my way (jteagle@ntlworld.com). Tomorrow I can then take a look and see if I can spot anything (I'm on UK time). No guarantees though.
|
|
|
|
|
|
test 2
test 2
|
|
|
|
|
Hi ! I'm Lucky Luck, I'm student in Australia, I like programming with VB, I want to ask you anything :
When I creat any form, I don't know what to do in spite of form ? What will I do ?? Ex : Program : - Sonicque
- Herosoft
- ....anything
|
|
|
|
|
Well, you're not the only one who's confused here What exactly are you trying to ask?
--------------
"Criticism is often constructive because it makes you feel superior when you give it"
-- Dogbert
|
|
|
|
|
Hi ! I'm Lucky Luck, I'm student in Australia, I like programming with VB, I want to ask you anything :
When I creat any form, I don't know what to do in spite of form ? What will I do ?? Ex : Program : - Sonicque
- Herosoft
- ....anything
|
|
|
|
|
Hi
I've been trying to get a macro to refresh the formulae in a workbook (say every 10 seconds or so) to update a timer I've constructed. I will need to be able to run other macros while the timer is running.
Can anyone point me in the right direction please?
Thanks
Geoff Anderson
|
|
|
|
|
maybe the DoEvents will help you?
Qapla
|
|
|
|
|
Hi
I've been trying to find how to get a macro to adjust the size of a range of data that feeds a chart. I want the range to grow by one cell each time a new piece of data is logged.
Can anyone help please?
Geoff Anderson
|
|
|
|
|
I don't think this even uses a macro, but check out this example:
http://www.ozgrid.com/download/default.htm
Go to this site and download the ChartByMonth.zip example.
|
|
|
|
|
Are there any VB functions, or is ther a way to retrieve general information about a PC. Information such as Make, Model, Monitor Make, Network Card Make and Model
Joe
|
|
|
|
|
Assuming you are talking Microsoft OS...MS Diagnostics holds most of what you've mentioned if not all and you could possibly get that info from the registry.
I too would be interested in other methods to solve this problem.
Best to you...
\\Jim
General System Information
jamesdturner@hotmail.com
jamesdturner@hotmail.com
|
|
|
|
|
Are there any VB functions, or is ther a way to retrieve general information about a PC. Information such as Make, Model, Monitoer Make, Network Card Make and Model
Joe
|
|
|
|
|
Is ther any one can tell me that how to creat a sub property in ActiveX control, like A recordset has sub properties and the TableDef has an array or properties and same with the fields.
I will obviously thankfull to you.
sameers
sameers@hangamahouse.com
|
|
|
|
|
i think you mean something like this
in class, MyActiveXControl
<br />
Private m_sStringProperty as String<br />
<br />
...<br />
<br />
Public Property Get MyStringProperty() as String<br />
MyStringProperty = m_sStringProperty<br />
End Property<br />
<br />
Public Property Let MyStringProperty(sSP as String)<br />
' Validate if you want<br />
m_sStringProperty = MyStringProperty<br />
End Property<br />
You can also use 'Public Property Set' to have an object be a property and you can use Private to make your property read/write only as well.
James Johnson
--
There are two secrets to success. 1) Never tell anyone everything you know.
|
|
|
|
|
I understand how to go from a HelpContextID to an .htm file using the Map and Alias
tabs of the HTML Help Workshop.
Can one go from a HelpContextID to a bookmark in an HTML file?
Specifying
IDH_Helpme = file.htm#bookmark
does not work (It gives file file.htm#ookmark not found). Is there a syntax which does work?
thanks
nick toop
|
|
|
|
|
Hello codegurus,
I have a deep problem with Visual Basic. I just started using it a few days ago so there's still a lot to learn (sorry for any dull questions). The problem is that I tried to put a lot of controls on a form that I had to change the height of the form to the maximum but still needed to put more controls so I thought it was best to add scroll bars to the form and just scroll the contents of the page. OK, now I have two problems; the first probelm is that I have resized the form to its maximum height but still need to add more controls, how can I change the height of the form after it reached its maximum (11520 twips on 1024x768 resolution)?! Do I have to create the controls dynamically? Or should I just place them anywhere then change their positions at run-time? the second problem is that I can't add scroll bars to the form (of course I could've used the scroll bar control but this is not what I want, I want to add the scroll bars to the window not as seperate controls). Should I use SetWindowLong() to change the style of the window at run-time? If I add the scroll bars how can I scroll the contents of the page?
Any suggestions would be appreciated.
|
|
|
|
|
Hehe, Why not try EasyGrid ActiveX?
It'll be helpful.
I guess it can be found in the web.
But I forget the Url.
Try at altavista.com with the keyword of easygrid activex.
best wishes.
|
|
|
|
|
Hi everyone...
I'm new at working around vba and i'm trying to figure out a way to secure a mde file using a access form at the begining of the program.
What it should do is check if the user has a registered key to access the main program file and allow him to work on the database.
And if he doesn't have a registered key, get him to call the client to obtain one.
So there's the the problem... i don't know where to start.
Can anyone help me with this?
Any example code is appreciated...
|
|
|
|