|
-
Oct 31st, 2012, 11:21 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Vb6 - shellexecute doesnt like "&"
Hi
I was trying to send an email thru shellexecute and I found out that if the text being sent contains a "&", shellexecute will just stop reading beyond &.
I don't know why (Im not familiar with shellexecute)
In my particular case, the example is:
ShellExecute 0&, vbNullString, emailaddress & "?subject=" & MailSub.TEXT & "&body=" & Replace(MailTEXT.TEXT, vbCrLf, "%0A"), vbNullString, vbNullString, SW_SHOWNORMAL
I thought it could be useful to know for other VB6 users too.
Regards
Horazio
-
Oct 31st, 2012, 11:28 AM
#2
Re: Vb6 - shellexecute doesnt like "&"
This:
MailSub.TEXT & "&body=" & Replace
Seems like it would be
MailSub.TEXT&body=Replace
With what ever was in mailsub.text and the Replace(MailTEXT.TEXT, vbCrLf, "%0A"),
So If mailsub.text was XXXX and Replace(MailTEXT.TEXT, vbCrLf, "%0A") was ZZZ it would be
XXX&bodyZZZZ
Was that intentional?
-
Oct 31st, 2012, 11:39 AM
#3
Thread Starter
Hyperactive Member
Re: Vb6 - shellexecute doesnt like "&"
mailsub.text and mailtext.text ar both standard text controls
mailsub.text contains the title/object of the email
mailtext.text is the email message, if there is a "&" shellexecute will stop until it finds this character
-
Oct 31st, 2012, 12:37 PM
#4
Re: Vb6 - shellexecute doesnt like "&"
it's not shellexecute that doesn't like it... it'll happily take what you send it... the thing is, what you're executing is essentially a URL using the mailto protocol instead of the http one... which means everything you send over on the URL has to be URLEncoded... and there are classes, functions & APIs to help with that. Search for URLEncode VB6 ... that should tunr up a few results, including a few right here in VBF.
-tg
-
Oct 31st, 2012, 01:09 PM
#5
Thread Starter
Hyperactive Member
Re: Vb6 - shellexecute doesnt like "&"
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|