call a dll32 function

call a dll32 function

Postby jorjio » Mon May 26, 2014 5:18 pm

Hi,
I have a very simple example prg like

Code: Select all  Expand view  RUN

//jj.prg
#include "FiveWin.ch"
#INCLUDE "SEE32.CH"

FUNCTION MAin()
xaxa:="1"
? "debug SEEVER 6/17/2008", xaxa

return


function FWOpenPngFile() ; return 0     //this is related to PNG.LIB unresolved externals
 


Here is see32.ch
Code: Select all  Expand view  RUN

*--
*-- SEE32.CH (SEE version 7.2)
*--
*-- For FIVEWIN
*--

#define SEE_MIN_RESPONSE_WAIT    1
#define SEE_MAX_RESPONSE_WAIT    2
#define SEE_CONNECT_WAIT         3
#define SEE_DISABLE_MIME         4
#define SEE_QUOTED_PRINTABLE     8
#define SEE_AUTO_CALL_DRIVER     9
#define SEE_FILE_PREFIX         10
#define SEE_MAX_SMTP_WAIT       11
#define SEE_MAX_POP3_WAIT       12
#define SEE_SLEEP_TIME          13
#define SEE_DECODE_UNNAMED      14
#define SEE_SMTP_PORT           15
#define SEE_POP3_PORT           16
#define SEE_MAX_LINE_LENGTH     17
#define SEE_BLOCKING_MODE       18
#define SEE_ALLOW_8BITS         19
#define SEE_LOG_FILE            20
#define SEE_HIDE_SAVED_MSG      21
#define SEE_HIDE_TO_ADDR        22
#define SEE_ADDRESS_DELIMITER   23
#define SEE_WSACLEANUP          24
#define SEE_PATH_DELIMITER      25
#define SEE_ATTACH_DELIMITER    26
#define SEE_ENABLE_IMAGE        27
#define SEE_RAW_MODE            28
#define SEE_ENABLE_ESMTP        29
#define SEE_ENABLE_APOP         30
#define SEE_ATTACH_BASE_NUMBER  31
#define SEE_IGNORE_REJECTED     32
#define SEE_WRITE_CONTENT_TYPE  33
#define SEE_SET_FILE_PREFIX     34
#define SEE_HTML_CHARSET        35
#define SEE_HIDE_HEADERS        36
#define SEE_KEEP_RFC822_INTACT  37
#define SEE_IMAP_PORT           38
#define SEE_EXPUNGE_ON_CLOSE    39
#define SEE_GUT_ATTACHMENTS     40

#define CHARSET_BLANK        0
#define CHARSET_US_ASCII     1
#define CHARSET_8859         4
#define CHARSET_ISO_8859_1   4
#define CHARSET_ISO_8859_8   5
#define CHARSET_WIN_1252     6
#define CHARSET_WIN_1255     7
#define CHARSET_UTF8         8
#define CHARSET_ISO_8859_2  10
#define CHARSET_ISO_8859_7  11
#define CHARSET_WIN_1250    12
#define CHARSET_ISO_8859_3  13
#define CHARSET_ISO_8859_4  14

#define SEE_GET_ERROR_TEXT       1
#define SEE_GET_COUNTER          2
#define SEE_GET_RESPONSE         3
#define SEE_GET_SOCK_ERROR       4

#define SEE_GET_MESSAGE_BYTES_READ  10
#define SEE_GET_ATTACH_BYTES_READ   11
#define SEE_GET_TOTAL_BYTES_READ    12
#define SEE_GET_MESSAGE_BYTES_SENT  13
#define SEE_GET_ATTACH_BYTES_SENT   14
#define SEE_GET_TOTAL_BYTES_SENT    15
#define SEE_GET_VERSION             16
#define SEE_GET_MSG_COUNT           17
#define SEE_GET_MSG_SIZE            18
#define SEE_GET_BUFFER_COUNT        19
#define SEE_GET_CONNECT_STATUS      20
#define SEE_GET_REGISTRATION        21
#define SEE_GET_ATTACH_COUNT        22
#define SEE_GET_LAST_RESPONSE       23
#define SEE_GET_VERIFY_STATUS       24
#define SEE_GET_SERVER_IP           25
#define SEE_GET_BUILD               26
#define SEE_GET_SOCKET              27
#define SEE_GET_LOCAL_IP            28
#define SEE_GET_ATTACH_NAMES        29
#define SEE_GET_LAST_RECIPIENT      30
#define SEE_GET_AUTH_PROTOCOLS      31
#define SEE_GET_ATTACH_TYPES        32
#define SEE_GET_ATTACH_IDS          33

#define SEE_COPY_BUFFER             40
#define SEE_WRITE_BUFFER            41

#define SEE_SET_REPLY               50
#define SEE_SET_HEADER              51
#define SEE_WRITE_TO_LOG            52
#define SEE_SET_FROM                53
#define SEE_SET_CONTENT_TYPE        54
#define SEE_SET_TRANSFER_ENCODING   55
#define SEE_ADD_HEADER              56
#define SEE_SET_SECRET              57
#define SEE_SET_USER                58
#define SEE_SET_TEXT_MESSAGE        59
#define SEE_FORCE_INLINE            60
#define SEE_SET_ATTACH_CONTENT_TYPE 61
#define SEE_AUTHENTICATE_PROTOCOL   62
#define SEE_SET_CONTENT_TYPE_PREFIX 63
#define SEE_ENABLE_XMAILER          64
#define SEE_SET_DEFAULT_ZONE        65
#define SEE_SET_ATTACH_DESCRIPTION  66
#define SEE_REPLACE_WITH_COMMAS     67
#define SEE_SET_MULTIPART           68
#define SEE_SET_TIME_ZONE           69
#define SEE_SET_RAWFILE_PREFIX      70
#define SEE_SET_IMAP_LIST_ARG       71
#define SEE_SET_FOOTER              72
#define SEE_SET_LOCAL_IP            73
#define SEE_SET_HELO_STRING         74
#define SEE_SET_CONNECT_ATTEMPTS    75
#define SEE_REPLACE_UNDERSCORES     76

#define QUOTED_OFF          0
#define QUOTED_PLAIN        1
#define QUOTED_HTML         2
#define QUOTED_RICH         3
#define QUOTED_8859         4
#define QUOTED_ISO_8859_1   4
#define QUOTED_ISO_8859_8   5
#define QUOTED_WIN_1252     6
#define QUOTED_WIN_1255     7
#define QUOTED_USER         9
#define QUOTED_ISO_8859_2  10
#define QUOTED_ISO_8859_7  11
#define QUOTED_WIN_1250    12
#define QUOTED_ISO_8859_3  13
#define QUOTED_ISO_8859_4  14

#define INLINE_TEXT_OFF         0
#define INLINE_TEXT_INLINE      1
#define INLINE_TEXT_ATTACHMENT  2

#define AUTHENTICATE_CRAM    1
#define AUTHENTICATE_LOGIN   2
#define AUTHENTICATE_PLAIN   4

#define IMAP_FLAG_SEEN        1
#define IMAP_FLAG_ANSWERED    2
#define IMAP_FLAG_FLAGGED     4
#define IMAP_FLAG_DELETED     8
#define IMAP_FLAG_DRAFT      16
#define IMAP_FLAG_RECENT     32

#define IMAP_GET_FLAGS        1
#define IMAP_SET_FLAGS        2
#define IMAP_DEL_FLAGS        3

#define IMAP_SEARCH_MSG_COUNT 1
#define IMAP_SEARCH_FIRST_MSG 2
#define IMAP_SEARCH_NEXT_MSG  3

#define STUNNEL_TASKBAR_ICON    0x01
#define STUNNEL_DISABLE_LOGGING 0x02

#define SEE_GET_DATE           1
#define SEE_GET_FROM           2
#define SEE_GET_REPLY_TO       3
#define SEE_GET_SUBJECT        4
#define SEE_GET_TO             5


DLL32 FUNCTION seeAttach( NbrChans As LONG,  KeyCode As LONG) As LONG PASCAL LIB "SEE32.DLL"


 


I have kept just one function. If I have not function at all everything is fine.
I compile with xbuildw tool using xharbour Jan2013 and fivewin 13.04. I add mem32.lib, send32.lib, oledlg.lib. I also use see32.lib. The prg is compiled correctly but it does not show anything on the screen. If I delete the dll32 function from see32.ch it stops at the debug line. Is there anything else I should link or take care of?
I tried the method with loadlib32 and freelib as below

Code: Select all  Expand view  RUN

static hLo32
FUNCTION Main()
xaxa:="1"
? "debug SEEVER 6/17/2008", xaxa
return

function FWOpenPngFile() ; return 0
init procedure Lo32

   if hLo32 == nil
      hWinINet = LoadLib32( "See32.dll" )
      if Abs( hLo32 ) <= 32
         MsgStop( "Cannot load See32.dll!" )
      endif
   endif
return hLo32

exit procedure  xLo32

   if hLo32 != nil
      FreeLib32( hLo32 )
   endif

return
DLL32 FUNCTION seeAbort(Chan As LONG) As LONG PASCAL from "seeAbort" LIB hLo32
DLL32 FUNCTION seeAttach( NbrChans As LONG,  KeyCode As LONG) As LONG PASCAL from "seeattach" LIB hLo32

 

but although compiled correctly ends in error.
jorjio
 
Posts: 14
Joined: Tue Sep 10, 2013 8:08 pm

Re: call a dll32 function

Postby karinha » Mon May 26, 2014 6:03 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: call a dll32 function

Postby jorjio » Mon May 26, 2014 6:46 pm

Thank you for your answer. The code you refer to uses calldll which I tried but does not work with mailssl which is my aim. I have the newest dll from marshallsoft and I am working on it.
jorjio
 
Posts: 14
Joined: Tue Sep 10, 2013 8:08 pm

Re: call a dll32 function

Postby karinha » Mon May 26, 2014 7:46 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: call a dll32 function

Postby jorjio » Mon May 26, 2014 8:09 pm

Thank you again. The first link ends with reference to see32 where I want also to conclude. The second refers to many things I do not want to enter. Meanwhile I work with hb_sendmail from xHarbour.
jorjio
 
Posts: 14
Joined: Tue Sep 10, 2013 8:08 pm

Re: call a dll32 function

Postby karinha » Mon May 26, 2014 8:35 pm

Better continue with hb_sendmail()

Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: call a dll32 function

Postby jorjio » Fri Jun 06, 2014 6:51 pm

Hi,
Finally we achieved ssl connection with see32.dll. Mike from Marshallsoft is very helpful. I could not use directly the see32 dll functions but I wrapped them like
Function XSetProxYSSL( nChan, nFlags, cPDir, cPCert, cPEXE )
*-----------------------------------------------------
local uResult
local cFarProc

if Abs( hDLL ) > 32
cFarProc := GetProcAddress( hDLL, "seeSetProxySSL",.T.,_INT,LONG,LONG,LPSTR,LPSTR,LPSTR) // 32 Bits
uResult := CallDLL( cFarProc, nChan, nFlags, @cPDir, @cPCert, @cPEXE )
else
MsgAlert( "Error code: " + LTrim( Str( hDLL ) ) + " loading SEE32.DLL" )
endif
return uResult

Function XSmtpConnectSSL( nChan, ProxyPort, SmtpPort, SmtpServer, cSmtpUser, cSmtpPass, SmtpFrom, SmtpReply, cCH )
*-----------------------------------------------------
local uResult
local cFarProc

if Abs( hDLL ) > 32
cFarProc := GetProcAddress( hDLL, If( .T., "seeSmtpConnectSSL", ),.T., _INT,LONG,LONG,LONG,LPSTR,LPSTR,LPSTR,LPSTR,LPSTR,LPSTR )
uResult := CallDLL( cFarProc, nChan, ProxyPort, SmtpPort, @SmtpServer, @cSmtpUser, @cSmtpPass, @SmtpFrom, @SmtpReply, @cCH )

else
MsgAlert( "Error code: " + LTrim( Str( hDLL ) ) + " loading SEE32.DLL" )
endif
return uResult

Function XPop3ConnectSSL( nChan, ProxyPort, SmtpPort, SmtpServer, cSmtpUser, cSmtpPass, cCH )
*--------------------------------------------------------
local uResult
local cFarProc

if Abs( hDLL ) > 32
// cFarProc := GetProcAddress( hDLL, If( .T., "seePop3Connect", ),.T., _INT,_INT,LPSTR,LPSTR,LPSTR ) // 16 Bits
cFarProc := GetProcAddress( hDLL, If( .T., "seePop3ConnectSSL", ),.T., _INT,LONG,LONG,LONG,LPSTR,LPSTR,LPSTR,LPSTR ) // 32 Bits
uResult := CallDLL( cFarProc, nChan, ProxyPort, SmtpPort, @SmtpServer, @cSmtpUser, @cSmtpPass, @cCH ) // 06/may/2004 V.
else
MsgAlert( "Error code: " + LTrim( Str( hDLL ) ) + " loading SEE32.DLL" )
endif
return uResult

Then a sample of code
kode := XSetProxySSL(0, nFlags, @cProxyDir, @cProxyCert, @cProxyExe)
if Kode > 0
SmtpReply := CHR(0)
if len(trim(proxyport))=0 .or. len(trim(smtpport))=0
nCode := XClose(0)
nCode := XRelease()
lHadError := .T.
exit
endif
nProxy:=VAL(proxyport)
nSmtpp:=VAL(Smtpport)
Code :=XSmtpConnectSSL(0, nProxy, nSmtpP,@SmtpServer,@cSmtpUser, @cSmtpPass, @SmtpFrom, @SmtpReply, Chr(0))
jorjio
 
Posts: 14
Joined: Tue Sep 10, 2013 8:08 pm

Re: call a dll32 function

Postby Antonio Linares » Fri Jun 06, 2014 6:59 pm

Jorjio,

Excellent! many thanks for sharing it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: call a dll32 function

Postby jorjio » Thu Mar 12, 2015 3:21 pm

Hi,
After having worked perfectly all this time with see32, the time came that stopped supporting orgs like verizon. I downloaded new version and nothing happened. I talked with marshallsoft and told me that his demo for Alaska environment is working. He is using dll_stdcall which is not supported to us so I have translated all see32.dll functions to our calldll. The point is that I can not use their demo as is to be sure they are right. Have you any idea or any suggestion for anyother solution?
jorjio
 
Posts: 14
Joined: Tue Sep 10, 2013 8:08 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 70 guests