Regards,
Otto
exe file for testing: you need a c:\temp dir. Your email is saved there as a msg file.
http://www.winhotel.at/fw/xfang.zip
source:
testdrop.prg
- Code: Select all Expand view RUN
#INCLUDE "FIVEWIN.CH"
REQUEST DBFCDX
REQUEST DBFFPT
function Main(cKdnr)
local oDlg, oRich
local hRichDLL := LoadLibrary( "riched20.dll" )
DEFINE DIALOG oDlg NAME "DROP" FROM 1, 1 TO 100, 100 PIXEL
oRich = xTRich():Redefine( 100, { || "" }, oDlg )
oRich:cKdNr := cKdNr
oRich:bMButtonDown := {|nRow, nCol, nFlags| oRich:end(),oDlg:hide(),dropread(cKdnr),oDlg:show(), oDlg:end()}
ACTIVATE DIALOG oDlg
FreeLibrary( hRichDLL )
return nil
//----------------------------------------------------------------------------//
function dropread()
local oDlg
LOCAL oOutlook := TOleAuto():New( "Outlook.Application" )
local myOlExp := oOutlook:ActiveExplorer
local oMail
local oGet
local cKategorie := space(50)
local cStichwort := space(50)
local oK := .f.
local dDatum := date()
local dNachfassen := date()+14
local cScanner := GetPvProfString( "SCANNER","MODELL","N",".\INI\WINHOTEL.INI" )
local ziel := ""
local oDatei
local I := 0
local cNotiz := "cNotiz"
local oInhalt
local cDatei := ""
*--------------------------------------------------------------------------
oMail := myOlExp:Selection:Item(1)
oMail:SaveAs ( "c:\temp\" + "testdemo.msg" )
cNotiz := left(ALLTRIM(oMail:body),1000)
cStichwort := oMail:subject + space(50)
DEFINE DIALOG oDlg RESOURCE "SCANNER"
REDEFINE SAY oDatei ID 111 OF oDlg
REDEFINE GET ckategorie ID 101 of oDlg
REDEFINE GET cStichwort ID 102 of oDlg
REDEFINE GET dDatum ID 105 of oDlg
REDEFINE GET dNachfassen ID 106 of oDlg
REDEFINE GET oGet VAR cNotiz ID 8002 of oDlg MEMO
REDEFINE BUTTON ID 103 OF oDlg ACTION (oDlg:END())
REDEFINE BUTTON ID 104 OF oDlg ACTION (OK:=.T.,oDlg:END())
ACTIVATE DIALOG oDlg ON INIT oDatei:SetText(cDatei) ;
ON PAINT SETWINDOWPOS( oDlg:hWnd, -1, 0, 0, 0, 0, 3 ) ;
CENTERED
IF ok = .t.
msginfo("Save data")
ENDIF
return nil
//----------------------------------------------------------------------------//
INIT PROCEDURE PrgInit
SET CENTURY ON
SET EPOCH TO YEAR(DATE())-98
SET DELETED ON
SET EXCLUSIVE OFF
REQUEST HB_Lang_DE
REQUEST HB_CODEPAGE_DEWIN
HB_LangSelect("DE")
HB_SetCodePage("DEWIN")
SET DATE TO GERMAN
SetHandleCount(205)
rddsetdefault( "DBFCDX" )
SetGetColorFocus()
EXTERN DESCEND
SetBalloon( .T. )
RETURN
//----------------------------------------------------------------------------//
xTRich.prg
- Code: Select all Expand view RUN
// Win32 RichEdit Control support
#include "FiveWin.ch"
#include "Constant.ch"
#include "WColors.ch"
#include "RichEdit.ch"
#ifdef __XPP__
#define Super ::TControl
#define New _New
#endif
#define CTRL_CLASS "RichEdit20A"
#define MK_MBUTTON 16
#define WM_MBUTTONDOWN 519
#define WM_MBUTTONDBLCLK 521
#define WM_MOUSEWHEEL 522
#define WM_NCHITTEST 132 // 0x84
//----------------------------------------------------------------------------//
CLASS xTRich FROM TRichEdit
DATA cCargo, cKdNr
METHOD HandleEvent( nMsg, nWParam, nLParam )
METHOD MButtonDown( nRow, nCol, nFlags )
ENDCLASS
//----------------------------------------------------------------------------//
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS xTRich
local nRow, nCol, nFlags
do case
case nMsg == WM_NCHITTEST
if ::cCargo = GetWindowText( ::hWnd ) .or. len(ALLTRIM(GetWindowText( ::hWnd )))=0
else
::MButtonDown( nRow, nCol, nFlags )
::cCargo := GetWindowText( ::hWnd )
endif
case nMsg == FM_HIGHLIGHT
return ::HighLightLine()
case nMsg == FM_HIGHLIGHTALL
return ::HighlightAllText()
case nMsg == WM_KEYDOWN
if ::lReadOnly
if ( nWParam == Asc( "E" ) .or. nWParam == Asc( "L" ) .or. ;
nWParam == Asc( "J" ) .or. nWParam == Asc( "R" ) ) .and. ;
GetKeyState( VK_CONTROL )
return 0
endif
endif
return ::KeyDown( nWParam, nLParam )
otherwise
if( nMsg == WM_MOUSEWHEEL .or. nMsg == WM_MBUTTONDOWN .or. ;
nMsg == WM_MBUTTONDBLCLK )
if GetKeyState( VK_CONTROL )
return 0
endif
else
Super:HandleEvent( nMsg, nWParam, nLParam )
endif
endcase
return nil
//----------------------------------------------------------------------------//
METHOD MButtonDown( nRow, nCol, nKeyFlags ) CLASS xTRich
Super:MButtonDown( nRow, nCol, nKeyFlags )
::PostMsg( FM_CHANGE )
return nil
//----------------------------------------------------------------------------//
testdrop.rc
- Code: Select all Expand view RUN
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 4.50".
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
LANGUAGE LANG_GERMAN,SUBLANG_GERMAN_AUSTRIAN
SCANNER DIALOGEX DISCARDABLE 18, 19, 254, 257
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU
CAPTION "Import"
FONT 10, "MS Reference Sans Serif", 400, 0, 0
BEGIN
CONTROL "Stichwort", -1, "Static", WS_GROUP, 6, 56, 84, 8
CONTROL "Kategorie", -1, "Static", WS_GROUP, 6, 88, 73, 8
CONTROL "Datum", -1, "Static", WS_GROUP, 120, 9, 26, 8
CONTROL "nachfassen", -1, "Static", WS_GROUP, 99, 22, 39, 8
CONTROL "", 101, "Edit", WS_BORDER|WS_TABSTOP, 6, 106, 118, 12
CONTROL "", 102, "Edit", WS_BORDER|WS_TABSTOP, 6, 70, 119, 12
CONTROL "", 105, "Edit", WS_BORDER|WS_TABSTOP, 152, 8, 45, 12
CONTROL "", 106, "Edit", WS_BORDER|WS_TABSTOP, 153, 22, 45, 12
CONTROL "Abbruch", 103, "Button", WS_TABSTOP, 124, 224, 45, 14
CONTROL "Speichern", 104, "Button", WS_TABSTOP, 72, 224, 40, 14
CONTROL "Datei", 111, "Static", WS_GROUP, 6, 40, 240, 8
CONTROL "", 8002, "Edit", ES_MULTILINE|ES_WANTRETURN|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 4, 124, 222, 82
END
DROP DIALOGEX DISCARDABLE 6, 18, 210, 142
STYLE WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "Dialog"
FONT 8, "MS Sans Serif", 0, 0, 1
BEGIN
CONTROL "OK", IDOK, "Button", WS_TABSTOP, 160, 5, 45, 15
CONTROL "Cancel", IDCANCEL, "Button", WS_TABSTOP, 160, 23, 45, 15
CONTROL "", 100, "RichEdit20A", ES_MULTILINE|ES_WANTRETURN|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 8, 12, 102, 111
END