web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AX 2009 - Spell Checker in .NET and use as an ActiveX in AX

(0) ShareShare
ReportReport
Posted on by 115

Hi All,

In continuation of my previous thread https://community.dynamics.com/ax/f/33/t/183420 I want to ask few more questions based on suggested answers on my previous thread and after my learning. 

I created a visual studio project of Class Library type and added a WPF textbox control into it. Changed properties of the control so it can show scroll bar and wrap text as shown;

5466.Untitled1.png

I build this project and copied DLL into C:\Program Files (x86)\Microsoft Dynamics AX\50\Client\Share\Include folder. I also copied this DLL into C:\Windows\System32 folder and the register this DLL using following command and it registered successfully. 

1263.Untitled.png

I made following changes to AX to use this control on AX form and to deploy this DLL automatically on each client rather registering it using command.

Added a new Class with name test_sysFileDeployment extends SysFileDeploymentDLL

class test_sysFileDeployment extends SysFileDeploymentDLL
{
#Define.regasmCommand(@'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe')
}

public Filename filename()
{
return 'SpellCheckerCtrl.dll';
}

protected void register(boolean atReboot)
{
int handle;
#winapi

;

WinAPI::setCurrentDirectory(this.destinationPath());
//TODO Check regasm executable exists on client
WinAPI::shellExecute(#regasmCommand, strfmt('"%1" %2', this.destinationPath()+this.filename(),'/codebase'));
}

protected void unRegister()
{
int handle;
#winapi

;

WinAPI::setCurrentDirectory(this.destinationPath());
//TODO Check regasm executable exists on client
WinAPI::shellExecute(#regasmCommand, this.destinationPath()+this.filename()+' /unregister');
}

Also updated the filesToDeploy method in SysFileDeployer Class as;

private static container filesToDeploy()
{;
return [classnum(test_SysFileDeploymentDLL)];

/*
return [classNum(class1), classNum(class2), ... ]
*/

}

I have also clear usage data and there is not value on usage data form now.

I added new Form and than added new ActiveX control and dont see my control to reference which I deployed through DLL.

Is there anything I am missing or Am I going it wrong ?

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Can you tell us how you implemented the ActiveX control? It's relatively complicated, so I'm surprised that you didn't mention it at all.

  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Also, did you test your ActiveX control in Visual Studio before trying to use it in AX? And did you try to use it in AX before investing time to implement automatic deployment?

    If you don't test things one by one, you may be wasting time by building on things that never worked and it's difficult to identify them when testing everything together.

  • AX QA Profile Picture
    115 on at

    Hi Martin,

    I placed the correct picture (picture 1) for how I implemented the ActiveX control. This is a simple class library project with one WPF textbox control where I set properties for textbox as shown. Build the project and get DLL which I later tried to use in AX.

  • AX QA Profile Picture
    115 on at

    Yes, I did try to add another control which I downloaded from this blog gregondax.wordpress.com/.../spell-check-text-box-example-of-a-wpf-control-in-ax along with .xpo project. I correctly pasted DLL into correct folders of AX and then it automatically deployed successfully.

    When I add new ActiveX control on a form in AX it shows me the class to choose which is related to this control.

    Can you guide me what else do you want me to test first and at what side (AX or .NET)?

  • Suggested answer
    Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    I asked you in the previous thread how you created the ActiveX control. You didn't bother to answer and creating a new thread doesn't make the question any less important.

    It seems that the answer is that you didn't create any ActiveX control at all; at least you never mentioned it and your picture doesn't show any. It shows a WPF controls, which isn't ActiveX.

    To use a WPF control as an ActiveX control, you have to first wrap the WPF control a WinForms control called ElementHost. Then you have to expose the WinForms control as an ActiveX control (see Code Project: Exposing Windows Forms Controls as ActiveX controls).

    You should consider whether it's worth doing and if it is, you should learn more about the technologies involved before you try to do your development.

  • AX QA Profile Picture
    115 on at

    Hi martin,

    I downloaded the example and used in AX it worked well thanks for this. Can you please explain me how can I wrap the WPF control a WinForms control called ElementHost. I created new Visual Studio project and added new User Control (WPF) in my project now I dont find any way to wrap this into elementhost. Please tell me, have I created the correct project in VS and added correct control ?

    If you can guide me in how to do this I would really appreciate. Please need your help

  • AX QA Profile Picture
    115 on at

    I also tried to add textbox into this sample code project and it worked well. But I want to add WFP textbox control into this project so I can set property for spell checking. TextBoxes does not have this property.

  • Suggested answer
    Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Please read How to: Host a Windows Presentation Foundation Control in Windows Forms by Using ElementHost on MSDN. If needed, ask in an appropriate forum.

  • Community Member Profile Picture
    on at

    Did you get this to work?

  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Yes, I used it in past.

    Note that it's about AX 2009. If you're using AX 2012, you don't need the ActiveX wrapper anymore - you can use the managed host control.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans