Jeff:
I wrote an app using CDO email functions. This is how I add photo attachments
(or any file) to the email by dragging and dropping on this listbox.
Perhaps this code will trigger a better way for you to get multiple files...
Jack
Launch the Windows Explorer:
LOCAL lcFileName, lcAction, lcParms, lcDir, lnResult
DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin
DOEVENTS
lcFileName = "c:\windows\explorer.exe"
lcAction = "open"
lcParms = ""
lcDir = ""
WAIT WINDOW "Launching Program..." NOWAIT
ShellExecute(0, lcAction, lcFileName, @lcParms, "", 1)
CLEAR DLLS "ShellExecute"
WAIT CLEAR
Select the list of files you want and drag them into the listbox
Create a listbox and add this code to the oleDragDrop method
LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
LOCAL aValues, i, cText, nOperation
****DragDrop
*-- Check to see whether the user wants to copy or move
*IF nShift == 1
* nOperation = 1 &&DROPEFFECT_COPY
*ELSE
* nOperation = 2 &&DROPEFFECT_MOVE
*ENDIF
*Thisform.LockScreen = .T.
DO CASE
CASE oDataObject.GetFormat("OLE Variant Array")
DIMENSION aValues( 1 )
oDataObject.GetData("OLE Variant Array", @aValues )
*-- Add each array element as
FOR i = 1 to alen(aValues,1) && for each row in the array
IF (alen(aValues,2) > 1)
This.AddItem( aValues(i,1))
ELSE
This.AddItem( aValues(i))
ENDIF
ENDFOR
CASE oDataObject.GetFormat(1) && Text
cText = oDataObject.GetData(1)
*-- Add the text as a new item in the list
This.AddItem(cText)
CASE oDataObject.GetFormat(15) && Files CF_DROP this will be the format
for adding files...
DIMENSION aValues(1)
oDataObject.GetData(15, @aValues)
*-- Add each filename as a new item in the list
FOR i = 1 to alen(aValues)
Thisform.add_attachment_to_listbox(aValues(i))
ENDFOR
thisform.lstAttachments.Requery()
thisform.lstAttachments.Refresh()
ENDCASE
DOEVENTS FORCE
*Thisform.LockScreen = .F.
*-- Set the nEffect parameter for communication back to the source object
*nEffect = nOperation
ENDPROC
Then create a method to populate the listbox...
LPARAMETERS lcAttachment
LOCAL lcFile, lcPath, lcExt, lcFile_spec
LOCAL ARRAY laFile_info(1,5)
lcFile = ""
lcPath = ""
lcExt = ""
lcFile = ALLTRIM(JUSTFNAME(lcAttachment))
lcExt = ALLTRIM(LOWER(JUSTEXT(lcAttachment)))
lcPath = ALLTRIM(ADDBS(JUSTPATH(lcAttachment)))
lcFile_spec = lcPath + lcFile
ADIR(laFile_info, lcFile_spec)
thisform.lstAttachments.AddItem(lcFile, thisform.lstAttachments.ListCount + 1,
1) &&file
thisform.lstAttachments.ListIndex = thisform.lstAttachments.ListCount
thisform.lstAttachments.List(thisform.lstAttachments.ListIndex, 2) = lcPath
&&path...not visible...
thisform.lstAttachments.List(thisform.lstAttachments.ListIndex, 3) =
DTOC(laFile_info(1,3)) &&date
thisform.lstAttachments.List(thisform.lstAttachments.ListIndex, 4) =
laFile_info(1,4) &&time
thisform.lstAttachments.List(thisform.lstAttachments.ListIndex, 5) =
TRANSFORM(laFile_info(1,2),"9,999,999") &&size
DOEVENTS
WAIT WINDOW "" TIMEOUT 0.1
IF INLIST(lcExt,"jpg", "jpeg", "bmp") THEN
thisform.lstAttachments.Height = 132
thisform.imgPic.Visible = .t.
thisform.imgPic.Picture =
ALLTRIM(thisform.lstAttachments.List(thisform.lstAttachments.ListIndex, 2)) + ;
ALLTRIM(thisform.lstAttachments.List(thisform.lstAttachments.ListIndex, 1))
gnPhotos = gnPhotos + 1
IF gnPhotos > 1 THEN
thisform.cmdSlide.Enabled = .t.
ENDIF
ELSE
thisform.lstAttachments.Height = 260
thisform.imgPic.Visible = .f.
ENDIF
*thisform.lstAttachments.MoverBars = .t.
*thisform.lstAttachments.Requery()
*thisform.lstAttachments.Refresh()
gnAttachment_count = gnAttachment_count + 1
thisform.txtAttachment_count.Refresh()
thisform.cmdDelete.Enabled = .t.
thisform.cmdClear.Enabled = .t.
thisform.set_email_button()
Jack Skelley
Senior Director, Programming/Computer Operations
New Jersey Devils
(973)757-6164
[email protected] ________________________________________
From: ProfoxTech [[email protected]] on behalf of Jeff Johnson
[[email protected]]
Sent: Tuesday, December 18, 2012 11:21 AM
To: [email protected]
Subject: GETFILE() Multiple Files
I would like to select several files at once in something like a
GETFILE(). Is there something out there that does that or do I need to
create my own replacement for GETFILE()?
TIA
--
Jeff
---------------
Jeff Johnson
[email protected]
(623) 582-0323
www.san-dc.com
www.arelationshipmanager.com
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/7d9e7f72b813014c8fd022cf04f820ed585a5...@ex08.drdad.thenewarkarena.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.