|
Thanks for your reply. I got it.
|
|
|
|
|
Hi
I am a new comer in C++. I have an MFC application that using some header files and libraries. I set the 'additional library directories' and 'additional include directories' in project settings. But whenever I want to make an instance of one of those classes I get this error:
error C2259: cannot instantiate abstract class due to the following members: ....
It is wierd as it works in another project same as this one, and there are some other classes in the lib files as this class, but the error doesn't occur in those conditions.
I know the concept of abstract class. Please help me in advanse.
Thanks
|
|
|
|
|
Well, something must be different between your new application and the older ones - otherwise the error wouldn't occur. You need to identify what's different. Start with the error messages. What methods are they telling you aren't implemented? That tells you what to look for in the older projects where those things do work.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
hi all,
I m creating a Win32 smart device project. and using this code for message sending but i have got debug assertion failed in file atlcomcli.h at line 149 and 154.
HRESULT GetSMSMsgStore(const CComPtr<IMAPISession>& spSession, CComPtr<IMsgStore>& spMsgStore)
{
CComPtr<IMAPITable> spTable;
HRESULT hr = spSession->GetMsgStoresTable(MAPI_UNICODE, &spTable);
if (FAILED(hr))
{
AfxMessageBox(IDS_SMS_FAIL_MSGSTORE_TABLES);
return FALSE;
}
while (TRUE)
{
SRowSet* pRowSet = NULL;
hr = spTable->QueryRows(1, 0, &pRowSet);
if (FAILED(hr))
{
AfxMessageBox(IDS_SMS_FAILEDTABLE);
break;
}
if (pRowSet->cRows == 1)
{
ASSERT(pRowSet->aRow[0].lpProps->ulPropTag == PR_ENTRYID);
SBinary& blob = pRowSet->aRow[0].lpProps->Value.bin;
hr = spSession->OpenMsgStore(NULL, blob.cb, (LPENTRYID)blob.lpb, NULL, 0, &spMsgStore);
if (FAILED(hr))
AfxMessageBox(IDS_SMS_FAILED_OPENMSGSTORE);
}
else
{
AfxMessageBox(IDS_SMS_MSGSTORENOTFOUND);
hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
}
FreeProws(pRowSet);
if (FAILED(hr))
{
break;
}
SPropTagArray props;
props.cValues = 1;
props.aulPropTag[0] = PR_DISPLAY_NAME;
ULONG cValues;
SPropValue* pProps = NULL;
hr = spMsgStore->GetProps(&props, MAPI_UNICODE, &cValues, &pProps);
if (FAILED(hr) || cValues != 1)
{
AfxMessageBox(IDS_SMS_FAILED_GETNAME);
break;
}
if (_tcsicmp(pProps[0].Value.lpszW, _T("SMS")) == 0)
{
break;
}
}
if (FAILED(hr))
{
spMsgStore.Release();
}
return hr;
}
HRESULT GetSMSFolder(const CComPtr<IMsgStore>& spMsgStore, CComPtr<IMAPIFolder>& spFolder)
{
SPropTagArray propDefaultFolder;
propDefaultFolder.cValues = 1;
propDefaultFolder.aulPropTag[0] = PR_CE_IPM_DRAFTS_ENTRYID;
ULONG cValues;
LPSPropValue pPropVals;
HRESULT hr = spMsgStore->GetProps (&propDefaultFolder, MAPI_UNICODE, &cValues, &pPropVals);
if (FAILED(hr))
{
AfxMessageBox(IDS_SMS_FOLDERNOTFOUND);
return hr;
}
SBinary& eidDrafts = pPropVals->Value.bin;
hr = spMsgStore->OpenEntry(eidDrafts.cb, (LPENTRYID)eidDrafts.lpb, NULL, MAPI_MODIFY, NULL, (LPUNKNOWN*)&spFolder);
if (FAILED(hr))
{
AfxMessageBox(IDS_SMS_FOLDERNOTOPENED);
}
return hr;
}
HRESULT SendSMSMessage(const CComPtr<IMAPISession>& spSession, LPCTSTR lpszFrom, LPCTSTR lpszTo, LPCTSTR lpszMessage)
{
CComPtr<IMsgStore> spMsgStore;
HRESULT hr = GetSMSMsgStore(spSession, spMsgStore);
if (FAILED(hr))
{
return hr;
}
CComPtr<IMAPIFolder> spFolder;
hr = GetSMSFolder(spMsgStore, spFolder);
if (FAILED(hr))
{
return hr;
}
CComPtr<IMessage> spMessage;
hr = spFolder->CreateMessage(NULL, 0 ,&spMessage);
if (FAILED(hr))
{
AfxMessageBox(IDS_SMS_FAIL_CREATEMESSAGE);
return hr;
}
SPropValue propRecipient[3];
ZeroMemory(&propRecipient, sizeof(propRecipient));
propRecipient[0].ulPropTag = PR_RECIPIENT_TYPE;
propRecipient[0].Value.l = MAPI_TO;
propRecipient[1].ulPropTag = PR_ADDRTYPE;
propRecipient[1].Value.lpszW = _T("SMS");
propRecipient[2].ulPropTag = PR_EMAIL_ADDRESS;
propRecipient[2].Value.lpszW = (LPWSTR)lpszTo;
ADRLIST adrlist;
adrlist.cEntries = 1;
adrlist.aEntries[0].cValues = 3;
adrlist.aEntries[0].rgPropVals = (LPSPropValue)(&propRecipient);
hr = spMessage->ModifyRecipients(MODRECIP_ADD, &adrlist);
if (FAILED(hr))
{
AfxMessageBox(IDS_SMS_FAILED_ADDRECIPIENTS);
return hr;
}
else
;
SPropValue props[4];
ZeroMemory(&props, sizeof(props));
props[0].ulPropTag = PR_SUBJECT;
props[0].Value.lpszW = (LPWSTR)lpszMessage;
props[1].ulPropTag = PR_SENDER_EMAIL_ADDRESS;
props[1].Value.lpszW = (LPWSTR)lpszFrom;
props[2].ulPropTag = PR_MSG_STATUS;
props[2].Value.ul = MSGSTATUS_RECTYPE_SMS;
props[3].ulPropTag = PR_MESSAGE_FLAGS;
props[3].Value.ul = MSGFLAG_FROMME | MSGFLAG_UNSENT;
hr = spMessage->SetProps(sizeof(props) / sizeof(props[0]), (LPSPropValue)&props, NULL);
if (FAILED(hr))
{
AfxMessageBox(IDS_SMS_FAIL_SETPROPS);
return hr;
}
hr = spMessage->SubmitMessage(0);
if (FAILED(hr))
{
AfxMessageBox(IDS_SMS_FAIL_SUBMITMSG);
return hr;
}
return FALSE;
}
i m not able to debug because this error comes in Pocket pc emulator.
if i retry the message send successfully.
please help me to remove thease errors.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
but where in your ocde are the asserts happening. It can be that the objects arent ready to work.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
its comes here
hr = spSession->OpenMsgStore(NULL, blob.cb, (LPENTRYID)blob.lpb, NULL, 0, &spMsgStore);
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Stuart Dootson has written, what I thought about...
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I'm faster than the speed of light, I am
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
here the assert point out the line 149.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
"_$h@nky_" wrote: i have got debug assertion failed in file atlcomcli.h at line 149 and 154.
Those both occur in the line you mentioned before (hr = spSession->OpenMsgStore(NULL, blob.cb, (LPENTRYID)blob.lpb, NULL, 0, &spMsgStore); )?
Well, if you're using the same version of atlcomcli.h as me (VS2008), then the first assertion (@line 149) means that spMsgStore already has a value, which you are overwriting. Either Release or Detach the pointer before this line (you probably need Release, I suspect) and the second assertion (@line 154) is because you're calling operator-> on a null smart pointer, which would imply that spSession is null (but then why did the previous call on spSession not fail....)?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i m using this before the specified line
spMsgStore->Release();
but it gives error
error C2248: 'ATL::_NoAddRefReleaseOnCComPtr<T>::Release' : cannot access private member declared in class 'ATL::_NoAddRefReleaseOnCComPtr<T>'
1> with
1> [
1> T=IMsgStore
1> ]
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\ce\atlmfc\include\atlcomcli.h(87) : see declaration of 'ATL::_NoAddRefReleaseOnCComPtr<T>::Release'
1> with
1> [
1> T=IMsgStore
1> ]
so please help me for this.
thanks.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Try spMsgStore.Release
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi All
i have
_variant_t data type variable,which have contain 10 values.Like this
[0,0] = BSTR = 0x0017a66c "Name"
[0,1] = BSTR = 0x0017a6ec "Age"
[0,2] = BSTR = 0x0017a6ec "Class"
...
data is a SAFEARRAY containing BSTR elements.so how can i convert _variant_ to CStringArray?
Plz help me
|
|
|
|
|
See for instance [^].
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]
|
|
|
|
|
There are useful classes wrapping SAFEARRAYs - see here[^] and here[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanks for reply but it's not helpfull for my problem.So plz help me
|
|
|
|
|
Those links are actually helpful, because they give you C++ wrappers for SAFEARRAYs that will simplify the job of converting the SAFEARRAY to some other array of strings.
CComSafeArray<BSTR> safearrayOfBstr(((VARIANT)data).parray);
will wrap the SAFEARRAY contained in the VARIANT.
You can then use the CComSafeArray methods to access the SAFEARRAY data.
This article[^] is very useful, because it gives easier access to 2D SAFEARRAYs, which is what you've got here.
Thing is, it's up to you to do that final step of converting to your CStringArray - but all you need to do is iterate through the relevant elements of the SAFEARRAY, extract the BSTR, convert it to a CString and store that in your CStringArray - not tricky, really!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello All,
I am using wua api.
1)using IupdateSearcher->Searcher I am searching updates that are require,
2)After that I getting download url of respective updates.
3)using UrlDownloadToFile i am downloading .exe .cab .psf file for respective updates.
Now I want to install these file to PC (.exe,.psf,.cab) how should I do please help me.
I know i updates install but I want to do it above way.
Thank You All,
ashish p.
|
|
|
|
|
exe is obvious - run it with ShellExecute or CreateProcess.
A cab file is an archive that needs to be unpacked before you run some installer inside it.
No idea what a PSF file is?!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for reply
cab file containing many ._p Files ,manifest file, psm file
|
|
|
|
|
Well, work out what you would do to install them manually and replicate that. It's not rocket science. Think about it.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello,
For example, I have files with sorted numbers. One way to merge them and save a sorted order is to use a merge sort algorithm. Where a C++ realization of the algorithm (for files, not for memory) can be found ?
|
|
|
|
|
alikalik wrote: Where a C++ realization of the algorithm (for files, not for memory) can be found ?
For instance you may develp it. You are a developer, aren't you?
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]
|
|
|
|
|