Hello
I wish send a mail when I clic on a word which is in a text
how to make it?
Once I used this:
HyperLinkWndProc PROC uses ebx, hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
LOCAL tmpFont :LOGFONT
LOCAL rect:RECT
LOCAL pt:POINT
LOCAL ps:PAINTSTRUCT
mov eax,uMsg
.IF eax==WM_NCHITTEST
mov eax, 1 ;We want to handle the non client hit test so we return true or 1
ret
.....
.ELSEIF eax==WM_LBUTTONDOWN ;le click du boutton est traité ici
szText szHomepage, "mailto:dr.fl.menciere@orange.fr ?body=Numéro "
szText Subject,"edit:pour voir"
szText Blancp," : "
invoke lstrcpy,ADDR buffer,ADDR szHomepage
;invoke lstrcat,ADDR buffer,ADDR Subject
invoke lstrcat,ADDR buffer,ADDR App
invoke lstrcat,ADDR buffer,ADDR Blancp
invoke lstrcat,ADDR buffer,ADDR Nom
;invoke MessageBox, hDlg, ADDR buffer, ADDR App, MB_OK
invoke ShellExecute,0,0,ADDR buffer,0,0,0
;PrintString buffer
invoke ShellExecute, NULL, NULL, offset buffer, NULL, NULL, SW_MAXIMIZE ;change this to represent your preset url
xor eax,eax
ret
.ENDIF
invoke CallWindowProc, orgStatic, hWnd, uMsg, wParam, lParam
ret
HyperLinkWndProc endp
can you help me?
thanks
Hi
It gives many examples about it
DlgProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.if uMsg==WM_INITDIALOG
invoke LoadCursor,NULL,IDC_ARROW
mov hFinger,eax
invoke GetDlgItem, hWnd,1001
push eax
invoke SetWindowLong, eax, GWL_WNDPROC, addr HyperLinkWndProc
pop edx
invoke SetWindowLong, edx, GWL_USERDATA, eax
xor eax,eax
ret
.elseif uMsg == WM_CTLCOLORSTATIC
invoke SendMessage,lParam,uMsg,wParam,lParam
.data?
spoo dd ?
hFinger dd ?
.code
HyperLinkWndProc PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
LOCAL tmpFont :LOGFONT
.IF uMsg==WM_CTLCOLORSTATIC
invoke SendMessage, hWnd, WM_GETFONT, 0, 0
mov spoo,eax
invoke GetObject, spoo, sizeof LOGFONT, addr tmpFont ;
mov tmpFont.lfUnderline, TRUE ;under line the link
invoke CreateFontIndirect, addr tmpFont
invoke SelectObject, wParam, eax
invoke SetTextColor, wParam, Red ;change this to change the color of the link
invoke GetSysColor, COLOR_MENU
invoke SetBkColor, wParam, eax
invoke GetStockObject, HOLLOW_BRUSH
ret
.ELSEIF uMsg==WM_NCHITTEST
mov eax, 1
ret
.ELSEIF uMsg==WM_LBUTTONDOWN
invoke ShellExecute, NULL, CTEXT ("open"), CTEXT ("mailto:YOURMAIL@gmx.com"), NULL, NULL, SW_SHOWNORMAL ;change this to represent your preset url
xor eax,eax
ret
.ELSEIF uMsg==WM_SETCURSOR
invoke SetCursor,hFinger
xor eax,eax
ret
.ENDIF
invoke GetWindowLong, hWnd, GWL_USERDATA
invoke CallWindowProc, eax, hWnd, uMsg, wParam, lParam
ret
xor eax, eax
ret
HyperLinkWndProc endp
Add in your resource a text with your email adress with ID 1001
This function Change this text color and make this as hyperlink for open the defualt windows email client.
thanks
Hi ragdog
I try your code but adapted to my program;
the function fails, the return value is an error value that is equal to 31.
this is my code:
HyperLinkWndProc PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
LOCAL tmpFont :LOGFONT
LOCAL rect:RECT
LOCAL pt:POINT
LOCAL ps:PAINTSTRUCT
mov eax,uMsg
.IF eax==WM_NCHITTEST
mov eax, 1 ;We want to handle the non client hit test so we return true or 1
ret
.ELSEIF eax == WM_CTLCOLORSTATIC
invoke SendMessage, hWnd, WM_GETFONT, 0, 0
mov edx,eax
invoke GetObject, edx, sizeof LOGFONT, addr tmpFont
mov tmpFont.lfUnderline, TRUE ;souligne le lien
invoke CreateFontIndirect, addr tmpFont
; mov ebx,eax
invoke SelectObject, wParam, eax
.if hover == FALSE
invoke SetTextColor, wParam, Blue; change la couleur du lien;'Blue' est contenu dans window.inc
.else
invoke SetTextColor, wParam,Yellow ;Red
.endif
invoke GetSysColor, COLOR_MENU
invoke SetBkColor, wParam, eax
invoke DeleteObject,ebx
invoke GetStockObject, HOLLOW_BRUSH
ret
.ELSEIF eax==WM_MOUSEMOVE
invoke GetParent,hWnd
push ebx
mov ebx,eax
invoke GetActiveWindow
.if eax == ebx
invoke GetCursorPos,addr pt
invoke GetWindowRect,hWnd,addr rect
invoke PtInRect,addr rect,pt.x,pt.y
.if eax
invoke GetCapture
.if !eax
invoke SetCapture,hWnd
mov hover,TRUE
invoke InvalidateRect,hWnd,FALSE,FALSE
invoke SetCursor,hFinger
.endif
.else
invoke GetCapture
.if eax
invoke ReleaseCapture
mov hover,FALSE
invoke InvalidateRect,hWnd,FALSE,FALSE
.endif
.endif
.endif
pop ebx
xor eax,eax
ret
.ELSEIF eax==WM_LBUTTONDOWN ;le click du boutton est traité ici au lieu de plus haut
szText szHomepage, "mailto:dr.fl.menciere@orange.fr ?body=Numéro de série de "
szText Subject,"edit:Enregistrement"
szText Blancp," : "
szText ouvert,"open"; 19/6/2010
invoke lstrcpy,ADDR buffer,ADDR szHomepage ;buffer:"mailto:dr.fl.menciere@orange.fr ?body=Numéro de série de "
; ;invoke lstrcat,ADDR buffer,ADDR Subject
; invoke lstrcat,ADDR buffer,ADDR AppName
; ;invoke lstrcat,ADDR buffer,ADDR CrLf
; invoke lstrcat,ADDR buffer,ADDR Blancp
; invoke lstrcat,ADDR buffer,ADDR UserName
invoke MessageBox, hWnd, ADDR buffer, ADDR AppName, MB_OK ;!!! 18/6/2010
invoke ShellExecute,NULL,ADDR ouvert,ADDR buffer,0,0, SW_SHOWNORMAL;SW_MAXIMIZE ;
PrintString buffer
PrintHex eax
PrintDec eax
;invoke GetWindowText,hWnd,offset buffer,sizeof buffer ;change this for using a preset url
;PrintString buffer
; invoke ShellExecute, NULL, offset szOpen, offset buffer, NULL, NULL, SW_MAXIMIZE ;change this to represent your preset url
;invoke ShellExecute, NULL, NULL, offset buffer, NULL, NULL, SW_MAXIMIZE ;change this to represent your preset url
mov hover,FALSE
invoke InvalidateRect,hWnd,FALSE,FALSE
invoke SendMessage, hWnd, WM_GETFONT, 0, 0 ;Get the defualt system font
mov edx,eax ;store result
invoke GetObject, edx, sizeof LOGFONT, addr tmpFont ;get our font into a logfont structure
mov tmpFont.lfUnderline, TRUE ;under line the link
invoke CreateFontIndirect, addr tmpFont ;Create the new font
mov ebx,eax ;We need the return to free the memory later
invoke SelectObject, wParam, ebx ;Select our control
invoke SetTextColor, wParam, Blue ;change this to change the color of the link
xor eax,eax
ret
.ENDIF
;
invoke CallWindowProc, orgStatic, hWnd, uMsg, wParam, lParam
ret
HyperLinkWndProc endp
Hey
What is your goal?
This example hyperlink a text in a editbox and change this color
Click you this Hyperlink open the windows default mail client
I understand not correct what you try?
My goal is to send a mail to somebody (ex: "francois@wanadoo.fr") with a subject(ex: "enregistrement") and a body (ex: "numero xxxx" ) when I click on a hyperlink which is in a dialogbox like an AboutDialog
Here is my proceeding:
;£££££££££££££££
OpenDialog proc
;££££££££££££££
invoke DialogBoxParam, hInstance, ADDR DlgEnregistrement,hMainWnd,ADDR EnrProc,NULL
ret
OpenDialog endp
;£££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££
; Handle the Enr Dialog Message
;£££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££
EnrProc proc stdcall , hDlg:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
;IDC_URL equ 4003
mov eax, uMsg
.IF (eax == WM_INITDIALOG)
invoke GetDlgItem, hDlg,IDC_Nom; met le focus sur le nom
invoke SetFocus,eax
;--------------------------------
invoke GetDlgItem, hDlg, IDC_URL ;=> boutton traité ds HyperLinkWndProc = 4003
invoke SetWindowLong, eax, GWL_WNDPROC, ADDR HyperLinkWndProc
mov orgStatic,eax
invoke LoadCursor,hInstance,ID_DOIGTCURSOR
mov hFinger,eax
xor eax,eax
ret
.ELSEIF eax == WM_CTLCOLORSTATIC
invoke SendMessage,lParam,uMsg,wParam,lParam
ret
;----------------------------------
.ELSEIF (eax == WM_COMMAND)
mov eax,wParam
.IF ax==IDOK;ID_OK;
.......
.ENDIF
......
.ELSE
mov eax, FALSE ; show message not processed
jmp Return
.ENDIF
mov eax, TRUE ; show message was processed
Return: ret
EnrProc ENDP
;£££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££££
HyperLinkWndProc PROC uses ebx esi edi, hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LOCAL tmpFont :LOGFONT
LOCAL rect:RECT
LOCAL pt:POINT
LOCAL ps:PAINTSTRUCT
mov eax,uMsg
.IF eax==WM_NCHITTEST
mov eax, 1 ;We want to handle the non client hit test so we return true or 1
ret
.ELSEIF eax == WM_CTLCOLORSTATIC
invoke SendMessage, hWnd, WM_GETFONT, 0, 0
mov edx,eax
invoke GetObject, edx, sizeof LOGFONT, addr tmpFont
mov tmpFont.lfUnderline, TRUE ;souligne le lien
invoke CreateFontIndirect, addr tmpFont
invoke SelectObject, wParam, eax
.if hover == FALSE
invoke SetTextColor, wParam, Blue
.else
invoke SetTextColor, wParam,Red
.endif
invoke GetSysColor, COLOR_MENU
invoke SetBkColor, wParam, eax
invoke DeleteObject,ebx
invoke GetStockObject, HOLLOW_BRUSH
ret 0
.ELSEIF eax==WM_MOUSEMOVE
invoke GetParent,hWnd
push ebx
mov ebx,eax
invoke GetActiveWindow
.if eax == ebx
invoke GetCursorPos,addr pt
invoke GetWindowRect,hWnd,addr rect
invoke PtInRect,addr rect,pt.x,pt.y
.if eax
invoke GetCapture
.if !eax
invoke SetCapture,hWnd
mov hover,TRUE
invoke InvalidateRect,hWnd,FALSE,FALSE
invoke SetCursor,hFinger
.endif
.else
invoke GetCapture
.if eax
invoke ReleaseCapture
mov hover,FALSE
invoke InvalidateRect,hWnd,FALSE,FALSE
.endif
.endif
.endif
pop ebx
; xor eax,eax
ret 0
.ELSEIF eax==WM_LBUTTONDOWN
szText szHomepage, "mailto:francois@wanadoo.fr?body=Numéro "
szText Subject,"edit:Enregistrement"
szText Blancp," : "
szText ouvert,"open"; 19/6/2010
invoke lstrcpy,ADDR buffer,ADDR szHomepage
invoke lstrcat,ADDR buffer,ADDR Subject
invoke ShellExecute,NULL,ADDR ouvert,ADDR buffer,0,0, SW_SHOWNORMAL
PrintString buffer<<<<<<<<<<<It's OK
PrintDec eax<<<<<<<<<<<<<<<<< = 31 ??????
mov hover,FALSE
invoke InvalidateRect,hWnd,FALSE,FALSE
invoke SendMessage, hWnd, WM_GETFONT, 0, 0 ;Get the defualt system font
mov edx,eax ;store result
invoke GetObject, edx, sizeof LOGFONT, addr tmpFont ;get our font into a logfont structure
mov tmpFont.lfUnderline, TRUE ;under line the link
invoke CreateFontIndirect, addr tmpFont ;Create the new font
mov ebx,eax ;We need the return to free the memory later
invoke SelectObject, wParam, ebx ;Select our control
invoke SetTextColor, wParam, Blue ;change this to change the color of the link
xor eax,eax
ret
.ENDIF
invoke CallWindowProc, orgStatic, hWnd, uMsg, wParam, lParam
ret
HyperLinkWndProc endp
Hi
Ok I think it gives masm32 examples here on board
i have only a goasm example you can convert it to masm32 ,this is very easy
cmp eax,HLINK_EMAIL
jne >>B2
invoke GetWindowLong,[hlc_hWin],36
mov ebx,eax
invoke lstrlen,ebx
jnz >
xor ebx,ebx
:
invoke lstrcpy,[hlc_pSubject],OFFSET hlc_szMailTo
mov eax,[hlc_pSubject]
add eax,7
or ebx,ebx
jz >
invoke lstrcpy,eax,ebx
jmp >B0
:
invoke GetWindowText,[hlc_hWin],eax,240
B0:
invoke GetWindowLong,[hlc_hWin],24
or eax,eax
jz >>B2
push eax
invoke lstrcat,[hlc_pSubject],OFFSET hlc_szSubject
pop eax
mov D[hlc_strlen],2048
invoke lstrcat,[hlc_pSubject],eax
invoke GetWindowLong,[hlc_hWin],28
or eax,eax
jz >B2
push eax
invoke lstrcat,[hlc_pSubject],OFFSET hlc_szBody
pop eax
invoke lstrcat,[hlc_pSubject],eax
B2:
invoke FormatURL,[hlc_pSubject],OFFSET hlc_text,TRUE
invoke ShellExecute, [hlc_hWin], OFFSET hlc_szOpen,OFFSET hlc_text, 0, 0, SW_SHOWNORMAL
jmp >>.DONE
http://www.quickersoft.com/donkey/files/Hyperlink.zip
Personally I'd just use SMTP, and there is always MAPI.
I agree with clive, just use SMTP... Google RFC 2821
Hey, why do I get the impression that you are trying hard to make franlou's life difficult...?
:bg
What is this for a file type asc?
jj, doesn't work here.... I don't have a default mail app installed.. if the OP uses SMTP or MAPI that wouldn't matter :wink
Quote from: ragdog on June 20, 2010, 06:13:30 PM
What is this for a file type asc?
Assembler Source Code aka RTF. I added the plain text version above.
Quote from: Gunner on June 20, 2010, 07:15:35 PM
jj, doesn't work here.... I don't have a default mail app installed.. if the OP uses SMTP or MAPI that wouldn't matter :wink
I don't think an ordinary user
a) has no default mail app installed,
b) would appreciate if a little proggie sends mail on its own,
therefore I would rather not recommend SMTP or MAPI.
With the advances in SPAM control on email servers(i.e. reverse lookups), Firewalls(that will only let the mail server send mail, because of black listing services due internal SMTP viruses), writing an email sending routine is pretty much pointless.
I did, but the email never left the LAN. I got an email for error reporting on my software.
Maybe if you would advise us of the purpose/use and we can recommend a better solution. i.e. Is this for copy control ???
Plus, you have an assumption that the user is going to have Internet access that is not controlled or limited. Not always true, not good for support for you.
Regards, P1 :8)
Hi P1,
François was inspired by some "About" boxes containing clickable links - which is a legitimate purpose, and for which a ShellExecute mailto: is probably the right solution. So the thread (and my attachment above) deals mainly with the most elegant way to put a clickable link into a dialog.
sorry but "ResDlgHyperLink.exe" works with Vista and not with W7!!
Reassemble - it might work. Otherwise you may need a manifest.
Please tell me if the attached version works.
jj: I don't understand;
I can't see dialogbox when I "Buid " again with Qeditor or Radasm?
I don't get error message...
Nothing is displaying on my computer
However when I use your .exe file from the zip file, I can see the dialogbox which works with Vista and not with W7; it is the same with your version "3"
Try renaming ResDlgHyperLink.rc as rsrc.rc - Qeditor or Radasm probably assume that you create a new folder for each source (my own editor checks first if there is MySourceFile.rc, and only if a) it doesn't find that and b) there is a need for an rc file, it will use rsrc.rc).
Here is a version that uses an interesting technique: a user-defined class in the resource file:
#include "\masm32\include\resource.h"
TestWin DIALOGEX DISCARDABLE 10, 10, 206, 132, 0
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_POPUP
CAPTION "Simply mail"
FONT 11, "MS Sans Serif", 900, 0
BEGIN
EDITTEXT 100, 2,2,156,128, ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_WANTRETURN, , 0
CONTROL "Type or paste your text, then click on the link below to launch your default mailer:", 126, STATIC, SS_NOTIFY | SS_LEFT, 160, 2, 44, 50+2
CONTROL "Send mail", 127, "MyStatic", SS_NOTIFY | SS_LEFT, 160, 5+50, 38, 10
END
With this new MyStatic class, the cursor behaves better than in the previous example (which would not have allowed a second static control).
jj:
I try tour different version
1/ I must change name of file "ResDlgHyperLink.rc" to "rsrc.rc" file to Built correctly the file .exe with Qeditor
why ? I don't know
2/ the different version that I get , so with that uses a user-defined class in the resource file,
don't work with W7, but works with Vista
I can't test it because I still have Win XP, but I guess fumbling with security settings, compatibility modes, manifest files is the way to go...
With W7 the return valor after invoke ShellExecute , is : 31 (1F hexa)
Quote from: franlou on June 24, 2010, 10:13:03 AM
With W7 the return valor after invoke ShellExecute , is : 31 (1F hexa)
So the proggie works in principle. Good news. Error 31 is SE_ERR_NOASSOC (http://msdn.microsoft.com/en-us/library/bb762153%28VS.85%29.aspx): There is no application associated with the given file name extension.
Save this as MyTest.htm and open it with a browser.
<html><head><title>Just a test</title></head><body>
<a href="mailto:Hutch@movsd.com">A link, wow!</a>
</body></html>
with Vista I got a window Mail
with W7 I got error message:(traduction...?!)
" Impossible to do this operationthen (le client de courrier électronique par défaut) is not icorrectly installed"
jj: finally I installed thinderbird and that works !! :lol
Windows7 not instal application for mail like Windows mail; we have the choice (!!) to install that we like!
Congrats :U
Quote from: jj2007 on June 21, 2010, 10:04:49 PM
Hi P1,
François was inspired by some "About" boxes containing clickable links - which is a legitimate purpose, and for which a ShellExecute mailto: is probably the right solution. So the thread (and my attachment above) deals mainly with the most elegant way to put a clickable link into a dialog.
Thanks for extra info !!!
I was trying to discourage a SMTP engine send routine, seeing that it would not be either transmitting off private LANs or recieved on major mail systems. Because of past SMTP viruses behavoir.
There should be some error control that should account for a missing "system" email component to use.
Regards, P1 :8)
If you had a website it would be easier to send email, you can use PHP script to deal for the Mail protocol. Your application just sent the text to the script.