Prev: SendInput and Unicode
Next: Run Time Creating Controls
From: "Bill McCarthy" TPASoft.com Are Identity on 2 Feb 2009 22:24 "mayayana" <mayaXXyana(a)rcXXn.com> wrote in message news:uqWMpgWhJHA.1248(a)TK2MSFTNGP03.phx.gbl... > > Note that the docs say EM_CHARFROMPOS returns the nearest > char. offset in the low word and the nearest line number in the > high word. What doc ? >That info. seems to be either outdated or just wrong. Or your source is outdated. > As far as I can tell, the return value is just the char. offset. > (Which makes sense. If it were the low word then only 65000-odd > characters could be counted.) > <sigh> There is indeed a limit on edit controls around that area, but rich edit controls don't return a Long containing the co-ordinates, rather they return a pointer to a POINTL structure which has two 32 bit fields. Here's the first link google returns. I suggest you read it: http://msdn.microsoft.com/en-us/library/bb761566(VS.85).aspx
From: mayayana on 3 Feb 2009 00:10 > If you are using the mouse up, unless you intervene, the selection has been > set. In which case you really only need to call EM_LINEFROMCHAR passing > in -1 as the wParam. That will give you the line index of the selection. > Eduardo M. actually has a GetCharPos function for that. It's a bit confusing in that his function returns the line and/or column number and requires the char. offset as input.
From: Jan Opitz on 3 Feb 2009 07:06 Many thanks to both of you. EM_LINEFROMCHAR seems to be a very convenient way to find the character. @mayayana: could you please tell me how to manage the char offset as input for the GetCharPos in Eduardo's Richedit? Regards, Jan "mayayana" <mayaXXyana(a)rcXXn.com> schrieb im Newsbeitrag news:eusQJ1bhJHA.996(a)TK2MSFTNGP02.phx.gbl... > > Eduardo M. actually has a GetCharPos function for > that. It's a bit confusing in that his function returns the > line and/or column number and requires the char. offset > as input. >
From: Jan Opitz on 3 Feb 2009 09:42 Hi Bill, yes, thanks. This made me think of using RE.Selection.Range.StartPos It is just too bad there is no simple approach with MouseMove Jan "Bill McCarthy" <TPASoft.com Are Identity Thieves> schrieb im Newsbeitrag news:eMtHiCbhJHA.3716(a)TK2MSFTNGP06.phx.gbl... > Hi Jan, > > If you are using the mouse up, unless you intervene, the selection has > been set. In which case you really only need to call EM_LINEFROMCHAR > passing in -1 as the wParam. That will give you the line index of the > selection. > >
From: Jan Opitz on 3 Feb 2009 09:42
Yes, that's the problem. I am still experimenting, but so far the value returned from CHARFROMPOS is not usable. I changed Pt1.x = 1 to Pt1.x = x to get a bit closer, but still not much success. Jan > Doesn't EM_CHARFROMPOS do that, regardless of font size? > Maybe you should explain what you're trying to accomplish. |