Click here to Skip to main content
16,008,075 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to Visual c++ program in another computer that haven't visual c++? Pin
Krouer10-Dec-01 22:43
Krouer10-Dec-01 22:43 
AnswerRe: how to Visual c++ program in another computer that haven't visual c++? Pin
moliate11-Dec-01 2:18
moliate11-Dec-01 2:18 
AnswerRe: how to Visual c++ program in another computer that haven't visual c++? Pin
Carlos Antollini11-Dec-01 3:05
Carlos Antollini11-Dec-01 3:05 
GeneralStack Overflow Problem Pin
haris10-Dec-01 21:19
haris10-Dec-01 21:19 
GeneralRe: Stack Overflow Problem Pin
Krouer10-Dec-01 22:56
Krouer10-Dec-01 22:56 
GeneralRe: Stack Overflow Problem Pin
Alvaro Mendez11-Dec-01 5:55
Alvaro Mendez11-Dec-01 5:55 
GeneralProblem with Popup Window ( Open in new window...OnNewWindow2 function ) Pin
10-Dec-01 21:01
suss10-Dec-01 21:01 
GeneralUrgent! Problem with MSWord component! Pin
tuyle10-Dec-01 20:49
tuyle10-Dec-01 20:49 
I use MSWord component in my project. I create a new MSWord document with name such as "d:\temp\mydoc1.doc" from template (example mytempate.dot). This template contain a macro to insert a text into document.

It runs OK even there are some MSWord applications (instances) currently open unless "mydoc1.doc"

Please see these codes:



int ret = NO_ERR;
CString strMacroName;
CStringList argList;

strMacroName = _T("LC_WriteText");
argList.AddHead("This is a text");

ret = CallMacro(strMacroName,&argList);

........

int CExportMSWord::CallMacro(CString& strMacroName, CStringList* pArgList)
{
int bRetVal = NO_ERR;
HRESULT hr = S_OK;
ASSERT(m_pWrdDoc != NULL && m_pWrdDoc->m_lpDispatch != NULL);

OLECHAR FAR* strMacro = strMacroName.AllocSysString();
DISPID dispid;

// Error occurs here
hr = m_pWrdDoc->m_lpDispatch->GetIDsOfNames(IID_NULL, &strMacro, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
SysFreeString(strMacro);
if (FAILED(hr))
bRetVal = UNABLE_CALL_MACRO;

//Some codes....

}


Now I create a new document (mydoc2.doc) from template.dot. Initialize MSWord OK! Create new document OK.

When there is a document which was created from mytemplate.dot (mydoc1.doc) currently open, after executing CallMacro, hr = DISP_E_UNKNOWNNAME!

But if I close "mydoc1.doc", execute again, CallMacro runs OK (hr = S_OK).

Could you tell me what problem and how to fix it??

Thanks in advance
Tuy Le


GeneralRe: Urgent! Problem with MSWord component! Pin
Youknowme10-Dec-01 23:26
Youknowme10-Dec-01 23:26 
GeneralMFC DLL : linking error with message map Pin
10-Dec-01 19:40
suss10-Dec-01 19:40 
GeneralRe: MFC DLL : linking error with message map Pin
Steen Krogsgaard10-Dec-01 22:10
Steen Krogsgaard10-Dec-01 22:10 
GeneralInterprocess interacting Pin
10-Dec-01 17:25
suss10-Dec-01 17:25 
GeneralRe: Interprocess interacting Pin
Ravi Bhavnani10-Dec-01 17:40
professionalRavi Bhavnani10-Dec-01 17:40 
GeneralRe: Interprocess interacting Pin
Morozov Alexey10-Dec-01 17:48
Morozov Alexey10-Dec-01 17:48 
GeneralRe: Interprocess interacting Pin
Nish Nishant10-Dec-01 20:24
sitebuilderNish Nishant10-Dec-01 20:24 
GeneralRe: Interprocess interacting Pin
Morozov Alexey10-Dec-01 20:34
Morozov Alexey10-Dec-01 20:34 
GeneralRe: Interprocess interacting Pin
Nish Nishant10-Dec-01 20:44
sitebuilderNish Nishant10-Dec-01 20:44 
GeneralRe: Interprocess interacting Pin
Richard Ellis11-Dec-01 14:39
Richard Ellis11-Dec-01 14:39 
GeneralRe: Interprocess interacting Pin
Michael P Butler10-Dec-01 21:59
Michael P Butler10-Dec-01 21:59 
GeneralRe: Interprocess interacting Pin
10-Dec-01 22:52
suss10-Dec-01 22:52 
GeneralAIM interfacing... Pin
Cam10-Dec-01 16:53
Cam10-Dec-01 16:53 
Questionwhy like this? Pin
cococut10-Dec-01 15:30
cococut10-Dec-01 15:30 
AnswerRe: why like this? Pin
Christian Graus10-Dec-01 15:38
protectorChristian Graus10-Dec-01 15:38 
AnswerRe: why like this? Pin
Christian Graus10-Dec-01 15:42
protectorChristian Graus10-Dec-01 15:42 
AnswerRe: why like this? Pin
Michael Dunn10-Dec-01 16:41
sitebuilderMichael Dunn10-Dec-01 16:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.