Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, February 19, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix .NET Extensions
Forum to discuss the use of .NET Extensions in SalesLogix version 7 and higher. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix .NET Extensions | New ThreadView:  Search:  
 Author  Thread: [SOLVED]: Application.Managed.Run() returns "nothing" - Cannot get the COM-object
Michael Seeger
Posts: 14
 
[SOLVED]: Application.Managed.Run() returns "nothing" - Cannot get the COM-objectYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Oct 09 9:53 AM
Hello,

I'm currently starting with .NET Extensions in SLX 7.5.1 working through Ryans examples ant trying to adapt them to "fit" into 7.5.1. The simple "Hello World" was no problem but when I tried to implement Ryans example from his screencast I got a little problem: Everything is working brilliant but I do not get any Instance when I process the Application.Managed.Run method. I made everything COM-visible in my .NET (C#) code .

The Run-Method of my "loader"-class (inherited from BaseRunnable) looks like this (Handle and HWnd are class-members!):

01: public override object Run(object[] Args)
02: {
03: Handle = -1;
04: if ((Args.Length > 0) && (Args[0] is Int32))
05: {
06: Handle = (Int32)Args[0];
07: }
08: if (Handle > 0) {
09: HWnd = new IntPtr(Handle);
10: if (MyEmbeddedControl == null)
11: {
12: MyEmbeddedControl = new MyControl2Embed();
13: Win32.SetParent(MyEmbeddedControl.Handle, HWnd);
14: ResizeControl (HWnd);
15: }
16: }
17: return this;
18: }

And here is the VBS-Code I use:

01: Sub AXFormChange(Sender)
02: dim MyEmbeddedControlHandle, MyEmbeddedControl
03:
04: if Application.GlobalInfo.IndexOf("MyEmbeddedControl") = -1 then
05:
06: MyEmbeddedControlHandle = Application.Managed.Create("SC", "SLX.NET.MySecondControl")
07: Set MyEmbeddedControl = Application.Managed.Run(MyEmbeddedControlHandle, Form.HWND)
08: Application.Managed.Run MyEmbeddedControlHandle, Args
09: Application.GlobalInfo.Add "MyEmbeddedControl", MyEmbeddedControl
10:
11: else
12:
13: Set MyEmbeddedControl = Application.GlobalInfo("MyEmbeddedControl")
14:
15: end if
16:
17: MyEmbeddedControl.AccountID = Application.BasicFunctions.CurrentAccountID
18:
19: End Sub

When I debug the Script with VS2008 the "MyEmbeddedControl"-variable will be shown with the value "{...}" ... right after executing the "Run"-method. And so the assignment to the MyEmbeddedControl.AccountID fails and I'm not able to react on resizing of the parent form because there is no reference to the instance of MyEmbeddedControl

Hope someone can help.

Michael.

P.S.: I also considered the article from Nicolas (http://blog.chivinou.net/2008/09/17/1st-saleslogix-net-extension/).
[Reply][Quote]
Michael Seeger
Posts: 14
 
[SOLVED]: Application.Managed.Run() returns "nothing" - Cannot get the COM-objectYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Oct 09 6:13 AM
Hi,

I solved the problem myself: In the Run-method of my loader-class I returned the loader-class itself (return this). But I must not "return this". Somehow COM cannot handle "this". So when I return the instance of the user control which I instantiate in my loader (return this.MyEmbeddedControl) I'm able to access all the public members of my control

I also encountered that the Application.GlobalInfo is not capable of "keeping" my control instance. So I'm using global variables now. This has the pretty side-effect that multiple instances of my control can be instanciated, for example as a "normal" tab and as a tab called from the "More Tabs..."-Tab. And I'm also able to drag a tab into the middle-view

Oh: I forgot to mention that I now only make the assembly(!) COM-visible via its assembly-information-settings.

I hope this will help others to win the struggle against the SLX.NET Extension.

Best Regards!

Michael.

P.S.: Thanks to Nicolas Galler. The decisive hint was hidden in his article !!!
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 2/19/2025 4:34:40 PM