Page 1 of 1
a problem when send message to intellicad
Posted: Thu Jun 05, 2008 9:44 pm
by wuzixiao
Hello everyone
i have a problem when i send message to intellicad with ::sendmessageA in a .exe file.
the message content is "(command "script" "test.scr")\n"
intellicad receive the message, but it can't deal with "\n", just "(command "script" "test.scr") "showed on the intellicad.
i also tried "(command "script" "test.scr") ", the result is the same.
But it is ok for Autocad.
So, how can i send a "\n" to intellicad?
Thanks.
Posted: Fri Jun 06, 2008 7:13 am
by Danielm103
I think you would be better off using the COM interface.
Posted: Fri Jun 06, 2008 11:14 am
by efernal
try
"(command \"script\" \"test.scr\")\n"
Posted: Tue Jun 10, 2008 12:35 am
by wuzixiao
Danielm103 wrote:I think you would be better off using the COM interface.
yes, i think "using the com interface" is a good method. Can you give me a closer description of how to use it?
thanks.
Posted: Tue Jun 10, 2008 12:36 am
by wuzixiao
efernal wrote:try
"(command "script" "test.scr")\n"
thanks.
I have tried this. but it doesn't work....
Posted: Tue Jun 10, 2008 11:18 am
by Danielm103
wuzixiao wrote:Danielm103 wrote:I think you would be better off using the COM interface.
yes, i think "using the com interface" is a good method. Can you give me a closer description of how to use it?
thanks.
Here is an example of how to work with Intellicad’s com interface via C++
Code: Select all
#include "stdafx.h"
#include "atlbase.h"
#include "IcadTLB.h" //<-- you can find this in the API directory
int _tmain(int argc, _TCHAR* argv[])
{
//init
CoInitialize(NULL);
//get the application
CComPtr<IIcadApplication> application = NULL;
CLSID applicationClass;
CLSIDFromProgID( OLESTR("icad.application"), &applicationClass );
CComPtr<IUnknown> unknown;
HRESULT result = GetActiveObject( applicationClass, NULL, &unknown );
if( SUCCEEDED( result ) )
{
CComQIPtr<IIcadApplication> app = unknown;
application = app;
}
else
{
printf("Failed to get Application");
return -1;
}
//get the active document.. not needed here, but left it in as an example
CComPtr<IIcadDocument> document;
HRESULT hr = application->get_ActiveDocument( &document );
if(FAILED(hr))
{
printf("Failed to get active document");
return -1;
}
//make our BSTR
BSTR bstrScript = SysAllocString(L"C:/Spline.scr");
//run the sript
hr = application->RunScript(bstrScript);
if(FAILED(hr))
{
printf("Failed to run script");
}
SysFreeString(bstrScript);
return 0;
}
Posted: Tue Jun 10, 2008 7:58 pm
by wuzixiao
Danielm103 wrote:wuzixiao wrote:Danielm103 wrote:I think you would be better off using the COM interface.
yes, i think "using the com interface" is a good method. Can you give me a closer description of how to use it?
thanks.
Here is an example of how to work with Intellicad’s com interface via C++
Code: Select all
#include "stdafx.h"
#include "atlbase.h"
#include "IcadTLB.h" //<-- you can find this in the API directory
int _tmain(int argc, _TCHAR* argv[])
{
//init
CoInitialize(NULL);
//get the application
CComPtr<IIcadApplication> application = NULL;
CLSID applicationClass;
CLSIDFromProgID( OLESTR("icad.application"), &applicationClass );
CComPtr<IUnknown> unknown;
HRESULT result = GetActiveObject( applicationClass, NULL, &unknown );
if( SUCCEEDED( result ) )
{
CComQIPtr<IIcadApplication> app = unknown;
application = app;
}
else
{
printf("Failed to get Application");
return -1;
}
//get the active document.. not needed here, but left it in as an example
CComPtr<IIcadDocument> document;
HRESULT hr = application->get_ActiveDocument( &document );
if(FAILED(hr))
{
printf("Failed to get active document");
return -1;
}
//make our BSTR
BSTR bstrScript = SysAllocString(L"C:/Spline.scr");
//run the sript
hr = application->RunScript(bstrScript);
if(FAILED(hr))
{
printf("Failed to run script");
}
SysFreeString(bstrScript);
return 0;
}
thank you very much.
but i can't find "IcadTLB.h" in the dictionary api.
my intellicad version is intellicad2000
Posted: Tue Jun 10, 2008 9:12 pm
by Danielm103
Sorry, I don’t have that version to test this for you.
This would work with CMS IntelliCAD.

Posted: Wed Jun 11, 2008 11:12 pm
by wuzixiao
Danielm103 wrote:Sorry, I don’t have that version to test this for you.
This would work with CMS IntelliCAD.

Thanks anyway.
