|
Pigeons are quite effective.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I'll try an answer: Write a socket client that implements at least RFC 5321 and RFC 4954, both protocols are typically needed to be able to send emails.
Alternatively use a networking library that offers an SMTP client/example (e.g. libcurl, PichatCore, QT), the code to send an email could look like this:
CClientSmtp client;
client.SetRequestServer("mail.example.com", 25, "example.com");
client.SetRequestEnvelope("sender@example.com", "receipient@example.com");
client.SetRequestData("Subject:Test email\n\nHi! I am hungry, please send some pizza.");
client.Request();
You need to decide if you want to implement everything yourself or take an existing C++ library. First will teach you a lot about networking protocols, later gives you the result right away. Hope this helps!
/M
|
|
|
|
|
Hi,
If I have today date. How can I get date before 7 or 10 days?
My means to say Using number of days, how to calculate preoius date from the current date?
|
|
|
|
|
Take a look at the documentation of COleDateTime and COleDateTimeSpan.
|
|
|
|
|
what is the format of time you are having? If in MFC its easy to use CTime and CTimeSpan classes.
psuedo code:
CTime curTime(...);
CTimeSpan span(7, 0,...);
Ctime newTime = curTime - span;
|
|
|
|
|
Plz tell me how to do that?
If I want to get date before 7 days from current date?
How to do that?
|
|
|
|
|
Wow, you really need glasses because he even provided a code snippet showing exactly how to do it...
|
|
|
|
|
Bijo Pulikkottil wrote: If I have today date.
Based on what? Is it a CTime object? Is it a time_t variable? If you have the number of seconds since some epoch, can't you just subtract 86400 * 7 seconds?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi all,
i m using to Excel automation to read and write excel files.
i write excel file like this.
CoInitialize(NULL);
{
Excel::_ApplicationPtr XL;
HRESULT hr;
try
{
XL.CreateInstance(L"Excel.Application");
_variant_t var((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
XL->Workbooks->Add(Excel::xlWorksheet);
Excel::_WorksheetPtr pSheet = XL->ActiveSheet;
Excel::RangePtr pRange = pSheet->Cells;
Excel::RangePtr pBeginRange = pRange->Item[1][1];
Excel::RangePtr pEndRange = pRange->Item[1][1];
Excel::RangePtr pTotalRange = pSheet->Range[(Excel::Range*)pBeginRange][(Excel::Range*)pEndRange];
wchar_t wsz1[] = L"C";
wchar_t wsz2[] = L"D";
BSTR bstr1;
bstr1 = SysAllocString(wsz1);
BSTR bstr2;
bstr2 = SysAllocString(wsz2);
SAFEARRAYBOUND rgsabound[2] = { 0 };
rgsabound[0].cElements = 1;
rgsabound[0].lLbound = 0;
rgsabound[1].cElements = 1;
rgsabound[1].lLbound = 0;
VARIANT arr;
arr.vt = VT_ARRAY | VT_BSTR;
arr.parray = SafeArrayCreate(VT_BSTR,2,rgsabound);
long index[2];
index[0] = 0;
index[1] = 0;
hr = SafeArrayPutElement(arr.parray,index,bstr1);
pTotalRange->PutValue2(&arr);
VariantClear(&arr);
SysFreeString(bstr1);
SysFreeString(bstr2);
XL->Visible = true;
}
catch(_com_error &error)
{
cout << "COM error " << endl;
}
}
CoUninitialize();
when i write excel file i received this error
0x800706F7
"the stub received bad data"
please tell me how can i solve it.
thanks in advance.
|
|
|
|
|
if you have #imported the correct dlls and olbs for the installed version of Excel, everything seems fine.
|
|
|
|
|
This happens when i run application on Office 2010 Beta version.while i run application on office 2007 its working fine.
|
|
|
|
|
Hi sir,
I want to create a DSN Name and set a path for that.
I am using "SQLConfigDataSource" function for this.
It is not giving any error and running properly.But it is not writing to DNS.
Here ia wat i am doing
SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, _T("Microsoft Access Driver (*.mdb)\0"), _T("DSN=SAMPLEE\0DBQ=D:\\SAMPLE.mdb\0"));
Am i doing right???or any other stuff need to be done.
Thanks
Raj
|
|
|
|
|
Did you check the return value?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I tried with this
bool aDSNCreated = false;
aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, _T("Microsoft Access Driver (*.mdb)\0"), _T("DSN=SAMPLEE\0DBQ=D:\\SAMPLE.mdb\0"));
printf("%d",aDSNCreated );
aDSNCreated value is zero.
what i am doing wrong??
Thanks
Raj
|
|
|
|
|
From MSDN[^]:
When SQLConfigDataSource returns FALSE, an associated *pfErrorCode value can be obtained by calling SQLInstallerError. The following table lists the *pfErrorCode values that can be returned by SQLInstallerError and explains each one in the context of this function.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi sir.
CPallini wrote: an associated *pfErrorCode value can be obtained by calling SQLInstallerError
I am not getting how to get the errorcode.I am trying as below
bool aDSNCreated = false;
RETCODE retcode= SQL_SUCCESS;
aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, _T("Microsoft Access Driver (*.mdb)\0"), _T("DSN=SAMPLEE\0DBQ=D:\\SAMPLE.mdb\0"));
printf("%d",aDSNCreated );
if(aDSNCreated == false)
{
retcode = SQLInstallerError(2, NULL,NULL,100,NULL);
}
I am not getting wat paramaters to send and return the error code..
please help me out.
Sorry i know its a very silly question.
Thanks
Raj
|
|
|
|
|
I would do:
BOOL isDSNCreated;
isDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, _T("Microsoft Access Driver (*.mdb)\0"), _T("DSN=SAMPLEE\0DBQ=D:\\SAMPLE.mdb\0"));
if (isDSNCreated == FALSE)
{
CHAR szError[SQL_MAX_MESSAGE_LENGTH];
DWORD dwError;
WORD cbError;
RETCODE retcode;
retcode = SQLInstallerError(1, &dwError, szError, SQL_MAX_MESSAGE_LENGTH-1, &cbError);
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: retcode = SQLInstallerError(1, &dwError, szError, SQL_MAX_MESSAGE_LENGTH-1, &cbError);
Hi sir,
I am getting this error:
Error 47 error C2664: 'SQLInstallerErrorW' : cannot convert parameter 3 from 'CHAR [512]' to 'LPWSTR'
Thanks
Raj
|
|
|
|
|
The use:
<big>TCHAR</big> szError[SQL_MAX_MESSAGE_LENGTH];
DWORD dwError;
WORD cbError;
RETCODE retcode;
retcode = SQLInstallerError(1, &dwError, szError, SQL_MAX_MESSAGE_LENGTH-1, &cbError);
<small>If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.<br>
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
<br></small><small><a href="http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=1778670">[My articles]</a></small>
|
|
|
|
|
Hi sir,
Thank you.Its building without error.
I am getting the retcode as zero(i.e SQL_SUCCESS).
But i am not finding the DSN Created when i am checking through Control Panel->ODBC
Thanks
Raj
|
|
|
|
|
How can I store an position of point ( point of end/begin of an line ) which is within an rect ?
void CSelectTool::OnLButtonDown(CNetMapView* pView, UINT nFlags, const CPoint& point)
{
CRect rect = m_Tracker.m_rect;
...
CPoint ptLine;
if(rect.PtInRect(rectLine.TopLeft()))ptLine = rectLine.TopLeft();
if(rect.PtInRect(rectLine.BottomRight()))ptLine = rectLine.BottomRight();
...
}
now I need ptLine value in follow event :
void CSelectTool::OnMouseMove(CNetMapView* pView, UINT nFlags, const CPoint& point)
{
CRect rect = m_Tracker.m_rect;
}
|
|
|
|
|
If I got you then you have to move the line of the same amount of the rectangle. i.e.
- Store the original position of the rectangle.
- On mouse move, subtract to current rectangle position the stored one, to obtain the offset.
- add the offset to the line.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Can you tell me how to insert / acces an struct elements from another class then declare it ?
...
...
typedef struct tagLine{
CDrawObj* pObj;
UINT nHandle;
CPoint point;
}Line;
...
...
CList<<Line,Line>> m_line;
...
void CSelectTool::OnLButtonDown(CMyView* pView, UINT nFlags, const CPoint& point)
{
pView->m_line.AddTail(pView->Line(pObj,1,point));
}
void CSelectTool::OnMouseMove(CMyView* pView, UINT nFlags, const CPoint& point)
{
}
Can you help me please ? Thank you !!!
modified on Wednesday, September 1, 2010 2:51 AM
|
|
|
|
|
Try something like following :
...
typedef struct tagLine {
int m_i1, m_i2;
Line(int i1, i2) : m_i1(i1), m_i2(i2) {};
} Line;
...
void CMyView::AddNewLine(int i1, int i2)
{
m_Line.AddTail(new Line(i1, i2));
}
virtual void BeHappy() = 0;
|
|
|
|
|
Ok , and when I want to acces an element of m_Line ?
|
|
|
|