Hi all,
I have another 'mailto:' problem.
When I call the mailto: program (is it actually a program??) from within
my PB/DLL routine and the body of the mail (the actual messagetext) is
too long my program crashes...
I have included a demo where you can test the problem. You can enter the length
of the message.
When you enter a number well below 1000, all behaves normally: my e-mail program (Eudora 5.0)
starts up and a new mail is prepared with all items nicely filled in (subject, body, etc).
When my message is around 2000 characters long, nothing happens.. My PB routine does not
crash but my e-mail program doesn't seem to receive anything.
When the message length is 3000 bytes or more, my PB program immediately crashes...
I run this on Win2k.
Could it be a stack problem?
I just tested it on Outlook Express and the problem remains the same...
Kind regards
Eddy
------------------
[email protected]
[This message has been edited by Eddy Van Esch (edited September 20, 2001).]
I have another 'mailto:' problem.
When I call the mailto: program (is it actually a program??) from within
my PB/DLL routine and the body of the mail (the actual messagetext) is
too long my program crashes...
I have included a demo where you can test the problem. You can enter the length
of the message.
When you enter a number well below 1000, all behaves normally: my e-mail program (Eudora 5.0)
starts up and a new mail is prepared with all items nicely filled in (subject, body, etc).
When my message is around 2000 characters long, nothing happens.. My PB routine does not
crash but my e-mail program doesn't seem to receive anything.
When the message length is 3000 bytes or more, my PB program immediately crashes...
I run this on Win2k.
Could it be a stack problem?
I just tested it on Outlook Express and the problem remains the same...
Kind regards
Eddy
Code:
#COMPILE EXE #REGISTER NONE #INCLUDE "C:\PBDLL60\Winapi\Win32api.inc" #INCLUDE "C:\PBDLL60\Winapi\Commctrl.inc" %IDINPOK = 100 %IDINPCANCEL = 102 %IDINPTEXT = 120 %IDINPPROMPT = 121 GLOBAL inputtext AS STRING GLOBAL hDlg AS LONG GLOBAL result AS LONG DECLARE CALLBACK FUNCTION OkButton() DECLARE CALLBACK FUNCTION CancelButton() DECLARE FUNCTION SendAsMail(mStr AS STRING) AS LONG FUNCTION PBMAIN() AS LONG DIALOG NEW 0, "Mailto: problem", ,, 260, 70, 0, 0 TO hDlg CONTROL ADD LABEL, hDlg, %IDINPPROMPT, "< 1000: no problem, 2000: does nothing, >3000: crash", 5, 12, 200, 12, 0 CONTROL ADD TEXTBOX, hDlg, %IDINPTEXT, "100", 5, 24, 240, 12, 0 CONTROL ADD BUTTON, hDlg, %IDINPOK, "Send", 34, 45, 40, 14, &H1& CALL OkButton CONTROL ADD BUTTON, hDlg, %IDINPCANCEL, "Exit", 84, 45, 40, 14, 0 CALL CancelButton DIALOG SHOW MODAL hDlg TO result END FUNCTION CALLBACK FUNCTION OkButton() LOCAL result AS LONG CONTROL GET TEXT CBHNDL, %IDINPTEXT TO inputtext result = SendAsMail(REPEAT$(VAL(inputtext),"a" )) END FUNCTION CALLBACK FUNCTION CancelButton() DIALOG END CBHNDL, 0 END FUNCTION FUNCTION SendAsMail(mStr AS STRING) AS LONG LOCAL mLen AS LONG', mText AS STRING LOCAL mText AS ASCIIZ * 50000 mLen = LEN(mStr) IF mLen > 1 THEN 'REPLACE CHR$(13,10) WITH "%0d%0a" IN mStr 'Proper linefeed for mail REPLACE CHR$(32) WITH "%20" IN mStr 'Spaces REPLACE CHR$(38) WITH "%26" IN mStr '& REPLACE CHR$(10) WITH "%0a" IN mStr 'char$(10) REPLACE CHR$(13) WITH "%0d" IN mStr 'char$(13) REPLACE CHR$(9) WITH "%09" IN mStr 'char$(9) END IF mText = "mailto:" & "[email protected]" & "?" mText = mText & "Subject=" & "Some subject" mText = mText & "&Body=" & mStr 'FUNCTION = ShellExecute(hMain, "open", BYVAL STRPTR(mText), "", "", %SW_SHOWNORMAL) FUNCTION = ShellExecute(hDlg, "open", BYVAL VARPTR(mText), "", "", %SW_SHOWNORMAL) END FUNCTION
------------------
[email protected]
[This message has been edited by Eddy Van Esch (edited September 20, 2001).]
Comment