ActiveX in Axapta

The Microsoft Axapta Object Server supports Microsoft’s COM (Common Object Model), DCOM (Distributed Common Object Model) and ActiveX controls. This enables Microsoft Axapta to use the advanced flexible COM technology either directly or indirectly using third party applications.
In AX, each ActiveX control will be having a classId. This entry will exaplain you how to use html document ActiveX control in Axapta.
How to add ActiveX control to your form 
  • create form by Name MyActiveXExample
  • MyActiveXExample– > design – > New control -> ActiveX
  • Select html document ActiveX control from the list of activex’s displayed by Ax and name the newActiveX control as HtmlActiveX.
  • Make the Autodeclaration property of the newly created ActiveX control to Yes
  • After that , if you want to display html content in that Activex Control,
  • Add the below code in the init() method of your MyActiveXExample form

public void init()


str htmlSource;
COMDispFunction webpreviewWrite;
COMVariant text = new COMVariant();
COM ctrl = new COM();


htmlSource = @’ <html><pre><hr color="#99CCFF">
Search in Google
<FORM method=GET action="">
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="">
<IMG SRC="" <br></A>
<INPUT TYPE=text name=q size=31 maxlength=255 value="">
<INPUT TYPE=hidden name=hl value="en">
<INPUT type=submit name=btnG VALUE="Google Search">
<hr color="#99CCFF"></html>’;


webpreviewWrite = new COMDispFunction(ctrl, ‘write’, COMDispContext::METHOD);



 The above code will allow use to browse through google without opening the web page , becasue i added the html controls and the functionalites to the controls to search in google.

I have mapped the htmlActiveX control to my Com object and i am writing the html string to the comVariant. Open ActiveX control by .open() method.  Finally i am calling my comdispFunction object i.e to open the content in the Activex. Then i closed my ActiveX control by using .close() method
Then if you open the form You will see the result as below

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: