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.
#6
Here is an example of how to work with Intellicad’s com interface via C++wuzixiao wrote:yes, i think "using the com interface" is a good method. Can you give me a closer description of how to use it?Danielm103 wrote:I think you would be better off using the COM interface.
thanks.
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;
}
#7
thank you very much.Danielm103 wrote:Here is an example of how to work with Intellicad’s com interface via C++wuzixiao wrote:yes, i think "using the com interface" is a good method. Can you give me a closer description of how to use it?Danielm103 wrote:I think you would be better off using the COM interface.
thanks.
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; }
but i can't find "IcadTLB.h" in the dictionary api.
my intellicad version is intellicad2000