CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2002
    Location
    Croatia
    Posts
    275

    ActiveX unexpected behaviour

    I'm surrprissed about ActiveX Form scope.

    I have two basically the same projects.
    1. MyAppA is an ActiveX exe server.
    2. MyApp is Standard exe, a client program.

    I have added a public class to MyAppA, class CMyAppA.

    I have started both projects in debug mode.
    Client MyApp creates a New obj As CMyAppA.
    ActiveX CMyAppA creates a MdiForm1 - surprisse - debugger switches to my client application, and creates a MdiForm1 in MyApp!

    Note, since both projects are almost the same, both projects have MdiForm1.
    But, I have created an ActiveX object CMyAppA with an idea to isolate data.

    When I create a New object of a class CMyAppA, I have expected, it will create it's own MdiForm1.

    Could somebody explain what is happening?

  2. #2
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: ActiveX unexpected behaviour

    In the first place I would guess one application is calling the other and the constructor of your class includes to create an MDI or something like that.
    As you say they are similar, are they identic ? What I mean is it the same class object used in a common dll and only setted the property one times to server and one time to client ?

    Do you use global variables in your activeX ?

    What happens when server and client are on different machines using different dll's ?
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  3. #3
    Join Date
    Mar 2002
    Location
    Croatia
    Posts
    275

    Re: ActiveX unexpected behaviour

    ActiveX has a lot of global variables, global arrays, global objects.
    That's why I'm trying to make it ActiveX, and then to use it from "identical" client application as an ActiveX object, with an idea to isolate data.

    The only difference between client and server applications are, server is an ActiveX project, and has a public interface Class.
    Client application declares and uses that class, and has no public interface class.

    Client declares a New ActiveX, Server is supposed to run Form1.MyTask() method. But, severs runs a MyTask() method of a Client! And recursivly calls itself.

    I will try to make a simple project to isolate the problem, so I could post it here.

  4. #4
    Join Date
    Mar 2002
    Location
    Croatia
    Posts
    275

    Re: ActiveX unexpected behaviour

    In a sample project (attached), it works OK.

    Project1 is a client. It declares CMyAppA, and calls a TestMethod().
    TestMethod() calls a MyTask() method of a Form1.

    Both client and server have Form1 with a MyTask() method. Server calls MyTask() on it's own Form1, as expected.

    In my real application, a server call somehow runs a client's Form1.MyTask() and recursively calls itself.

    I have to check my real application, there must be something else.
    Attached Files Attached Files

  5. #5
    Join Date
    Mar 2002
    Location
    Croatia
    Posts
    275

    Re: ActiveX unexpected behaviour

    It seems that it is not allowed to have ActiveX control with MDI form inside a MDI project.

    My sample application converted to MDI, fails with a message "Only one MDI form allowed."

  6. #6
    Join Date
    Mar 2002
    Location
    Croatia
    Posts
    275

    Resolved Re: ActiveX unexpected behaviour

    Quote Originally Posted by ergas
    In a sample project (attached), it works OK.

    I have to check my real application, there must be something else.
    It's OK with a VB ActiveX variable scope. I have made a stupid error. I have called a method on Form1 from inside a Client project, while I was thinking I'm in Server project.

    Regards
    ergas
    Last edited by ergas; July 19th, 2007 at 06:43 AM.

  7. #7
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: ActiveX unexpected behaviour

    Quote Originally Posted by ergas
    I have called a method on Form1 from inside a Client project, while I was thinking I'm in Server project. ...
    Logically this then needs to create MDI form. I see.
    So if solved please sign it as solved, even you have solved it yourself
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured