Página 1 de 1

OT: Ahora que tenemos los ocx....

Publicado: Vie Nov 17, 2006 12:43 pm
por jose.luis
Hola,
Ahora que tenemos los OCX y funciando estupendamente (buen trabajo
José!!)... ¿Conoceis algún componente _nativo_ de windows que permita enviar
correos electrónicos sin levantar ninguna ventana o diálogo?
Saludos y gracias,
José Luis Capel

OT: Ahora que tenemos los ocx....

Publicado: Vie Nov 17, 2006 12:55 pm
por jfgimenez
José Luis,
> Ahora que tenemos los OCX y funciando estupendamente (buen trabajo
> José!!)... ¿Conoceis algún componente _nativo_ de windows que permita
> enviar correos electrónicos sin levantar ninguna ventana o diálogo?
Si no usa ninguna ventana o diálogo, entonces es un componente ActiveX, no
un control OCX, y por lo tanto se puede usar con TOleAuto.
Otra cosa sería que manejara eventos, y TOleAuto() no soporta eventos. En
Xailer vamos a tener nuestra propia implementación de TOleAuto (seguramente
se llamará TActiveX), que sí soportará eventos.
--
Un saludo,
José F. Giménez
http://www.xailer.com

OT: Ahora que tenemos los ocx....

Publicado: Vie Nov 17, 2006 12:58 pm
por jose.luis
Hola José,
>
> Si no usa ninguna ventana o diálogo, entonces es un componente ActiveX, no
> un control OCX, y por lo tanto se puede usar con TOleAuto.
>
> Otra cosa sería que manejara eventos, y TOleAuto() no soporta eventos. En
> Xailer vamos a tener nuestra propia implementación de TOleAuto
> (seguramente se llamará TActiveX), que sí soportará eventos.
>
A ver si un día nos iluminas con los conceptos de OCX y OLE y ServidorOle y
OleContainer y ActiveX y esas cosas....
Saludos y gracias,
Jose Luis Capel

OT: Ahora que tenemos los ocx....

Publicado: Vie Nov 17, 2006 1:18 pm
por jfgimenez
José Luis,
> A ver si un día nos iluminas con los conceptos de OCX y OLE y ServidorOle
> y OleContainer y ActiveX y esas cosas....
La verdad es que el principal culpable de la confusión es la propia M$, que
ha cambiado la terminología varias veces a lo largo del tiempo.En fin, lo
tendré en cuenta y publicaré algún post en nuestro futuro blog aclarando
estos conceptos.
--
Un saludo,
José F. Giménez
http://www.xailer.com

OT: Ahora que tenemos los ocx....

Publicado: Vie Nov 17, 2006 5:46 pm
por swrite
José Luis
esto esta tomado del foro de minigui, funciona solo con xharbour puro
te aeguro que funciona super bien en mi windows Xp Sp2
no he probado con nada mas
Saludos y ojala sea lo que buscas
#define CRLF Chr(13) + Chr(10)
Function Main
Local cTitulo := 'Respaldo diario '
Local cTexto := 'Estimado Sr usuario' + CRLF + ;
'Descomprime el attach en directorio' + CRLF + ;
'sistemasjosenetEmpre001Ventas'
Local cOrigName := "Wilson 'W' Gamboa A"
Local cOrigAddress := 'swrite@uio.satnet.net'
Local cDestName := 'Distribuidora Xyz'
LOcal cDestAddress := 'swrite@uio.satnet.net'
Local cAttachFile := 'c:jose_pok.zip'
// MAPI with Confirm
//rta:=US_MAPISendMail(0, cTitulo, cTexto, cOrigName, cOrigAddress,
cDestName, cDestAddress, cAttachFile, 8)
// MAPI withOUT Confirm
//rta:=US_MAPISendMail(0, cTitulo, cTexto, cOrigName, cOrigAddress,
cDestName, cDestAddress, cAttachFile, 0)
Cls
?'Espere enviando email ..'
?rta:=US_MAPISendMail(0, cTitulo, cTexto, cOrigName, cOrigAddress,
cDestName, cDestAddress, cAttachFile, 0)
Return Nil
#pragma BEGINDUMP
#include <windows.h>
#include <stdio.h>
#include <mapi.h>
#include <mapix.h>
HINSTANCE hMAPILib = 0;
LHANDLE hSession = 0;
LPMAPILOGON pMAPILogon = NULL;
LPMAPILOGOFF pMAPILogoff = NULL;
LPMAPISENDMAIL pMAPISendMail = NULL;
MapiRecipDesc orig ;
MapiRecipDesc rcpt ;
MapiFileDesc file ;
MapiMessage mssg ;
HB_FUNC ( US_MAPISENDMAIL )
{
int nModoDialog = hb_parni( 9 ) ;
orig.ulReserved = 0 ; // Reserved
orig.ulRecipClass = MAPI_ORIG ; // Reciepient Class
MAPI_TO MAPI_CC MAPI_BCC
orig.lpszName = hb_parc( 4 ) ; // Originator's Name
orig.lpszAddress = hb_parc( 5 ) ; // Originators Address
orig.ulEIDSize = 0 ; // Count in bytes of size
of pEntryID
orig.lpEntryID = 0 ; // System-specific
Originator reference
rcpt.ulReserved = 0 ; // Reserved
rcpt.ulRecipClass = MAPI_TO ; // Reciepient Class
MAPI_TO MAPI_CC MAPI_BCC
rcpt.lpszName = hb_parc( 6 ) ; // Reciepient's Name,
e.g., pepe@hotmail.com
rcpt.lpszAddress = hb_parc( 7 ) ; // Reciepient's Address
rcpt.ulEIDSize = 0 ; // Count in bytes of size
of pEntryID
rcpt.lpEntryID = 0 ; // System-specific
Recipient reference
file.ulReserved = 0 ; // Reserved for future usage
file.flFlags = 0 ; // Flags ?
file.nPosition = -1 ; // Character of text to
be replaced by attachment
file.lpszPathName = hb_parc( 8 ) ; // Full Path Name with
Extension of the attached file
file.lpszFileName = 0 ; // Original File Name (
optional )
file.lpFileType = 0 ; // Attachment file type (
can be lpMapiFileTagExt )
mssg.ulReserved = 0 ; // Reserved
mssg.lpszSubject = hb_parc( 2 ) ; // Message Subject
mssg.lpszNoteText = hb_parc( 3 ) ; // Message Text
mssg.lpszMessageType = 0 ; // Message Class
mssg.lpszDateReceived = 0 ; // in yyyy/mm/dd hh:mm format
mssg.lpszConversationID = 0 ; // Conversation thread ID
mssg.flFlags = MAPI_LOGON_UI | MAPI_NEW_SESSION; //
unread, return receipt
mssg.lpOriginator = &orig ; // Originator's descriptor
mssg.nRecipCount = 1 ; // Number of receipients
mssg.lpRecips = &rcpt ; // Recipient descriptors
mssg.nFileCount = 1 ; // Number of file attachments
mssg.lpFiles = &file ; // Attachment descriptors
// Load the DLL at runtime
hMAPILib = ::LoadLibrary("MAPI32.DLL");
if (!hMAPILib)
{
hb_retnl( 101 ); // failed
return;
}
if (!(pMAPILogon = (LPMAPILOGON) GetProcAddress (hMAPILib,
"MAPILogon")))
{
hb_retnl( 102 ); // failed
return;
}
if (!(pMAPISendMail = (LPMAPISENDMAIL) GetProcAddress (hMAPILib,
"MAPISendMail")))
{
hb_retnl( 103 ); // failed
return;
}
if (!(pMAPILogoff = (LPMAPILOGOFF) GetProcAddress (hMAPILib,
"MAPILogoff")))
{
hb_retnl( 104 ); // failed
return;
}
// logon
if (pMAPILogon(0, NULL, NULL, MAPI_LOGON_UI | MAPI_NEW_SESSION, 0,
&hSession) != SUCCESS_SUCCESS)
{
hb_retnl( 105 ); // Logon failed
return;
}
// Send email using the MAPISendMail API function
if (nModoDialog == 0)
{
hb_retnl (pMAPISendMail(hSession, 0, &mssg, 0, 0)) ;
}
else
{
if (nModoDialog == 8)
{
hb_retnl (pMAPISendMail(hSession, 0, &mssg, MAPI_DIALOG, 0)) ;
}
else
{
hb_retnl( 108 ); // invalid parameter
}
}
// Logoff session
pMAPILogoff(hSession, 0, 0, 0);
// Free DLL
::FreeLibrary(hMAPILib);
return;
}
#pragma ENDDUMP

OT: Ahora que tenemos los ocx....

Publicado: Vie Nov 17, 2006 5:57 pm
por jose.luis
Wilson,
Gracias!! Lo voy a probar y te cuento.
Saludos y gracias,
José Luis Capel
"Wilson 'W' Gamboa A" <swrite@uio.satnet.net> escribió en el mensaje
news:[email=455DE781.5080600@uio.satnet.net...]455DE781.5080600@uio.satnet.net...[/email]
> José Luis
>
> esto esta tomado del foro de minigui, funciona solo con xharbour puro
> te aeguro que funciona super bien en mi windows Xp Sp2
> no he probado con nada mas
>
> Saludos y ojala sea lo que buscas
>
> #define CRLF Chr(13) + Chr(10)
>
> Function Main
>
> Local cTitulo := 'Respaldo diario '
> Local cTexto := 'Estimado Sr usuario' + CRLF + ;
> 'Descomprime el attach en directorio' + CRLF + ;
> 'sistemasjosenetEmpre001Ventas'
>
> Local cOrigName := "Wilson 'W' Gamboa A"
> Local cOrigAddress := 'swrite@uio.satnet.net'
> Local cDestName := 'Distribuidora Xyz'
> LOcal cDestAddress := 'swrite@uio.satnet.net'
> Local cAttachFile := 'c:jose_pok.zip'
>
>
> // MAPI with Confirm
>
> //rta:=US_MAPISendMail(0, cTitulo, cTexto, cOrigName, cOrigAddress,
> cDestName, cDestAddress, cAttachFile, 8)
>
> // MAPI withOUT Confirm
>
> //rta:=US_MAPISendMail(0, cTitulo, cTexto, cOrigName, cOrigAddress,
> cDestName, cDestAddress, cAttachFile, 0)
> Cls
> ?'Espere enviando email ..'
>
>
> ?rta:=US_MAPISendMail(0, cTitulo, cTexto, cOrigName, cOrigAddress,
> cDestName, cDestAddress, cAttachFile, 0)
>
> Return Nil
>
> #pragma BEGINDUMP
>
> #include <windows.h>
>
> #include <stdio.h>
>
> #include <mapi.h>
>
> #include <mapix.h>
>
> HINSTANCE hMAPILib = 0;
>
> LHANDLE hSession = 0;
>
> LPMAPILOGON pMAPILogon = NULL;
>
> LPMAPILOGOFF pMAPILogoff = NULL;
>
> LPMAPISENDMAIL pMAPISendMail = NULL;
>
> MapiRecipDesc orig ;
>
> MapiRecipDesc rcpt ;
>
> MapiFileDesc file ;
>
> MapiMessage mssg ;
>
> HB_FUNC ( US_MAPISENDMAIL )
>
> {
>
> int nModoDialog = hb_parni( 9 ) ;
>
> orig.ulReserved = 0 ; // Reserved
>
> orig.ulRecipClass = MAPI_ORIG ; // Reciepient Class MAPI_TO
> MAPI_CC MAPI_BCC
>
> orig.lpszName = hb_parc( 4 ) ; // Originator's Name
>
> orig.lpszAddress = hb_parc( 5 ) ; // Originators Address
>
> orig.ulEIDSize = 0 ; // Count in bytes of size of
> pEntryID
>
> orig.lpEntryID = 0 ; // System-specific
> Originator reference
>
> rcpt.ulReserved = 0 ; // Reserved
>
> rcpt.ulRecipClass = MAPI_TO ; // Reciepient Class MAPI_TO
> MAPI_CC MAPI_BCC
>
> rcpt.lpszName = hb_parc( 6 ) ; // Reciepient's Name, e.g.,
> pepe@hotmail.com
>
> rcpt.lpszAddress = hb_parc( 7 ) ; // Reciepient's Address
>
> rcpt.ulEIDSize = 0 ; // Count in bytes of size of
> pEntryID
>
> rcpt.lpEntryID = 0 ; // System-specific Recipient
> reference
>
> file.ulReserved = 0 ; // Reserved for future usage
>
> file.flFlags = 0 ; // Flags ?
>
> file.nPosition = -1 ; // Character of text to be
> replaced by attachment
>
> file.lpszPathName = hb_parc( 8 ) ; // Full Path Name with
> Extension of the attached file
>
> file.lpszFileName = 0 ; // Original File Name (
> optional )
>
> file.lpFileType = 0 ; // Attachment file type (
> can be lpMapiFileTagExt )
>
> mssg.ulReserved = 0 ; // Reserved
>
> mssg.lpszSubject = hb_parc( 2 ) ; // Message Subject
>
> mssg.lpszNoteText = hb_parc( 3 ) ; // Message Text
>
> mssg.lpszMessageType = 0 ; // Message Class
>
> mssg.lpszDateReceived = 0 ; // in yyyy/mm/dd hh:mm
> format
>
> mssg.lpszConversationID = 0 ; // Conversation thread ID
>
> mssg.flFlags = MAPI_LOGON_UI | MAPI_NEW_SESSION; //
> unread, return receipt
>
> mssg.lpOriginator = &orig ; // Originator's descriptor
>
> mssg.nRecipCount = 1 ; // Number of receipients
>
> mssg.lpRecips = &rcpt ; // Recipient descriptors
>
> mssg.nFileCount = 1 ; // Number of file
> attachments
>
> mssg.lpFiles = &file ; // Attachment descriptors
>
> // Load the DLL at runtime
>
> hMAPILib = ::LoadLibrary("MAPI32.DLL");
>
> if (!hMAPILib)
>
> {
>
> hb_retnl( 101 ); // failed
>
> return;
>
> }
>
> if (!(pMAPILogon = (LPMAPILOGON) GetProcAddress (hMAPILib,
> "MAPILogon")))
>
> {
>
> hb_retnl( 102 ); // failed
>
> return;
>
> }
>
> if (!(pMAPISendMail = (LPMAPISENDMAIL) GetProcAddress (hMAPILib,
> "MAPISendMail")))
>
> {
>
> hb_retnl( 103 ); // failed
>
> return;
>
> }
>
> if (!(pMAPILogoff = (LPMAPILOGOFF) GetProcAddress (hMAPILib,
> "MAPILogoff")))
>
> {
>
> hb_retnl( 104 ); // failed
>
> return;
>
> }
>
> // logon
>
> if (pMAPILogon(0, NULL, NULL, MAPI_LOGON_UI | MAPI_NEW_SESSION, 0,
> &hSession) != SUCCESS_SUCCESS)
>
> {
>
> hb_retnl( 105 ); // Logon failed
>
> return;
>
> }
>
> // Send email using the MAPISendMail API function
>
> if (nModoDialog == 0)
>
> {
>
> hb_retnl (pMAPISendMail(hSession, 0, &mssg, 0, 0)) ;
>
> }
>
> else
>
> {
>
> if (nModoDialog == 8)
>
> {
>
> hb_retnl (pMAPISendMail(hSession, 0, &mssg, MAPI_DIALOG, 0)) ;
>
> }
>
> else
>
> {
>
> hb_retnl( 108 ); // invalid parameter
>
> }
>
> }
>
> // Logoff session
>
> pMAPILogoff(hSession, 0, 0, 0);
>
> // Free DLL
>
> ::FreeLibrary(hMAPILib);
>
> return;
>
> }
>
> #pragma ENDDUMP