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: ActiveX Component Canot Create Object in SaleslOgix.netExtension
venkat
Posts: 16
 
ActiveX Component Canot Create Object in SaleslOgix.netExtensionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Oct 09 2:22 AM
Hi to all,

I Create ClassLibrary with name Test and Added User Control Named it as User. In class1.cs I wrote Code...

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Sage.SalesLogix.NetExtensions.Licensing;
using Sage.SalesLogix.NetExtensions;

namespace Test
{

public class Class1 : Sage.SalesLogix.NetExtensions.BaseRunnable
{
public override object Run(object[] Args)
{

return null;
}
}
}


I had loader Class
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using Sage.SalesLogix.NetExtensions;

namespace Test
{
[ComVisible(true), ProgId("Test.USer")]
public class Loader
{
User _ctrl = null;
public void Init(object handle)
{
if (handle != null)
{
IntPtr hwnd = new IntPtr((int)handle);
if (_ctrl == null)
_ctrl = new User();
Win32.SetParent(_ctrl.Handle, hwnd);
ResizeControl(hwnd);
}
}
private void ResizeControl(IntPtr handle)
{
Win32.RECT rect;
Win32.GetWindowRect(handle, out rect);
if (Win32.GetWindowRect(handle, out rect) && _ctrl != null)
{
_ctrl.Size = rect.Size;
}
}
public string ID
{
set
{
if (_ctrl != null)
{
_ctrl.Name = value;
}
}
}
}
}

Win 32 Code..
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;


namespace Test
{
internal class Win32
{
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);

[Serializable, StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;

public RECT(int left_, int top_, int right_, int bottom_)
{
Left = left_;
Top = top_;
Right = right_;
Bottom = bottom_;
}

public int Height { get { return Bottom - Top; } }
public int Width { get { return Right - Left; } }
public Size Size { get { return new Size(Width, Height); } }
public Point Location { get { return new Point(Left, Top); } }

public Rectangle ToRectangle()
{ return Rectangle.FromLTRB(Left, Top, Right, Bottom); }

public static RECT FromRectangle(Rectangle rectangle)
{ return new RECT(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom); }

public static implicit operator Rectangle(RECT rect)
{ return Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom); }

public static implicit operator RECT(Rectangle rect)
{ return new RECT(rect.Left, rect.Top, rect.Right, rect.Bottom); }

public override int GetHashCode()
{
return Left ^ ((Top << 13) | (Top >> 0x13))
^ ((Width << 0x1a) | (Width >> 6))
^ ((Height << 7) | (Height >> 0x19));
}
}
}
}

User.Cs Code..

using System.Data.OleDb;
using System.IO;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;


namespace Test
{
public partial class User : UserControl
{
public User()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
label1.Text = "Welcome to SalesLogix";

}
}
}

User.Desginer.cs

namespace Test
{
partial class User
{
///
/// Required designer variable.
///

private System.ComponentModel.IContainer components = null;

///
/// Clean up any resources being used.
///

/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Component Designer generated code

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(43, 28);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(83, 95);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
//
// User
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Name = "User";
this.Size = new System.Drawing.Size(213, 150);
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
}
}

In Slx Architect I wrote Form open Event code like this

Dim loader
If Application.GlobalInfo.IndexOf("USerObject")= -1 Then
Set loader = CreateObject("Test.User")
loader.Init panelEmbed.HWND
Application.GlobalInfo.Add "USerObject", loader

Set loader = Nothing

Else
Set loader = Application.GlobalInfo("USerObject")

Set loader = Nothing
End If

I got Error ActiveX Component Canot Create Object .

I tried Another Way also but It does not throw any error but I didnot get Any thing..

i.e
Dim ext ' this variable will hold the handle for the loaded .NET Extension

' instanciate the .NET Extension
ext = Application.Managed.Create("SLX NET Extensions Test", "ClassLibrary1.Class1")

' run it (and pass any arguments)
Application.Managed.Run ext, "Hello from Architect"

' destroy the loaded .NET Extension
Application.Managed.Destroy ext

But It doesnot through Error But I didnot get Result...

Please help me It is very Urgent to me...

Regards,
Venkateswararao...


[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:45:31 PM