HOWTO: Change ClassName of running app or change classname of app during launch


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: HOWTO: Change ClassName of running app or change classname of app during launch

Hybrid View

  1. #1
    Mike Paschen Guest

    HOWTO: Change ClassName of running app or change classname of app during launch

    I have an app that checks for its classname to prevent launching a 2nd
    instance but I really need to launch a 2nd instance of it. Therefore I'd
    think that I either need to change the classname of the running app or
    change the classname of the 2nd instance while I launch it. Any ideas how to
    accomplish this?

    I've checked into GetClassInfoEx and GetClassLong and can retrieve all the
    class information of the running application but SetClassLong doesn't allow
    me to change the name. I also looked into RegisterClassEx where I can set
    the classname in the WNDCLASSEX structure but don't understand how (if
    possible) to use it with CreateWindowEx. CreateProcess doesn't seem to have
    an option of setting the classname either.

    I'd appreciate any help you can give me.

    Mike



  2. #2
    Mark Alexander Bertenshaw Guest

    Re: HOWTO: Change ClassName of running app or change classname of app during launch

    Mike -

    Are talking about the class of the top level window? I was led to believe
    that all VB forms had roughly the same class name, e.g. ThunderForm,
    VB5ThunderForm, etc.
    Is there any particular reason why you need to use this mechanism for
    checking whether a previous instance of your application exist? Why not use
    App.PrevInstance?

    ---------------------------------------
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Prime Response
    Brentford
    UK
    "Mike Paschen" <mike@leadman.net> wrote in message
    news:38d9b1cb$1@news.devx.com...
    > I have an app that checks for its classname to prevent launching a 2nd
    > instance but I really need to launch a 2nd instance of it. Therefore I'd
    > think that I either need to change the classname of the running app or
    > change the classname of the 2nd instance while I launch it. Any ideas how

    to
    > accomplish this?
    >
    > I've checked into GetClassInfoEx and GetClassLong and can retrieve all the
    > class information of the running application but SetClassLong doesn't

    allow
    > me to change the name. I also looked into RegisterClassEx where I can set
    > the classname in the WNDCLASSEX structure but don't understand how (if
    > possible) to use it with CreateWindowEx. CreateProcess doesn't seem to

    have
    > an option of setting the classname either.
    >
    > I'd appreciate any help you can give me.
    >
    > Mike
    >
    >




  3. #3
    Alan Gillott Guest

    Re: HOWTO: Change ClassName of running app or change classname of app during launch

    I think he means, he has an app that only allows one instance, but he'd like
    it to run a second instance only if the class name was different. If the
    class name is the same he wants it to fail as it is meant to.
    As i see it, he has to make a copy of the program and clone the associated
    registry entries, maybe even patching the copy to ensure it doesn't blow the
    registry of the original. Can be done but he needs to be painstakingly
    careful and find all instances og his clsid and class name in the dll. I
    wouldn't like to do it!

    Mark Alexander Bertenshaw <Mark.Bertenshaw@virgin.net> wrote in message
    news:38daa146@news.devx.com...
    > Mike -
    >
    > Are talking about the class of the top level window? I was led to believe
    > that all VB forms had roughly the same class name, e.g. ThunderForm,
    > VB5ThunderForm, etc.
    > Is there any particular reason why you need to use this mechanism for
    > checking whether a previous instance of your application exist? Why not

    use
    > App.PrevInstance?
    >
    > ---------------------------------------
    > Mark Alexander Bertenshaw
    > Programmer/Analyst
    > Prime Response
    > Brentford
    > UK
    > "Mike Paschen" <mike@leadman.net> wrote in message
    > news:38d9b1cb$1@news.devx.com...
    > > I have an app that checks for its classname to prevent launching a 2nd
    > > instance but I really need to launch a 2nd instance of it. Therefore I'd
    > > think that I either need to change the classname of the running app or
    > > change the classname of the 2nd instance while I launch it. Any ideas

    how
    > to
    > > accomplish this?
    > >
    > > I've checked into GetClassInfoEx and GetClassLong and can retrieve all

    the
    > > class information of the running application but SetClassLong doesn't

    > allow
    > > me to change the name. I also looked into RegisterClassEx where I can

    set
    > > the classname in the WNDCLASSEX structure but don't understand how (if
    > > possible) to use it with CreateWindowEx. CreateProcess doesn't seem to

    > have
    > > an option of setting the classname either.
    > >
    > > I'd appreciate any help you can give me.
    > >
    > > Mike
    > >
    > >

    >
    >




  4. #4
    Phil Weber Guest

    Re: HOWTO: Change ClassName of running app or change classname of app during launch

    > I think he means, he has an app that only allows one instance,
    > but he'd like it to run a second instance only if the class name
    > was different.


    Alan/Mark: I think Mike is saying that he has a third-party application (one
    that he didn't write, and that isn't necessarily written in VB) that only
    allows a single instance, but he's like to be able to run multiple instances
    of it. He's trying to figure out a way to trick the app into allowing him to
    do so.

    Mike: Even if you can figure out a way to do this, it's very dangerous and I
    don't recommend it. The app is likely written with the assumption that there
    will only be a single instance of it running at any time. Tricking it into
    running multiple instances may produce unpredictable results, including
    possible corruption of your data. I would suggest contacting the vendor of
    the app and seeing if there's some supported way to do this, or simply run
    the second instance on a laptop adjacent to your desktop machine. ;-)
    ---
    Phil Weber



  5. #5
    Mark Alexander Bertenshaw Guest

    Re: HOWTO: Change ClassName of running app or change classname of app during launch

    Mike -

    Are talking about the class of the top level window? I was led to believe
    that all VB forms had roughly the same class name, e.g. ThunderForm,
    VB5ThunderForm, etc.
    Is there any particular reason why you need to use this mechanism for
    checking whether a previous instance of your application exist? Why not use
    App.PrevInstance?

    ---------------------------------------
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Prime Response
    Brentford
    UK
    "Mike Paschen" <mike@leadman.net> wrote in message
    news:38d9b1cb$1@news.devx.com...
    > I have an app that checks for its classname to prevent launching a 2nd
    > instance but I really need to launch a 2nd instance of it. Therefore I'd
    > think that I either need to change the classname of the running app or
    > change the classname of the 2nd instance while I launch it. Any ideas how

    to
    > accomplish this?
    >
    > I've checked into GetClassInfoEx and GetClassLong and can retrieve all the
    > class information of the running application but SetClassLong doesn't

    allow
    > me to change the name. I also looked into RegisterClassEx where I can set
    > the classname in the WNDCLASSEX structure but don't understand how (if
    > possible) to use it with CreateWindowEx. CreateProcess doesn't seem to

    have
    > an option of setting the classname either.
    >
    > I'd appreciate any help you can give me.
    >
    > Mike
    >
    >




  6. #6
    Alan Gillott Guest

    Re: HOWTO: Change ClassName of running app or change classname of app during launch

    I think he means, he has an app that only allows one instance, but he'd like
    it to run a second instance only if the class name was different. If the
    class name is the same he wants it to fail as it is meant to.
    As i see it, he has to make a copy of the program and clone the associated
    registry entries, maybe even patching the copy to ensure it doesn't blow the
    registry of the original. Can be done but he needs to be painstakingly
    careful and find all instances og his clsid and class name in the dll. I
    wouldn't like to do it!

    Mark Alexander Bertenshaw <Mark.Bertenshaw@virgin.net> wrote in message
    news:38daa146@news.devx.com...
    > Mike -
    >
    > Are talking about the class of the top level window? I was led to believe
    > that all VB forms had roughly the same class name, e.g. ThunderForm,
    > VB5ThunderForm, etc.
    > Is there any particular reason why you need to use this mechanism for
    > checking whether a previous instance of your application exist? Why not

    use
    > App.PrevInstance?
    >
    > ---------------------------------------
    > Mark Alexander Bertenshaw
    > Programmer/Analyst
    > Prime Response
    > Brentford
    > UK
    > "Mike Paschen" <mike@leadman.net> wrote in message
    > news:38d9b1cb$1@news.devx.com...
    > > I have an app that checks for its classname to prevent launching a 2nd
    > > instance but I really need to launch a 2nd instance of it. Therefore I'd
    > > think that I either need to change the classname of the running app or
    > > change the classname of the 2nd instance while I launch it. Any ideas

    how
    > to
    > > accomplish this?
    > >
    > > I've checked into GetClassInfoEx and GetClassLong and can retrieve all

    the
    > > class information of the running application but SetClassLong doesn't

    > allow
    > > me to change the name. I also looked into RegisterClassEx where I can

    set
    > > the classname in the WNDCLASSEX structure but don't understand how (if
    > > possible) to use it with CreateWindowEx. CreateProcess doesn't seem to

    > have
    > > an option of setting the classname either.
    > >
    > > I'd appreciate any help you can give me.
    > >
    > > Mike
    > >
    > >

    >
    >




  7. #7
    Phil Weber Guest

    Re: HOWTO: Change ClassName of running app or change classname of app during launch

    > I think he means, he has an app that only allows one instance,
    > but he'd like it to run a second instance only if the class name
    > was different.


    Alan/Mark: I think Mike is saying that he has a third-party application (one
    that he didn't write, and that isn't necessarily written in VB) that only
    allows a single instance, but he's like to be able to run multiple instances
    of it. He's trying to figure out a way to trick the app into allowing him to
    do so.

    Mike: Even if you can figure out a way to do this, it's very dangerous and I
    don't recommend it. The app is likely written with the assumption that there
    will only be a single instance of it running at any time. Tricking it into
    running multiple instances may produce unpredictable results, including
    possible corruption of your data. I would suggest contacting the vendor of
    the app and seeing if there's some supported way to do this, or simply run
    the second instance on a laptop adjacent to your desktop machine. ;-)
    ---
    Phil Weber



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center