News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Friendly name in Hyperlink Help

Started by guga, August 09, 2012, 02:38:46 AM

Previous topic - Next topic

guga

Hi guys

i´m having trouble making a friendly name hyperlink on a richeedit control.

I suceed to insert a object and links to it, but i got stuck when trying to make the links be friendly name.




I don´t know how to mask the "HYPERLINK" token to show the friendly name.

jj2007 you told me once how, but it couldnt do it....Can u help me on this ?

If others knows how to make, please let me know.

BestRegards,

guga
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

jj2007

Afaik there is no "built in" way of using hyperlinks this way, so for RichMasm I rolled my own. It's not straightforward but it works just fine.
Under the hood it looks suspiciously similar to the tags used by the forum software :biggrin:
You need to define delimiters and hide them, and when loading the file, find them and put the link style on what is between the two tags.
Below you see what happens if you "comment out" a line with a link in RichMasm: the hidden parts become visible.

guga

Hi JJ...tks..but i still don´t know how to define the delimiters.

From your code i see that you used EM_FINDTEXT, EM_SETEVENTMASK etc...

but....how you use them to mask the text and where did you inserted the main code? Inside WM_CREATE/WM_INITDIALOG or WM_COMMAND or WM_NOTIFY?

I also found some article on this..but i still don´t get how to enable it.

http://blogs.msdn.com/b/murrays/archive/2009/09/24/richedit-friendly-name-hyperlinks.aspx
http://blogs.msdn.com/b/murrays/archive/2009/09/01/automatic-richedit-hyperlinks.aspx
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

jj2007

You could go the official way, but note that even Win7 WordPad does not offer the option to insert a link. And Murray (Mr RichEdit in M$ - he is the author of that crappy control; note that \fldresult is plain wrong) writes...
QuoteA friendly name hyperlink is essentially a field with two parts: an instruction part containing the URL and a result part containing the name. In fact that's the way it appears in RTF, which has the syntax {\field{\*\fldinst {HYPERLINK "..."}}{\fldresult{...}}}.
... and Ms Word inserts this:
this is a }{\field{\*\fldinst {\rtlch\fcs1 \ab\af9\afs20 \ltrch\fcs0 \b\f9\fs20\cf18\lang2055\langfe1033\langnp2055\insrsid7172340 
HYPERLINK "http://blogs.msdn.com/b/murrays/archive/2009/09/24/richedit-friendly-name-hyperlinks.aspx" }{\rtlch\fcs1 \ab\af9\afs20 \ltrch\fcs0 \b\f9\fs20\cf18\lang2055\langfe1033\langnp2055\insrsid7172340\charrsid7172340 {\*\datafield
00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90bcc00000068007400740070003a002f002f0062006c006f00670073002e006d00730064006e002e0063006f006d002f0062002f006d007500720072006100790073002f0061007200630068006900760065002f003200
3000300039002f00300039002f00320034002f00720069006300680065006400690074002d0066007200690065006e0064006c0079002d006e0061006d0065002d00680079007000650072006c0069006e006b0073002e0061007300700078000000795881f43b1d7f48af2c825dc485276300000000a5ab0000}}
}{\fldrslt {\rtlch\fcs1 \ab\af9\afs20 \ltrch\fcs0 \cs15\b\f9\fs20\ul\cf2\lang2055\langfe1033\langnp2055\insrsid7172340\charrsid7172340 friendly link}}}\sectd \linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \ab\af9\afs20 \ltrch\fcs0
\b\f9\fs20\cf18\lang2055\langfe1033\langnp2055\insrsid7172340  inserted in MsWord}


Have fun... :biggrin:

P.S.: I add the short version. Open in Notepad or qEditor to see :biggrin:

guga

Hi JJ....i´ll give a try, but...also...i´ll test the official version first (although it is undocumented or incomplete documented)

Anyway, i converted the Tom interfaces IID and classes enumerations displacements if you or others wants to try this as a COM feature.
Btw, i´m readng Murray´s Blog, and it is quite a excelent matterial. Too bad the M$ official documentation is poor.

Here is some other good info about ITextServices
http://blogs.msdn.com/b/murrays/archive/2010/01/13/richedit-versions-1-0-through-3-0.aspx


[IID_LIBID_tom: D$ 08CC497C9,
                W$ 0A1DF, 011CE,
                B$ 080, 098, 0, 0AA, 0, 047, 0BE, 05D]

[IID_ITextDocument: D$ 08CC497C0,
                    W$ 0A1DF, 011CE,
                    B$ 080, 098, 0, 0AA, 0, 047, 0BE, 05D]

[IID_ITextRange: D$ 08CC497C2,
                    W$ 0A1DF, 011CE,
                    B$ 080, 098, 0, 0AA, 0, 047, 0BE, 05D]

[IID_ITextSelection: D$ 08CC497C1,
                     W$ 0A1DF, 011CE,
                     B$ 080, 098, 0, 0AA, 0, 047, 0BE, 05D]

[IID_ITextFont: D$ 08CC497C3,
                W$ 0A1DF, 011CE,
                B$ 080, 098, 0, 0AA, 0, 047, 0BE, 05D]

[IID_ITextPara: D$ 08CC497C4,
                W$ 0A1DF, 011CE,
                B$ 080, 098, 0, 0AA, 0, 047, 0BE, 05D]

[IID_ITextStoryRanges: D$ 08CC497C5,
                       W$ 0A1DF, 011CE,
                       B$ 080, 098, 0, 0AA, 0, 047, 0BE, 05D]

[IID_ITextDocument2: D$ 01C25500,
                     W$ 04268, 011D1,
                     B$ 088, 03A, 03C, 08B, 0, 0C1, 0, 0]

[IID_ITextMsgFilter: D$ 0A3787420,
                     W$ 04267, 011D1,
                     B$ 088, 03A, 03C, 08B, 0, 0C1, 0, 0]


; IDispatch Interface Displacement

[IDISPATCH_GETTYPEINFOCOUNT 12
IDISPATCH_GETTYPEINFO 16
IDISPATCH_GETIDSOFNAMES 20
IDISPATCH_INVOKE 24]


[ITEXTDOCUMENT_GETTYPEINFOCOUNT 12
ITEXTDOCUMENT_GETTYPEINFO 16
ITEXTDOCUMENT_GETIDSOFNAMES 20
ITEXTDOCUMENT_INVOKE 24
ITEXTDOCUMENT_GETNAME 28
ITEXTDOCUMENT_GETSELECTION 32
ITEXTDOCUMENT_GETSTORYCOUNT 36
ITEXTDOCUMENT_GETSTORYRANGES 40
ITEXTDOCUMENT_GETSAVED 44
ITEXTDOCUMENT_SETSAVED 48
ITEXTDOCUMENT_GETDEFAULTTABSTOP 52
ITEXTDOCUMENT_SETDEFAULTTABSTOP 56
ITEXTDOCUMENT_NEW 60
ITEXTDOCUMENT_OPEN 64
ITEXTDOCUMENT_SAVE 68
ITEXTDOCUMENT_FREEZE 72
ITEXTDOCUMENT_UNFREEZE 76
ITEXTDOCUMENT_BEGINEDITCOLLECTION 80
ITEXTDOCUMENT_ENDEDITCOLLECTION 84
ITEXTDOCUMENT_UNDO 88
ITEXTDOCUMENT_REDO 92
ITEXTDOCUMENT_RANGE 96
ITEXTDOCUMENT_RANGEFROMPOINT 100]

[ITEXTRANGE_GETTYPEINFOCOUNT 12
ITEXTRANGE_GETTYPEINFO 16
ITEXTRANGE_GETIDSOFNAMES 20
ITEXTRANGE_INVOKE 24
ITEXTRANGE_GETTEXT 28
ITEXTRANGE_SETTEXT 32
ITEXTRANGE_GETCHAR 36
ITEXTRANGE_SETCHAR 40
ITEXTRANGE_GETDUPLICATE 44
ITEXTRANGE_GETFORMATTEDTEXT 48
ITEXTRANGE_SETFORMATTEDTEXT 52
ITEXTRANGE_GETSTART 56
ITEXTRANGE_SETSTART 60
ITEXTRANGE_GETEND 64
ITEXTRANGE_SETEND 68
ITEXTRANGE_GETFONT 72
ITEXTRANGE_SETFONT 76
ITEXTRANGE_GETPARA 80
ITEXTRANGE_SETPARA 84
ITEXTRANGE_GETSTORYLENGTH 88
ITEXTRANGE_GETSTORYTYPE 92
ITEXTRANGE_COLLAPSE 96
ITEXTRANGE_EXPAND 100
ITEXTRANGE_GETINDEX 104
ITEXTRANGE_SETINDEX 108
ITEXTRANGE_SETRANGE 112
ITEXTRANGE_INRANGE 116
ITEXTRANGE_INSTORY 120
ITEXTRANGE_ISEQUAL 124
ITEXTRANGE_SELECT 128
ITEXTRANGE_STARTOF 132
ITEXTRANGE_ENDOF 136
ITEXTRANGE_MOVE 140
ITEXTRANGE_MOVESTART 144
ITEXTRANGE_MOVEEND 148
ITEXTRANGE_MOVEWHILE 152
ITEXTRANGE_MOVESTARTWHILE 156
ITEXTRANGE_MOVEENDWHILE 160
ITEXTRANGE_MOVEUNTIL 164
ITEXTRANGE_MOVESTARTUNTIL 168
ITEXTRANGE_MOVEENDUNTIL 172
ITEXTRANGE_FINDTEXT 176
ITEXTRANGE_FINDTEXTSTART 180
ITEXTRANGE_FINDTEXTEND 184
ITEXTRANGE_DELETE 188
ITEXTRANGE_CUT 192
ITEXTRANGE_COPY 196
ITEXTRANGE_PASTE 200
ITEXTRANGE_CANPASTE 204
ITEXTRANGE_CANEDIT 208
ITEXTRANGE_CHANGECASE 212
ITEXTRANGE_GETPOINT 216
ITEXTRANGE_SETPOINT 220
ITEXTRANGE_SCROLLINTOVIEW 224
ITEXTRANGE_GETEMBEDDEDOBJECT 228]

[ITEXTSELECTION_GETTYPEINFOCOUNT 12
ITEXTSELECTION_GETTYPEINFO 16
ITEXTSELECTION_GETIDSOFNAMES 20
ITEXTSELECTION_INVOKE 24
ITEXTSELECTION_GETTEXT 28
ITEXTSELECTION_SETTEXT 32
ITEXTSELECTION_GETCHAR 36
ITEXTSELECTION_SETCHAR 40
ITEXTSELECTION_GETDUPLICATE 44
ITEXTSELECTION_GETFORMATTEDTEXT 48
ITEXTSELECTION_SETFORMATTEDTEXT 52
ITEXTSELECTION_GETSTART 56
ITEXTSELECTION_SETSTART 60
ITEXTSELECTION_GETEND 64
ITEXTSELECTION_SETEND 68
ITEXTSELECTION_GETFONT 72
ITEXTSELECTION_SETFONT 76
ITEXTSELECTION_GETPARA 80
ITEXTSELECTION_SETPARA 84
ITEXTSELECTION_GETSTORYLENGTH 88
ITEXTSELECTION_GETSTORYTYPE 92
ITEXTSELECTION_COLLAPSE 96
ITEXTSELECTION_EXPAND 100
ITEXTSELECTION_GETINDEX 104
ITEXTSELECTION_SETINDEX 108
ITEXTSELECTION_SETRANGE 112
ITEXTSELECTION_INRANGE 116
ITEXTSELECTION_INSTORY 120
ITEXTSELECTION_ISEQUAL 124
ITEXTSELECTION_SELECT 128
ITEXTSELECTION_STARTOF 132
ITEXTSELECTION_ENDOF 136
ITEXTSELECTION_MOVE 140
ITEXTSELECTION_MOVESTART 144
ITEXTSELECTION_MOVEEND 148
ITEXTSELECTION_MOVEWHILE 152
ITEXTSELECTION_MOVESTARTWHILE 156
ITEXTSELECTION_MOVEENDWHILE 160
ITEXTSELECTION_MOVEUNTIL 164
ITEXTSELECTION_MOVESTARTUNTIL 168
ITEXTSELECTION_MOVEENDUNTIL 172
ITEXTSELECTION_FINDTEXT 176
ITEXTSELECTION_FINDTEXTSTART 180
ITEXTSELECTION_FINDTEXTEND 184
ITEXTSELECTION_DELETE 188
ITEXTSELECTION_CUT 192
ITEXTSELECTION_COPY 196
ITEXTSELECTION_PASTE 200
ITEXTSELECTION_CANPASTE 204
ITEXTSELECTION_CANEDIT 208
ITEXTSELECTION_CHANGECASE 212
ITEXTSELECTION_GETPOINT 216
ITEXTSELECTION_SETPOINT 220
ITEXTSELECTION_SCROLLINTOVIEW 224
ITEXTSELECTION_GETEMBEDDEDOBJECT 228
ITEXTSELECTION_GETFLAGS 232
ITEXTSELECTION_SETFLAGS 236
ITEXTSELECTION_GETTYPE 240
ITEXTSELECTION_MOVELEFT 244
ITEXTSELECTION_MOVERIGHT 248
ITEXTSELECTION_MOVEUP 252
ITEXTSELECTION_MOVEDOWN 256
ITEXTSELECTION_HOMEKEY 260
ITEXTSELECTION_ENDKEY 264
ITEXTSELECTION_TYPETEXT 268]

[ITEXTFONT_GETTYPEINFOCOUNT 12
ITEXTFONT_GETTYPEINFO 16
ITEXTFONT_GETIDSOFNAMES 20
ITEXTFONT_INVOKE 24
ITEXTFONT_GETDUPLICATE 28
ITEXTFONT_SETDUPLICATE 32
ITEXTFONT_CANCHANGE 36
ITEXTFONT_ISEQUAL 40
ITEXTFONT_RESET 44
ITEXTFONT_GETSTYLE 48
ITEXTFONT_SETSTYLE 52
ITEXTFONT_GETALLCAPS 56
ITEXTFONT_SETALLCAPS 60
ITEXTFONT_GETANIMATION 64
ITEXTFONT_SETANIMATION 68
ITEXTFONT_GETBACKCOLOR 72
ITEXTFONT_SETBACKCOLOR 76
ITEXTFONT_GETBOLD 80
ITEXTFONT_SETBOLD 84
ITEXTFONT_GETEMBOSS 88
ITEXTFONT_SETEMBOSS 92
ITEXTFONT_GETFORECOLOR 96
ITEXTFONT_SETFORECOLOR 100
ITEXTFONT_GETHIDDEN 104
ITEXTFONT_SETHIDDEN 108
ITEXTFONT_GETENGRAVE 112
ITEXTFONT_SETENGRAVE 116
ITEXTFONT_GETITALIC 120
ITEXTFONT_SETITALIC 124
ITEXTFONT_GETKERNING 128
ITEXTFONT_SETKERNING 132
ITEXTFONT_GETLANGUAGEID 136
ITEXTFONT_SETLANGUAGEID 140
ITEXTFONT_GETNAME 144
ITEXTFONT_SETNAME 148
ITEXTFONT_GETOUTLINE 152
ITEXTFONT_SETOUTLINE 156
ITEXTFONT_GETPOSITION 160
ITEXTFONT_SETPOSITION 164
ITEXTFONT_GETPROTECTED 168
ITEXTFONT_SETPROTECTED 172
ITEXTFONT_GETSHADOW 176
ITEXTFONT_SETSHADOW 180
ITEXTFONT_GETSIZE 184
ITEXTFONT_SETSIZE 188
ITEXTFONT_GETSMALLCAPS 192
ITEXTFONT_SETSMALLCAPS 196
ITEXTFONT_GETSPACING 200
ITEXTFONT_SETSPACING 204
ITEXTFONT_GETSTRIKETHROUGH 208
ITEXTFONT_SETSTRIKETHROUGH 212
ITEXTFONT_GETSUBSCRIPT 216
ITEXTFONT_SETSUBSCRIPT 220
ITEXTFONT_GETSUPERSCRIPT 224
ITEXTFONT_SETSUPERSCRIPT 228
ITEXTFONT_GETUNDERLINE 232
ITEXTFONT_SETUNDERLINE 236
ITEXTFONT_GETWEIGHT 240
ITEXTFONT_SETWEIGHT 244]

[ITEXTPARA_GETTYPEINFOCOUNT 12
ITEXTPARA_GETTYPEINFO 16
ITEXTPARA_GETIDSOFNAMES 20
ITEXTPARA_INVOKE 24
ITEXTPARA_GETDUPLICATE 28
ITEXTPARA_SETDUPLICATE 32
ITEXTPARA_CANCHANGE 36
ITEXTPARA_ISEQUAL 40
ITEXTPARA_RESET 44
ITEXTPARA_GETSTYLE 48
ITEXTPARA_SETSTYLE 52
ITEXTPARA_GETALIGNMENT 56
ITEXTPARA_SETALIGNMENT 60
ITEXTPARA_GETHYPHENATION 64
ITEXTPARA_SETHYPHENATION 68
ITEXTPARA_GETFIRSTLINEINDENT 72
ITEXTPARA_GETKEEPTOGETHER 76
ITEXTPARA_SETKEEPTOGETHER 80
ITEXTPARA_GETKEEPWITHNEXT 84
ITEXTPARA_SETKEEPWITHNEXT 88
ITEXTPARA_GETLEFTINDENT 92
ITEXTPARA_GETLINESPACING 96
ITEXTPARA_GETLINESPACINGRULE 100
ITEXTPARA_GETLISTALIGNMENT 104
ITEXTPARA_SETLISTALIGNMENT 108
ITEXTPARA_GETLISTLEVELINDEX 112
ITEXTPARA_SETLISTLEVELINDEX 116
ITEXTPARA_GETLISTSTART 120
ITEXTPARA_SETLISTSTART 124
ITEXTPARA_GETLISTTAB 128
ITEXTPARA_SETLISTTAB 132
ITEXTPARA_GETLISTTYPE 136
ITEXTPARA_SETLISTTYPE 140
ITEXTPARA_GETNOLINENUMBER 144
ITEXTPARA_SETNOLINENUMBER 148
ITEXTPARA_GETPAGEBREAKBEFORE 152
ITEXTPARA_SETPAGEBREAKBEFORE 156
ITEXTPARA_GETRIGHTINDENT 160
ITEXTPARA_SETRIGHTINDENT 164
ITEXTPARA_SETINDENTS 168
ITEXTPARA_SETLINESPACING 172
ITEXTPARA_GETSPACEAFTER 176
ITEXTPARA_SETSPACEAFTER 180
ITEXTPARA_GETSPACEBEFORE 184
ITEXTPARA_SETSPACEBEFORE 188
ITEXTPARA_GETWIDOWCONTROL 192
ITEXTPARA_SETWIDOWCONTROL 196
ITEXTPARA_GETTABCOUNT 200
ITEXTPARA_ADDTAB 204
ITEXTPARA_CLEARALLTABS 208
ITEXTPARA_DELETETAB 212
ITEXTPARA_GETTAB 216]

[ITEXTSTORYRANGES_GETTYPEINFOCOUNT 12
ITEXTSTORYRANGES_GETTYPEINFO 16
ITEXTSTORYRANGES_GETIDSOFNAMES 20
ITEXTSTORYRANGES_INVOKE 24
ITEXTSTORYRANGES__NEWENUM 28
ITEXTSTORYRANGES_ITEM 32
ITEXTSTORYRANGES_GETCOUNT 36]

[ITEXTDOCUMENT2_GETTYPEINFOCOUNT 12
ITEXTDOCUMENT2_GETTYPEINFO 16
ITEXTDOCUMENT2_GETIDSOFNAMES 20
ITEXTDOCUMENT2_INVOKE 24
ITEXTDOCUMENT2_GETNAME 28
ITEXTDOCUMENT2_GETSELECTION 32
ITEXTDOCUMENT2_GETSTORYCOUNT 36
ITEXTDOCUMENT2_GETSTORYRANGES 40
ITEXTDOCUMENT2_GETSAVED 44
ITEXTDOCUMENT2_SETSAVED 48
ITEXTDOCUMENT2_GETDEFAULTTABSTOP 52
ITEXTDOCUMENT2_SETDEFAULTTABSTOP 56
ITEXTDOCUMENT2_NEW 60
ITEXTDOCUMENT2_OPEN 64
ITEXTDOCUMENT2_SAVE 68
ITEXTDOCUMENT2_FREEZE 72
ITEXTDOCUMENT2_UNFREEZE 76
ITEXTDOCUMENT2_BEGINEDITCOLLECTION 80
ITEXTDOCUMENT2_ENDEDITCOLLECTION 84
ITEXTDOCUMENT2_UNDO 88
ITEXTDOCUMENT2_REDO 92
ITEXTDOCUMENT2_RANGE 96
ITEXTDOCUMENT2_RANGEFROMPOINT 100
ITEXTDOCUMENT2_ATTACHMSGFILTER 104
ITEXTDOCUMENT2_SETEFFECTCOLOR 108
ITEXTDOCUMENT2_GETEFFECTCOLOR 112
ITEXTDOCUMENT2_GETCARETTYPE 116
ITEXTDOCUMENT2_SETCARETTYPE 120
ITEXTDOCUMENT2_GETIMMCONTEXT 124
ITEXTDOCUMENT2_RELEASEIMMCONTEXT 128
ITEXTDOCUMENT2_GETPREFERREDFONT 132
ITEXTDOCUMENT2_GETNOTIFICATIONMODE 136
ITEXTDOCUMENT2_SETNOTIFICATIONMODE 140
ITEXTDOCUMENT2_GETCLIENTRECT 144
ITEXTDOCUMENT2_GETSELECTIONEX 148
ITEXTDOCUMENT2_GETWINDOW 152
ITEXTDOCUMENT2_GETFEFLAGS 156
ITEXTDOCUMENT2_UPDATEWINDOW 160
ITEXTDOCUMENT2_CHECKTEXTLIMIT 164
ITEXTDOCUMENT2_IMEINPROGRESS 168
ITEXTDOCUMENT2_SYSBEEP 172
ITEXTDOCUMENT2_UPDATE 176
ITEXTDOCUMENT2_NOTIFY 180]

[ITEXTMSGFILTER_ATTACHDOCUMENT 12
ITEXTMSGFILTER_HANDLEMESSAGE 16
ITEXTMSGFILTER_ATTACHMSGFILTER 20]
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

And these are for ITextServices


[IID_ITextServices: D$ 08D33F740,
                    W$ 0CF58, 011CE,
                    B$ 0A8, 09D, 0, 0AA, 0, 06C, 0AD, 0C5]

[IID_ITextHost: D$ 013E670F4,
                W$ 01A5A, 011CF,
                B$ 0AB, 0EB, 0, 0AA, 0, 0B6, 05E, 0A1]

[ITEXTSERVICES_TXSENDMESSAGE 12
ITEXTSERVICES_TXDRAW 16
ITEXTSERVICES_TXGETHSCROLL 20
ITEXTSERVICES_TXGETVSCROLL 24
ITEXTSERVICES_ONTXSETCURSOR 28
ITEXTSERVICES_TXQUERYHITPOINT 32
ITEXTSERVICES_ONTXINPLACEACTIVATE 36
ITEXTSERVICES_ONTXINPLACEDEACTIVATE 40
ITEXTSERVICES_ONTXUIACTIVATE 44
ITEXTSERVICES_ONTXUIDEACTIVATE 48
ITEXTSERVICES_TXGETTEXT 52
ITEXTSERVICES_TXSETTEXT 56
ITEXTSERVICES_TXGETCURTARGETX 60
ITEXTSERVICES_TXGETBASELINEPOS 64
ITEXTSERVICES_TXGETNATURALSIZE 68
ITEXTSERVICES_TXGETDROPTARGET 72
ITEXTSERVICES_ONTXPROPERTYBITSCHANGE 76
ITEXTSERVICES_TXGETCACHEDSIZE 80]

[ITEXTHOST_TXGETDC 12
ITEXTHOST_TXRELEASEDC 16
ITEXTHOST_TXSHOWSCROLLBAR 20
ITEXTHOST_TXENABLESCROLLBAR 24
ITEXTHOST_TXSETSCROLLRANGE 28
ITEXTHOST_TXSETSCROLLPOS 32
ITEXTHOST_TXINVALIDATERECT 36
ITEXTHOST_TXVIEWCHANGE 40
ITEXTHOST_TXCREATECARET 44
ITEXTHOST_TXSHOWCARET 48
ITEXTHOST_TXSETCARETPOS 52
ITEXTHOST_TXSETTIMER 56
ITEXTHOST_TXKILLTIMER 60
ITEXTHOST_TXSCROLLWINDOWEX 64
ITEXTHOST_TXSETCAPTURE 68
ITEXTHOST_TXSETFOCUS 72
ITEXTHOST_TXSETCURSOR 76
ITEXTHOST_TXSCREENTOCLIENT 80
ITEXTHOST_TXCLIENTTOSCREEN 84
ITEXTHOST_TXACTIVATE 88
ITEXTHOST_TXDEACTIVATE 92
ITEXTHOST_TXGETCLIENTRECT 96
ITEXTHOST_TXGETVIEWINSET 100
ITEXTHOST_TXGETCHARFORMAT 104
ITEXTHOST_TXGETPARAFORMAT 108
ITEXTHOST_TXGETSYSCOLOR 112
ITEXTHOST_TXGETBACKSTYLE 116
ITEXTHOST_TXGETMAXLENGTH 120
ITEXTHOST_TXGETSCROLLBARS 124
ITEXTHOST_TXGETPASSWORDCHAR 128
ITEXTHOST_TXGETACCELERATORPOS 132
ITEXTHOST_TXGETEXTENT 136
ITEXTHOST_ONTXCHARFORMATCHANGE 140
ITEXTHOST_ONTXPARAFORMATCHANGE 144
ITEXTHOST_TXGETPROPERTYBITS 148
ITEXTHOST_TXNOTIFY 152
ITEXTHOST_TXIMMGETCONTEXT 156
ITEXTHOST_TXIMMRELEASECONTEXT 160
ITEXTHOST_TXGETSELECTIONBARWIDTH 164]



More interesting richedit resources (Ex: EM_SETEDITSTYLE message)
http://technet.microsoft.com/en-us/subscriptions/bb788031%28v=vs.85%29.aspx
http://technet.microsoft.com/en-us/subscriptions/bb774236%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/bb787613%28v=vs.85%29.aspx
http://www.codeproject.com/Articles/15906/Using-Windowless-RichEdit-Controls
http://blogs.msdn.com/b/murrays/archive/2007/10/28/using-richedit-6-0-for-math.aspx
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

jj2007

Quote from: guga on August 10, 2012, 01:01:30 PM
Btw, i´m readng Murray´s Blog, and it is quite a excelent matterial. Too bad the M$ official documentation is poor.

Wait until you get bitten by his control :bgrin:

For example, friendly links work just fine, it's a bit complicated at first but a few lines are sufficient to insert a link, or to open one. Provided you have the right RichEdit version. The one that comes with Office11/12 works great, but not all users have installed Office, and if a user once opens and saves the doc with the original RichEd20.dll that comes with XP and Win7, all your friendly links become gibberish - and no, you can't read them any more when reopened with the Office11 dll.

By the way, they all claim to be the same dll - RichEd20 aka RichEdit 3.0.
You can use RichEdit 4.1 instead, but it means an entirely different set of bugs, pardon: features.

dedndave

couldn't you subclass the control and make your own friendly link ?

jj2007

Subclassing is not needed, there is the EN_LINK notification, but "roll your own" is indeed what works under the hood e.g. in RichMasm. The nuisance is that in order to identify your links, you must search for them - and that is relatively slow in a RichEdit control. If you have a dozen links in a 10,000 lines file, you start feeling it.

It's a shame that Microsoft still ships a totally outdated version of RichEd20.dll with XP & Win7. The Office versions are fine, the best one sits e.g. in C:\Program Files\Common Files\microsoft shared\OFFICE11\RICHED20.DLL under Win7-32.

guga

Ok, i found something that may lead to the proper official way.

The code is in .NET and need to be converted to RosAsm/Masm or even C syntax.
The article is from http://www.codeproject.com/Articles/9196/Links-with-arbitrary-text-in-a-RichTextBox

How to convert this stuff to assembly ?


using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace RichTextBoxLinks
{
public class RichTextBoxEx : RichTextBox, RichTextBoxLinks.IRichTextBoxEx, RichTextBoxLinks.IRichTextBoxEx1
{
#region Interop-Defines
[ StructLayout( LayoutKind.Sequential )]
private struct CHARFORMAT2_STRUCT
{
public UInt32 cbSize;
public UInt32   dwMask;
public UInt32   dwEffects;
public Int32    yHeight;
public Int32    yOffset;
public Int32 crTextColor;
public byte     bCharSet;
public byte     bPitchAndFamily;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)]
public char[]   szFaceName;
public UInt16 wWeight;
public UInt16 sSpacing;
public int crBackColor; // Color.ToArgb() -> int
public int lcid;
public int dwReserved;
public Int16 sStyle;
public Int16 wKerning;
public byte bUnderlineType;
public byte bAnimation;
public byte bRevAuthor;
public byte bReserved1;
}

[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);

private const int WM_USER = 0x0400;
private const int EM_GETCHARFORMAT = WM_USER+58;
private const int EM_SETCHARFORMAT = WM_USER+68;

private const int SCF_SELECTION = 0x0001;
private const int SCF_WORD = 0x0002;
private const int SCF_ALL = 0x0004;

#region CHARFORMAT2 Flags
private const UInt32 CFE_BOLD = 0x0001;
private const UInt32 CFE_ITALIC = 0x0002;
private const UInt32 CFE_UNDERLINE = 0x0004;
private const UInt32 CFE_STRIKEOUT = 0x0008;
private const UInt32 CFE_PROTECTED = 0x0010;
private const UInt32 CFE_LINK = 0x0020;
private const UInt32 CFE_AUTOCOLOR = 0x40000000;
private const UInt32 CFE_SUBSCRIPT = 0x00010000; /* Superscript and subscript are */
private const UInt32 CFE_SUPERSCRIPT= 0x00020000; /*  mutually exclusive */

private const int CFM_SMALLCAPS = 0x0040; /* (*) */
private const int CFM_ALLCAPS = 0x0080; /* Displayed by 3.0 */
private const int CFM_HIDDEN = 0x0100; /* Hidden by 3.0 */
private const int CFM_OUTLINE = 0x0200; /* (*) */
private const int CFM_SHADOW = 0x0400; /* (*) */
private const int CFM_EMBOSS = 0x0800; /* (*) */
private const int CFM_IMPRINT = 0x1000; /* (*) */
private const int CFM_DISABLED = 0x2000;
private const int CFM_REVISED = 0x4000;

private const int CFM_BACKCOLOR = 0x04000000;
private const int CFM_LCID = 0x02000000;
private const int CFM_UNDERLINETYPE = 0x00800000; /* Many displayed by 3.0 */
private const int CFM_WEIGHT = 0x00400000;
private const int CFM_SPACING = 0x00200000; /* Displayed by 3.0 */
private const int CFM_KERNING = 0x00100000; /* (*) */
private const int CFM_STYLE = 0x00080000; /* (*) */
private const int CFM_ANIMATION = 0x00040000; /* (*) */
private const int CFM_REVAUTHOR = 0x00008000;


private const UInt32 CFM_BOLD = 0x00000001;
private const UInt32 CFM_ITALIC = 0x00000002;
private const UInt32 CFM_UNDERLINE = 0x00000004;
private const UInt32 CFM_STRIKEOUT = 0x00000008;
private const UInt32 CFM_PROTECTED = 0x00000010;
private const UInt32 CFM_LINK = 0x00000020;
private const UInt32 CFM_SIZE = 0x80000000;
private const UInt32 CFM_COLOR = 0x40000000;
private const UInt32 CFM_FACE = 0x20000000;
private const UInt32 CFM_OFFSET = 0x10000000;
private const UInt32 CFM_CHARSET = 0x08000000;
private const UInt32 CFM_SUBSCRIPT = CFE_SUBSCRIPT | CFE_SUPERSCRIPT;
private const UInt32 CFM_SUPERSCRIPT= CFM_SUBSCRIPT;

private const byte CFU_UNDERLINENONE = 0x00000000;
private const byte CFU_UNDERLINE = 0x00000001;
private const byte CFU_UNDERLINEWORD = 0x00000002; /* (*) displayed as ordinary underline */
private const byte CFU_UNDERLINEDOUBLE = 0x00000003; /* (*) displayed as ordinary underline */
private const byte CFU_UNDERLINEDOTTED = 0x00000004;
private const byte CFU_UNDERLINEDASH = 0x00000005;
private const byte CFU_UNDERLINEDASHDOT = 0x00000006;
private const byte CFU_UNDERLINEDASHDOTDOT = 0x00000007;
private const byte CFU_UNDERLINEWAVE = 0x00000008;
private const byte CFU_UNDERLINETHICK = 0x00000009;
private const byte CFU_UNDERLINEHAIRLINE = 0x0000000A; /* (*) displayed as ordinary underline */

#endregion

#endregion

public RichTextBoxEx()
{
// Otherwise, non-standard links get lost when user starts typing
// next to a non-standard link
this.DetectUrls = false;
}

[DefaultValue(false)]
public new bool DetectUrls
{
get { return base.DetectUrls; }
set { base.DetectUrls = value; }
}

/// <summary>
/// Insert a given text as a link into the RichTextBox at the current insert position.
/// </summary>
/// <param name="text">Text to be inserted</param>
public void InsertLink(string text)
{
InsertLink(text, this.SelectionStart);
}

/// <summary>
/// Insert a given text at a given position as a link.
/// </summary>
/// <param name="text">Text to be inserted</param>
/// <param name="position">Insert position</param>
public void InsertLink(string text, int position)
{
if (position < 0 || position > this.Text.Length)
throw new ArgumentOutOfRangeException("position");

this.SelectionStart = position;
this.SelectedText = text;
this.Select(position, text.Length);
this.SetSelectionLink(true);
this.Select(position + text.Length, 0);
}

/// <summary>
/// Insert a given text at at the current input position as a link.
/// The link text is followed by a hash (#) and the given hyperlink text, both of
/// them invisible.
/// When clicked on, the whole link text and hyperlink string are given in the
/// LinkClickedEventArgs.
/// </summary>
/// <param name="text">Text to be inserted</param>
/// <param name="hyperlink">Invisible hyperlink string to be inserted</param>
public void InsertLink(string text, string hyperlink)
{
InsertLink(text, hyperlink, this.SelectionStart);
}

/// <summary>
/// Insert a given text at a given position as a link. The link text is followed by
/// a hash (#) and the given hyperlink text, both of them invisible.
/// When clicked on, the whole link text and hyperlink string are given in the
/// LinkClickedEventArgs.
/// </summary>
/// <param name="text">Text to be inserted</param>
/// <param name="hyperlink">Invisible hyperlink string to be inserted</param>
/// <param name="position">Insert position</param>
public void InsertLink(string text, string hyperlink, int position)
{
if (position < 0 || position > this.Text.Length)
throw new ArgumentOutOfRangeException("position");

this.SelectionStart = position;
this.SelectedRtf = @"{\rtf1\ansi "+text+@"\v #"+hyperlink+@"\v0}";
this.Select(position, text.Length + hyperlink.Length + 1);
this.SetSelectionLink(true);
this.Select(position + text.Length + hyperlink.Length + 1, 0);
}

/// <summary>
/// Set the current selection's link style
/// </summary>
/// <param name="link">true: set link style, false: clear link style</param>
public void SetSelectionLink(bool link)
{
SetSelectionStyle(CFM_LINK, link ? CFE_LINK : 0);
}
/// <summary>
/// Get the link style for the current selection
/// </summary>
/// <returns>0: link style not set, 1: link style set, -1: mixed</returns>
public int GetSelectionLink()
{
return GetSelectionStyle(CFM_LINK, CFE_LINK);
}


private void SetSelectionStyle(UInt32 mask, UInt32 effect)
{
CHARFORMAT2_STRUCT cf = new CHARFORMAT2_STRUCT();
cf.cbSize = (UInt32)Marshal.SizeOf(cf);
cf.dwMask = mask;
cf.dwEffects = effect;

IntPtr wpar = new IntPtr(SCF_SELECTION);
IntPtr lpar = Marshal.AllocCoTaskMem( Marshal.SizeOf( cf ) );
Marshal.StructureToPtr(cf, lpar, false);

IntPtr res = SendMessage(Handle, EM_SETCHARFORMAT, wpar, lpar);

Marshal.FreeCoTaskMem(lpar);
}

private int GetSelectionStyle(UInt32 mask, UInt32 effect)
{
CHARFORMAT2_STRUCT cf = new CHARFORMAT2_STRUCT();
cf.cbSize = (UInt32)Marshal.SizeOf(cf);
cf.szFaceName = new char[32];

IntPtr wpar = new IntPtr(SCF_SELECTION);
IntPtr lpar = Marshal.AllocCoTaskMem( Marshal.SizeOf( cf ) );
Marshal.StructureToPtr(cf, lpar, false);

IntPtr res = SendMessage(Handle, EM_GETCHARFORMAT, wpar, lpar);

cf = (CHARFORMAT2_STRUCT)Marshal.PtrToStructure(lpar, typeof(CHARFORMAT2_STRUCT));

int state;
// dwMask holds the information which properties are consistent throughout the selection:
if ((cf.dwMask & mask) == mask)
{
if ((cf.dwEffects & effect) == effect)
state = 1;
else
state = 0;
}
else
{
state = -1;
}

Marshal.FreeCoTaskMem(lpar);
return state;
}
}
}


Unrolling the above i end up as:


using System;
namespace RichTextBoxLinks
{
    interface IRichTextBoxEx
    {
        bool DetectUrls { get; set; }
        int GetSelectionLink();
        void InsertLink(string text, string hyperlink, int position);
        void InsertLink(string text, string hyperlink);
        void InsertLink(string text, int position);
        void InsertLink(string text);
        void SetSelectionLink(bool link);
    }
}

(Don´t ask me how i made this stuff show like this, because i was just clicking here and there in VIsualStudio, since i´not at all used to .NET stuff
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

dedndave

Quote from: jj2007 on August 11, 2012, 12:59:19 AM
It's a shame that Microsoft still ships a totally outdated version of RichEd20.dll with XP & Win7. The Office versions are fine, the best one sits e.g. in C:\Program Files\Common Files\microsoft shared\OFFICE11\RICHED20.DLL under Win7-32.

what really sux about that is...
i might write some code and think it's good, until someone runs it without office - lol
and - had you not mentioned it, a person could pull their hair out trying to figure out why
i looked for a related hotfix, but had no luck
that doesn't mean there isn't one - there are a number of hotfixes for richedit
just that none of them seem to mention friendly hyperlinks

jj2007

Quote from: guga on August 11, 2012, 09:16:06 AM
Ok, i found something that may lead to the proper official way.

Well, not really:
      /// Insert a given text at a given position as a link. The link text is followed by
      /// a hash (#) and the given hyperlink text, both of them invisible.
      /// When clicked on, the whole link text and hyperlink string are given in the
      /// LinkClickedEventArgs.
      ...
      IntPtr res = SendMessage(Handle, EM_SETCHARFORMAT, wpar, lpar);

That is the unofficial way I am using in RichMasm, only that instead of a # sign I opted for the Forums (url=http...)friendly(/url) links, for good reasons. It works, but as mentioned above, the downside is you need to explicitly set the CFE_LINK style at prog start because our dearest friend from Redmond decided that this style is not to be set permanently :eusa_boohoo:

(by the way: why is that C .Not so hilariously complicated? ::) in assembler it's much simpler...)

guga

Finally :)

I did it...i had to use only Msftedit.dll with RichEdit50W class. :):):)

it seems that also it can handle tables properly :)

It seems to work only for  Windows XP SP1 or later but...at least it worked :).

I´ll try to refine the code because on my tests, i Kinda....mix it up a bit ;)

I suceeded after analysing this damn .NET file :)
http://www.codeproject.com/Articles/22783/Advanced-Text-Editor-with-Ruler

Btw:

I just found those other good info here:
http://www.codeproject.com/Articles/56921/A-Very-Simple-Way-to-Use-Richedit-5-0-in-VC6-and-o
http://www.codeproject.com/Articles/10995/An-example-editor-with-table-and-image-support
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

jj2007

Quote from: guga on August 11, 2012, 05:12:54 PM
I did it...i had to use only Msftedit.dll with RichEdit50W class. :):):)

Good luck. It expects Unicode everywhere, but that shouldn't be a problem.
3.0 from Office11/12 handles tables, too.

guga

Ok

friendly name is working



Now it only needs to grab the url string to be open. Probably needs a few changes in EN_LINK message.

I´m tired...will make further tests tomorrow:)
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com