error C2664: 'IPersistFile::Save' : cannot convert parameter 1 from 'CString' to 'LPCOLESTR'.
-
Hi all, I am using IPersistFile::Save Method. My problem is i am passing a CString variable in this function and compiler is giving error C2664: 'IPersistFile::Save' : cannot convert parameter 1 from 'CString' to 'LPCOLESTR'.
hres = ppf->Save(szLinkName,TRUE);
ppf>Release();szLinkName is a CString variable which is being passed in this function.. How can i convert it??? Thanks in advance
-
Hi all, I am using IPersistFile::Save Method. My problem is i am passing a CString variable in this function and compiler is giving error C2664: 'IPersistFile::Save' : cannot convert parameter 1 from 'CString' to 'LPCOLESTR'.
hres = ppf->Save(szLinkName,TRUE);
ppf>Release();szLinkName is a CString variable which is being passed in this function.. How can i convert it??? Thanks in advance
Try: Please tell my how to change from cstring to LPOLESTR and make my code right: [^]
-
Hi all, I am using IPersistFile::Save Method. My problem is i am passing a CString variable in this function and compiler is giving error C2664: 'IPersistFile::Save' : cannot convert parameter 1 from 'CString' to 'LPCOLESTR'.
hres = ppf->Save(szLinkName,TRUE);
ppf>Release();szLinkName is a CString variable which is being passed in this function.. How can i convert it??? Thanks in advance
-
Hi all, I am using IPersistFile::Save Method. My problem is i am passing a CString variable in this function and compiler is giving error C2664: 'IPersistFile::Save' : cannot convert parameter 1 from 'CString' to 'LPCOLESTR'.
hres = ppf->Save(szLinkName,TRUE);
ppf>Release();szLinkName is a CString variable which is being passed in this function.. How can i convert it??? Thanks in advance
try
CStringW wszLinkName(szLinkName);
hres = ppf->Save(wszLinkName,TRUE);
ppf>Release();:)
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] -
Before you pass your CString convert it into BSTR or LPCOLESTR const LPCOLESTR* pCole; int iLen = strlen(szLinkName); memcpy(pCole,szLinkName,iLen); hres = ppf->Save(pCole,TRUE); ppf->Release();
@Intersect☺™ wrote:
const LPCOLESTR* pCole; int iLen = strlen(szLinkName); memcpy(pCole,szLinkName,iLen); hres = ppf->Save(pCole,TRUE); ppf->Release();
Note the parts I've underlined. This code will cause nothing but trouble.
Steve
-
Hi all, I am using IPersistFile::Save Method. My problem is i am passing a CString variable in this function and compiler is giving error C2664: 'IPersistFile::Save' : cannot convert parameter 1 from 'CString' to 'LPCOLESTR'.
hres = ppf->Save(szLinkName,TRUE);
ppf>Release();szLinkName is a CString variable which is being passed in this function.. How can i convert it??? Thanks in advance
what about using
#define UNICODE 1
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You