An easy way to send mail
People often ask "How can I send a formatted email message from Liberty Basic?" (Well once someone asked that - but it wasn't me... well it might have been). Moving on... I remembered that Alyce had integrated this very feature into one of her earlier Integrated Development Enviroments that she had written completly in Liberty Basic (version 2.02 at the time). It was a for-runner of the current Open Source LB Editor, which it inspired. I recently posted this on the LB list in response to a real question - and wanted to share it with the larger audience. As I mentioned I gleaned this little gem from Alyce's EditWorks of the old LB2 days. It was calling the 16bit dll calls, so I converted it to 32bit and polished it up a little for LB3. Alyce mentioned later that she too had recieved it from someone else even earlier. My thanks goes out to those who blaze the trail before us...
'email.bas 'based on the work done by Alyce Watson in EditWorks (Thanks ' you are an inspiration to all of us!) 'Runs on LB3.x 'Modifacations by Brad Moore (blame Alyce if it don't work) ;-) [WindowSetup] NOMAINWIN WindowWidth = 136 : WindowHeight = 73 UpperLeftX = INT((DisplayWidth-WindowWidth)/2) UpperLeftY = INT((DisplayHeight-WindowHeight)/2) [ControlSetup] button #main.email, "Email Me",[email],UL, 10, 10, 105, 25 Open "Window Title" for Dialog as #main print #main, "trapclose [quit]" print #main, "font ms_sans_serif 10" hWnd = hWnd(#main) [loop] Wait [quit] close #main : END [email] 'The email address is ficticious, so don't bother pressing send... file$="mailto:whoever@coolISP.com?Subject=I want to be your friend" result = ShellExecute(hWnd, file$, "") if result <= 32 then notice "Error, Address Failure!" goto [loop] Function ShellExecute(hWnd, file$, dir$) parameter = _SW_SHOWNORMAL ' set up for viewing lpszOp$ = "open" + Chr$(0) ' "open" or "print" lpszFile$ = file$ + Chr$(0) lpszDir$ = dir$ + Chr$(0) lpszParams$= "" + Chr$(0) CallDLL #shell32, "ShellExecuteA", _ hWnd As Long, _ lpszOp$ As Ptr, _ lpszFile$ As Ptr, _ lpszParams$ As Ptr, _ lpszDir$ As Ptr, _ parameter As Long, _ result As Long ShellExecute = result End function