The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on March 14, 2007, 05:21:43 PM

Title: Syntax highlighting a hyperlink
Post by: ragdog on March 14, 2007, 05:21:43 PM
hi people´s


I have one ask too Syntax highlighting a hyperlink in my editor and shellexucute this hyperlink!
can your post  an example?

as for example in nfo viewer

thanks in forward

regards
ragdog
Title: Re: Syntax highlighting a hyperlink
Post by: PBrennick on March 14, 2007, 05:34:35 PM
ragdog,
I am attaching the code I use for my AboutBox in my IDE. It has the procedures, variables and resources you need. The instructions are in MugShot.asm.

Paul


[attachment deleted by admin]
Title: Re: Syntax highlighting a hyperlink
Post by: ragdog on March 14, 2007, 05:44:14 PM
thanks paul

I mean like nfo diz more viewer I program a notpad-editor and look for this function

ragdog
Title: Re: Syntax highlighting a hyperlink
Post by: PBrennick on March 14, 2007, 08:29:47 PM
Yes,
I new what you wanted. The Hyperlink procedure is in there.

Paul
Title: Re: Syntax highlighting a hyperlink
Post by: ramguru on March 14, 2007, 08:40:46 PM
EM_AUTOURLDETECT  :wink
Title: Re: Syntax highlighting a hyperlink
Post by: ragdog on March 15, 2007, 07:07:20 PM
thanks
Title: Re: Syntax highlighting a hyperlink
Post by: ragdog on March 15, 2007, 07:41:56 PM
i have found a goasm example
can your help to translate in masm32

.WMNOTIFY
   cmp      eax, WM_NOTIFY
   jne      >.WMCLOSE
   mov      edx, [lParam]
   cmp      D[edx+NMHDR.code], EN_LINK
   jne      >
   cmp      D[edx+ENLINK.msg], WM_LBUTTONUP
   jne      >
   push   [edx+ENLINK.chrg.cpMin]
   pop      [txtrg.chrg.cpMin]
   push   [edx+ENLINK.chrg.cpMax]
   pop      [txtrg.chrg.cpMax]
   push   offset szTextBuff
   pop      [txtrg.lpstrText]
   invoke   SendMessage, [hWndRichEdit], EM_GETTEXTRANGE, 0, addr txtrg

thanks in forward

ragdog
Title: Re: Syntax highlighting a hyperlink
Post by: PBrennick on March 15, 2007, 07:58:09 PM
ragdog,
I will translate it for you when you give me enough to translate.

The colon(s) for the jumps are missing so I need to know if there was a colin right after the last line. If not, then there are more lines missing. Please zip up the entire procedure, if you do not mind. If that was all there was, I will translate it with the assumption that the colon goes after the last line.

Also, was there any code after EDX got the structure pointer? and where is THAT line.

Paul
Title: Re: Syntax highlighting a hyperlink
Post by: ragdog on March 15, 2007, 08:12:53 PM
here is the goasm complete souce

thanks in forward
Title: Re: Syntax highlighting a hyperlink
Post by: ramguru on March 15, 2007, 09:17:19 PM

ENLINK STRUCT
    nmhdr  NMHDR <>
    msg    dd ?
    wParam dd ?
    lParam dd ?
    chrg   CHARRANGE <>
ENLINK ENDS

.data
lib db "RichEd20.dll",0
link db "This is the link http://www.softpedia.com",13,10,"This is not ..",0
Open db "Open",0

.code

start:

invoke GetModuleHandle,NULL
mov    hInstance, eax
invoke LoadLibrary, ADDR lib
    invoke InitCommonControls
invoke DialogBoxParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
invoke ExitProcess,0


DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL buf[256]:BYTE
LOCAL tr:TEXTRANGE

mov eax,uMsg
.if eax==WM_INITDIALOG
;1001 is richedit ID
invoke SendDlgItemMessage, hWin, 1001, EM_AUTOURLDETECT, 1, 0
invoke SendDlgItemMessage, hWin, 1001, EM_SETEVENTMASK, 0, ENM_LINK
invoke SendDlgItemMessage, hWin, 1001, WM_SETTEXT, 0, ADDR link
.elseif eax==WM_NOTIFY
mov    eax, lParam
mov    ecx, NMHDR.code[eax]
cmp    ecx, 70Bh;EN_LINK
jnz    @F
cmp    ENLINK.msg[eax], WM_LBUTTONUP
jnz    @F
mov    ecx, ENLINK.chrg.cpMin[eax]
mov    tr.chrg.cpMin, ecx
mov    ecx, ENLINK.chrg.cpMax[eax]
mov    tr.chrg.cpMax, ecx
lea    ecx, buf
mov    tr.lpstrText, ecx
invoke SendDlgItemMessage, hWin, 1001, EM_GETTEXTRANGE, 0, ADDR tr
invoke ShellExecute, hWin, ADDR Open, ADDR buf, 0, 0, SW_SHOWNORMAL
@@:

Title: Re: Syntax highlighting a hyperlink
Post by: ragdog on March 15, 2007, 09:26:43 PM
thx :U

it´s very good  :bg


regards

ragdog
Title: Re: Syntax highlighting a hyperlink
Post by: ragdog on March 23, 2007, 12:49:02 PM
hi

i have a next problem

I can how a email as hyperlink without mailto: before it

as example: mailto:xxx@xx.com
I would like to have this gladly in such a way xxx@xx.com this with hyperlink function

thanks in forward

ragdog
Title: Re: Syntax highlighting a hyperlink
Post by: PBrennick on March 23, 2007, 01:47:12 PM
ragdog,
1. Create a string called mail.
2. It needs to contain "mailto:",  250 dup(0) ; or how long the email address actually is plus one more zero
3. In the area where you are responding to the message to invoke the email program add the following line:
    invoke  lstrcat, addr mail, addr email  ; replace email with the name of your string containing the email address.

That's it,
Paul
Title: Re: Syntax highlighting a hyperlink
Post by: ragdog on March 23, 2007, 01:55:44 PM
thanks

i use richedit and EM_AUTOURLDETECT

if I possibly load text file into my editor and am email there in it
would like I her also a hyperlink function get without mailto: