DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 3 123 LastLast
Results 1 to 15 of 33

Thread: GetObject, with more than one instances of app.

  1. #1
    Sunil Guest

    GetObject, with more than one instances of app.


    Hi

    I am using the GetObject to access a running Excel appplication.

    Set objExcel = GetObject(, "Excel.Application")

    The GetObject in above statement will return the application object of Excel,
    which was started first. So, if I have got more than one instances of Excel
    running at the same time, I will be still getting the reference to first
    instance of excel.

    Is there a way to get the reference to application object of excel instance
    which is active presently.

    FYI, I am using GetForegroundWindow to get the Handle of active Window and
    GetClassName to get the Class Name of active application. Using that class
    name, I can know if the active application is Excel or not.

    In breif, using GetObject how can we get access to currently active Excel
    application, if more than one instances of Excel applications are running.

    I guess it might have something to do with RunningObjectTable of Windows
    OS.

    Please Help
    Thanx
    Sunil

  2. #2
    Michael \(michka\) Kaplan Guest

    Re: GetObject, with more than one instances of app.

    This is entirely the way that the ROT (the running object table) is defined.

    In orer to get a unique instance, you must ask for it in a unique way... for
    example by calling GetObject on the file name.

    --
    MichKa

    random junk of dubious value at the multilingual
    http://www.trigeminal.com/ and a new book on
    i18N in VB at http://www.trigeminal.com/michka.asp

    "Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    news:398355e0$1@news.devx.com...
    >
    > Hi
    >
    > I am using the GetObject to access a running Excel appplication.
    >
    > Set objExcel = GetObject(, "Excel.Application")
    >
    > The GetObject in above statement will return the application object of

    Excel,
    > which was started first. So, if I have got more than one instances of

    Excel
    > running at the same time, I will be still getting the reference to first
    > instance of excel.
    >
    > Is there a way to get the reference to application object of excel

    instance
    > which is active presently.
    >
    > FYI, I am using GetForegroundWindow to get the Handle of active Window and
    > GetClassName to get the Class Name of active application. Using that class
    > name, I can know if the active application is Excel or not.
    >
    > In breif, using GetObject how can we get access to currently active Excel
    > application, if more than one instances of Excel applications are running.
    >
    > I guess it might have something to do with RunningObjectTable of Windows
    > OS.
    >
    > Please Help
    > Thanx
    > Sunil




  3. #3
    Michael \(michka\) Kaplan Guest

    Re: GetObject, with more than one instances of app.

    This is entirely the way that the ROT (the running object table) is defined.

    In orer to get a unique instance, you must ask for it in a unique way... for
    example by calling GetObject on the file name.

    --
    MichKa

    random junk of dubious value at the multilingual
    http://www.trigeminal.com/ and a new book on
    i18N in VB at http://www.trigeminal.com/michka.asp

    "Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    news:398355e0$1@news.devx.com...
    >
    > Hi
    >
    > I am using the GetObject to access a running Excel appplication.
    >
    > Set objExcel = GetObject(, "Excel.Application")
    >
    > The GetObject in above statement will return the application object of

    Excel,
    > which was started first. So, if I have got more than one instances of

    Excel
    > running at the same time, I will be still getting the reference to first
    > instance of excel.
    >
    > Is there a way to get the reference to application object of excel

    instance
    > which is active presently.
    >
    > FYI, I am using GetForegroundWindow to get the Handle of active Window and
    > GetClassName to get the Class Name of active application. Using that class
    > name, I can know if the active application is Excel or not.
    >
    > In breif, using GetObject how can we get access to currently active Excel
    > application, if more than one instances of Excel applications are running.
    >
    > I guess it might have something to do with RunningObjectTable of Windows
    > OS.
    >
    > Please Help
    > Thanx
    > Sunil




  4. #4
    Sunil Guest

    Re: GetObject, with more than one instances of app.


    Hi Michael

    But I am not sure if Excel application is working on any .XLS Files. How
    for the excel instances which have opened up New Worksheets and not saved
    them?

    In other words, I have four excel instances running at the same time and
    none of them have opened up any .xls file, so how will I get reference to
    any Excel application, but the one which was started first.

    Thanx for your help
    Sunil

    "Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com> wrote:
    >This is entirely the way that the ROT (the running object table) is defined.
    >
    >In orer to get a unique instance, you must ask for it in a unique way...

    for
    >example by calling GetObject on the file name.
    >
    >--
    >MichKa
    >
    >random junk of dubious value at the multilingual
    >http://www.trigeminal.com/ and a new book on
    >i18N in VB at http://www.trigeminal.com/michka.asp
    >
    >"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    >news:398355e0$1@news.devx.com...
    >>
    >> Hi
    >>
    >> I am using the GetObject to access a running Excel appplication.
    >>
    >> Set objExcel = GetObject(, "Excel.Application")
    >>
    >> The GetObject in above statement will return the application object of

    >Excel,
    >> which was started first. So, if I have got more than one instances of

    >Excel
    >> running at the same time, I will be still getting the reference to first
    >> instance of excel.
    >>
    >> Is there a way to get the reference to application object of excel

    >instance
    >> which is active presently.
    >>
    >> FYI, I am using GetForegroundWindow to get the Handle of active Window

    and
    >> GetClassName to get the Class Name of active application. Using that class
    >> name, I can know if the active application is Excel or not.
    >>
    >> In breif, using GetObject how can we get access to currently active Excel
    >> application, if more than one instances of Excel applications are running.
    >>
    >> I guess it might have something to do with RunningObjectTable of Windows
    >> OS.
    >>
    >> Please Help
    >> Thanx
    >> Sunil

    >
    >



  5. #5
    Sunil Guest

    Re: GetObject, with more than one instances of app.


    Hi Michael

    But I am not sure if Excel application is working on any .XLS Files. How
    for the excel instances which have opened up New Worksheets and not saved
    them?

    In other words, I have four excel instances running at the same time and
    none of them have opened up any .xls file, so how will I get reference to
    any Excel application, but the one which was started first.

    Thanx for your help
    Sunil

    "Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com> wrote:
    >This is entirely the way that the ROT (the running object table) is defined.
    >
    >In orer to get a unique instance, you must ask for it in a unique way...

    for
    >example by calling GetObject on the file name.
    >
    >--
    >MichKa
    >
    >random junk of dubious value at the multilingual
    >http://www.trigeminal.com/ and a new book on
    >i18N in VB at http://www.trigeminal.com/michka.asp
    >
    >"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    >news:398355e0$1@news.devx.com...
    >>
    >> Hi
    >>
    >> I am using the GetObject to access a running Excel appplication.
    >>
    >> Set objExcel = GetObject(, "Excel.Application")
    >>
    >> The GetObject in above statement will return the application object of

    >Excel,
    >> which was started first. So, if I have got more than one instances of

    >Excel
    >> running at the same time, I will be still getting the reference to first
    >> instance of excel.
    >>
    >> Is there a way to get the reference to application object of excel

    >instance
    >> which is active presently.
    >>
    >> FYI, I am using GetForegroundWindow to get the Handle of active Window

    and
    >> GetClassName to get the Class Name of active application. Using that class
    >> name, I can know if the active application is Excel or not.
    >>
    >> In breif, using GetObject how can we get access to currently active Excel
    >> application, if more than one instances of Excel applications are running.
    >>
    >> I guess it might have something to do with RunningObjectTable of Windows
    >> OS.
    >>
    >> Please Help
    >> Thanx
    >> Sunil

    >
    >



  6. #6
    Michael \(michka\) Kaplan Guest

    Re: GetObject, with more than one instances of app.

    As I just said, it is NOT possible. GetObject will give you the first
    instance in the ROT that meets the criteria you have specified. PERIOD.

    The workaround is to start an instance of Excel with an XLS file.... you can
    then GetObject on the file name to retrieve that specific instance. The file
    can be a dummy file used exclusively for this purpose.

    --
    MichKa

    random junk of dubious value at the multilingual
    http://www.trigeminal.com/ and a new book on
    i18N in VB at http://www.trigeminal.com/michka.asp

    "Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    news:398359dd$1@news.devx.com...
    >
    > Hi Michael
    >
    > But I am not sure if Excel application is working on any .XLS Files. How
    > for the excel instances which have opened up New Worksheets and not saved
    > them?
    >
    > In other words, I have four excel instances running at the same time and
    > none of them have opened up any .xls file, so how will I get reference to
    > any Excel application, but the one which was started first.
    >
    > Thanx for your help
    > Sunil
    >
    > "Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>

    wrote:
    > >This is entirely the way that the ROT (the running object table) is

    defined.
    > >
    > >In orer to get a unique instance, you must ask for it in a unique way...

    > for
    > >example by calling GetObject on the file name.
    > >
    > >--
    > >MichKa
    > >
    > >random junk of dubious value at the multilingual
    > >http://www.trigeminal.com/ and a new book on
    > >i18N in VB at http://www.trigeminal.com/michka.asp
    > >
    > >"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    > >news:398355e0$1@news.devx.com...
    > >>
    > >> Hi
    > >>
    > >> I am using the GetObject to access a running Excel appplication.
    > >>
    > >> Set objExcel = GetObject(, "Excel.Application")
    > >>
    > >> The GetObject in above statement will return the application object of

    > >Excel,
    > >> which was started first. So, if I have got more than one instances of

    > >Excel
    > >> running at the same time, I will be still getting the reference to

    first
    > >> instance of excel.
    > >>
    > >> Is there a way to get the reference to application object of excel

    > >instance
    > >> which is active presently.
    > >>
    > >> FYI, I am using GetForegroundWindow to get the Handle of active Window

    > and
    > >> GetClassName to get the Class Name of active application. Using that

    class
    > >> name, I can know if the active application is Excel or not.
    > >>
    > >> In breif, using GetObject how can we get access to currently active

    Excel
    > >> application, if more than one instances of Excel applications are

    running.
    > >>
    > >> I guess it might have something to do with RunningObjectTable of

    Windows
    > >> OS.
    > >>
    > >> Please Help
    > >> Thanx
    > >> Sunil

    > >
    > >

    >




  7. #7
    Michael \(michka\) Kaplan Guest

    Re: GetObject, with more than one instances of app.

    As I just said, it is NOT possible. GetObject will give you the first
    instance in the ROT that meets the criteria you have specified. PERIOD.

    The workaround is to start an instance of Excel with an XLS file.... you can
    then GetObject on the file name to retrieve that specific instance. The file
    can be a dummy file used exclusively for this purpose.

    --
    MichKa

    random junk of dubious value at the multilingual
    http://www.trigeminal.com/ and a new book on
    i18N in VB at http://www.trigeminal.com/michka.asp

    "Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    news:398359dd$1@news.devx.com...
    >
    > Hi Michael
    >
    > But I am not sure if Excel application is working on any .XLS Files. How
    > for the excel instances which have opened up New Worksheets and not saved
    > them?
    >
    > In other words, I have four excel instances running at the same time and
    > none of them have opened up any .xls file, so how will I get reference to
    > any Excel application, but the one which was started first.
    >
    > Thanx for your help
    > Sunil
    >
    > "Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>

    wrote:
    > >This is entirely the way that the ROT (the running object table) is

    defined.
    > >
    > >In orer to get a unique instance, you must ask for it in a unique way...

    > for
    > >example by calling GetObject on the file name.
    > >
    > >--
    > >MichKa
    > >
    > >random junk of dubious value at the multilingual
    > >http://www.trigeminal.com/ and a new book on
    > >i18N in VB at http://www.trigeminal.com/michka.asp
    > >
    > >"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    > >news:398355e0$1@news.devx.com...
    > >>
    > >> Hi
    > >>
    > >> I am using the GetObject to access a running Excel appplication.
    > >>
    > >> Set objExcel = GetObject(, "Excel.Application")
    > >>
    > >> The GetObject in above statement will return the application object of

    > >Excel,
    > >> which was started first. So, if I have got more than one instances of

    > >Excel
    > >> running at the same time, I will be still getting the reference to

    first
    > >> instance of excel.
    > >>
    > >> Is there a way to get the reference to application object of excel

    > >instance
    > >> which is active presently.
    > >>
    > >> FYI, I am using GetForegroundWindow to get the Handle of active Window

    > and
    > >> GetClassName to get the Class Name of active application. Using that

    class
    > >> name, I can know if the active application is Excel or not.
    > >>
    > >> In breif, using GetObject how can we get access to currently active

    Excel
    > >> application, if more than one instances of Excel applications are

    running.
    > >>
    > >> I guess it might have something to do with RunningObjectTable of

    Windows
    > >> OS.
    > >>
    > >> Please Help
    > >> Thanx
    > >> Sunil

    > >
    > >

    >




  8. #8
    Brian Leung Guest

    Re: GetObject, with more than one instances of app.


    Hi Sunil,

    could you use GetWindowThreadProcessId. When you use the
    GetForegroundWindow function, you could use that handle to
    find the unique Id for process containing that window.


    Brian


    "Sunil" <SunilBudhrani@Yahoo.com> wrote:
    >
    >Hi Michael
    >
    >But I am not sure if Excel application is working on any .XLS Files. How
    >for the excel instances which have opened up New Worksheets and not saved
    >them?
    >
    >In other words, I have four excel instances running at the same time and
    >none of them have opened up any .xls file, so how will I get reference to
    >any Excel application, but the one which was started first.
    >
    >Thanx for your help
    >Sunil
    >
    >"Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>

    wrote:
    >>This is entirely the way that the ROT (the running object table) is defined.
    >>
    >>In orer to get a unique instance, you must ask for it in a unique way...

    >for
    >>example by calling GetObject on the file name.
    >>
    >>--
    >>MichKa
    >>
    >>random junk of dubious value at the multilingual
    >>http://www.trigeminal.com/ and a new book on
    >>i18N in VB at http://www.trigeminal.com/michka.asp
    >>
    >>"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    >>news:398355e0$1@news.devx.com...
    >>>
    >>> Hi
    >>>
    >>> I am using the GetObject to access a running Excel appplication.
    >>>
    >>> Set objExcel = GetObject(, "Excel.Application")
    >>>
    >>> The GetObject in above statement will return the application object of

    >>Excel,
    >>> which was started first. So, if I have got more than one instances of

    >>Excel
    >>> running at the same time, I will be still getting the reference to first
    >>> instance of excel.
    >>>
    >>> Is there a way to get the reference to application object of excel

    >>instance
    >>> which is active presently.
    >>>
    >>> FYI, I am using GetForegroundWindow to get the Handle of active Window

    >and
    >>> GetClassName to get the Class Name of active application. Using that

    class
    >>> name, I can know if the active application is Excel or not.
    >>>
    >>> In breif, using GetObject how can we get access to currently active Excel
    >>> application, if more than one instances of Excel applications are running.
    >>>
    >>> I guess it might have something to do with RunningObjectTable of Windows
    >>> OS.
    >>>
    >>> Please Help
    >>> Thanx
    >>> Sunil

    >>
    >>

    >



  9. #9
    Brian Leung Guest

    Re: GetObject, with more than one instances of app.


    Hi Sunil,

    could you use GetWindowThreadProcessId. When you use the
    GetForegroundWindow function, you could use that handle to
    find the unique Id for process containing that window.


    Brian


    "Sunil" <SunilBudhrani@Yahoo.com> wrote:
    >
    >Hi Michael
    >
    >But I am not sure if Excel application is working on any .XLS Files. How
    >for the excel instances which have opened up New Worksheets and not saved
    >them?
    >
    >In other words, I have four excel instances running at the same time and
    >none of them have opened up any .xls file, so how will I get reference to
    >any Excel application, but the one which was started first.
    >
    >Thanx for your help
    >Sunil
    >
    >"Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>

    wrote:
    >>This is entirely the way that the ROT (the running object table) is defined.
    >>
    >>In orer to get a unique instance, you must ask for it in a unique way...

    >for
    >>example by calling GetObject on the file name.
    >>
    >>--
    >>MichKa
    >>
    >>random junk of dubious value at the multilingual
    >>http://www.trigeminal.com/ and a new book on
    >>i18N in VB at http://www.trigeminal.com/michka.asp
    >>
    >>"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    >>news:398355e0$1@news.devx.com...
    >>>
    >>> Hi
    >>>
    >>> I am using the GetObject to access a running Excel appplication.
    >>>
    >>> Set objExcel = GetObject(, "Excel.Application")
    >>>
    >>> The GetObject in above statement will return the application object of

    >>Excel,
    >>> which was started first. So, if I have got more than one instances of

    >>Excel
    >>> running at the same time, I will be still getting the reference to first
    >>> instance of excel.
    >>>
    >>> Is there a way to get the reference to application object of excel

    >>instance
    >>> which is active presently.
    >>>
    >>> FYI, I am using GetForegroundWindow to get the Handle of active Window

    >and
    >>> GetClassName to get the Class Name of active application. Using that

    class
    >>> name, I can know if the active application is Excel or not.
    >>>
    >>> In breif, using GetObject how can we get access to currently active Excel
    >>> application, if more than one instances of Excel applications are running.
    >>>
    >>> I guess it might have something to do with RunningObjectTable of Windows
    >>> OS.
    >>>
    >>> Please Help
    >>> Thanx
    >>> Sunil

    >>
    >>

    >



  10. #10
    Michael \(michka\) Kaplan Guest

    Re: GetObject, with more than one instances of app.

    Which will not get you an objectr fe.... which is the point of GerObject.

    The question was not how to "find" a Window.... but how to find and use it!

    --
    MichKa

    random junk of dubious value at the multilingual
    http://www.trigeminal.com/ and a new book on
    i18N in VB at http://www.trigeminal.com/michka.asp

    "Brian Leung" <bleung@zoo.cam.ac.uk> wrote in message
    news:39840597$1@news.devx.com...
    >
    > Hi Sunil,
    >
    > could you use GetWindowThreadProcessId. When you use the
    > GetForegroundWindow function, you could use that handle to
    > find the unique Id for process containing that window.
    >
    >
    > Brian
    >
    >
    > "Sunil" <SunilBudhrani@Yahoo.com> wrote:
    > >
    > >Hi Michael
    > >
    > >But I am not sure if Excel application is working on any .XLS Files. How
    > >for the excel instances which have opened up New Worksheets and not saved
    > >them?
    > >
    > >In other words, I have four excel instances running at the same time and
    > >none of them have opened up any .xls file, so how will I get reference to
    > >any Excel application, but the one which was started first.
    > >
    > >Thanx for your help
    > >Sunil
    > >
    > >"Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>

    > wrote:
    > >>This is entirely the way that the ROT (the running object table) is

    defined.
    > >>
    > >>In orer to get a unique instance, you must ask for it in a unique way...

    > >for
    > >>example by calling GetObject on the file name.
    > >>
    > >>--
    > >>MichKa
    > >>
    > >>random junk of dubious value at the multilingual
    > >>http://www.trigeminal.com/ and a new book on
    > >>i18N in VB at http://www.trigeminal.com/michka.asp
    > >>
    > >>"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    > >>news:398355e0$1@news.devx.com...
    > >>>
    > >>> Hi
    > >>>
    > >>> I am using the GetObject to access a running Excel appplication.
    > >>>
    > >>> Set objExcel = GetObject(, "Excel.Application")
    > >>>
    > >>> The GetObject in above statement will return the application object of
    > >>Excel,
    > >>> which was started first. So, if I have got more than one instances of
    > >>Excel
    > >>> running at the same time, I will be still getting the reference to

    first
    > >>> instance of excel.
    > >>>
    > >>> Is there a way to get the reference to application object of excel
    > >>instance
    > >>> which is active presently.
    > >>>
    > >>> FYI, I am using GetForegroundWindow to get the Handle of active Window

    > >and
    > >>> GetClassName to get the Class Name of active application. Using that

    > class
    > >>> name, I can know if the active application is Excel or not.
    > >>>
    > >>> In breif, using GetObject how can we get access to currently active

    Excel
    > >>> application, if more than one instances of Excel applications are

    running.
    > >>>
    > >>> I guess it might have something to do with RunningObjectTable of

    Windows
    > >>> OS.
    > >>>
    > >>> Please Help
    > >>> Thanx
    > >>> Sunil
    > >>
    > >>

    > >

    >




  11. #11
    Michael \(michka\) Kaplan Guest

    Re: GetObject, with more than one instances of app.

    Which will not get you an objectr fe.... which is the point of GerObject.

    The question was not how to "find" a Window.... but how to find and use it!

    --
    MichKa

    random junk of dubious value at the multilingual
    http://www.trigeminal.com/ and a new book on
    i18N in VB at http://www.trigeminal.com/michka.asp

    "Brian Leung" <bleung@zoo.cam.ac.uk> wrote in message
    news:39840597$1@news.devx.com...
    >
    > Hi Sunil,
    >
    > could you use GetWindowThreadProcessId. When you use the
    > GetForegroundWindow function, you could use that handle to
    > find the unique Id for process containing that window.
    >
    >
    > Brian
    >
    >
    > "Sunil" <SunilBudhrani@Yahoo.com> wrote:
    > >
    > >Hi Michael
    > >
    > >But I am not sure if Excel application is working on any .XLS Files. How
    > >for the excel instances which have opened up New Worksheets and not saved
    > >them?
    > >
    > >In other words, I have four excel instances running at the same time and
    > >none of them have opened up any .xls file, so how will I get reference to
    > >any Excel application, but the one which was started first.
    > >
    > >Thanx for your help
    > >Sunil
    > >
    > >"Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>

    > wrote:
    > >>This is entirely the way that the ROT (the running object table) is

    defined.
    > >>
    > >>In orer to get a unique instance, you must ask for it in a unique way...

    > >for
    > >>example by calling GetObject on the file name.
    > >>
    > >>--
    > >>MichKa
    > >>
    > >>random junk of dubious value at the multilingual
    > >>http://www.trigeminal.com/ and a new book on
    > >>i18N in VB at http://www.trigeminal.com/michka.asp
    > >>
    > >>"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    > >>news:398355e0$1@news.devx.com...
    > >>>
    > >>> Hi
    > >>>
    > >>> I am using the GetObject to access a running Excel appplication.
    > >>>
    > >>> Set objExcel = GetObject(, "Excel.Application")
    > >>>
    > >>> The GetObject in above statement will return the application object of
    > >>Excel,
    > >>> which was started first. So, if I have got more than one instances of
    > >>Excel
    > >>> running at the same time, I will be still getting the reference to

    first
    > >>> instance of excel.
    > >>>
    > >>> Is there a way to get the reference to application object of excel
    > >>instance
    > >>> which is active presently.
    > >>>
    > >>> FYI, I am using GetForegroundWindow to get the Handle of active Window

    > >and
    > >>> GetClassName to get the Class Name of active application. Using that

    > class
    > >>> name, I can know if the active application is Excel or not.
    > >>>
    > >>> In breif, using GetObject how can we get access to currently active

    Excel
    > >>> application, if more than one instances of Excel applications are

    running.
    > >>>
    > >>> I guess it might have something to do with RunningObjectTable of

    Windows
    > >>> OS.
    > >>>
    > >>> Please Help
    > >>> Thanx
    > >>> Sunil
    > >>
    > >>

    > >

    >




  12. #12
    Brian Leung Guest

    Re: GetObject, with more than one instances of app.


    OK,

    Sunil,

    can you start the instances of excel from you program, or do
    you need to detect instances started elsewhere?



    "Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com> wrote:
    >Which will not get you an objectr fe.... which is the point of GerObject.
    >
    >The question was not how to "find" a Window.... but how to find and use

    it!
    >
    >--
    >MichKa
    >
    >random junk of dubious value at the multilingual
    >http://www.trigeminal.com/ and a new book on
    >i18N in VB at http://www.trigeminal.com/michka.asp
    >
    >"Brian Leung" <bleung@zoo.cam.ac.uk> wrote in message
    >news:39840597$1@news.devx.com...
    >>
    >> Hi Sunil,
    >>
    >> could you use GetWindowThreadProcessId. When you use the
    >> GetForegroundWindow function, you could use that handle to
    >> find the unique Id for process containing that window.
    >>
    >>
    >> Brian
    >>
    >>
    >> "Sunil" <SunilBudhrani@Yahoo.com> wrote:
    >> >
    >> >Hi Michael
    >> >
    >> >But I am not sure if Excel application is working on any .XLS Files.

    How
    >> >for the excel instances which have opened up New Worksheets and not saved
    >> >them?
    >> >
    >> >In other words, I have four excel instances running at the same time

    and
    >> >none of them have opened up any .xls file, so how will I get reference

    to
    >> >any Excel application, but the one which was started first.
    >> >
    >> >Thanx for your help
    >> >Sunil
    >> >
    >> >"Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>

    >> wrote:
    >> >>This is entirely the way that the ROT (the running object table) is

    >defined.
    >> >>
    >> >>In orer to get a unique instance, you must ask for it in a unique way...
    >> >for
    >> >>example by calling GetObject on the file name.
    >> >>
    >> >>--
    >> >>MichKa
    >> >>
    >> >>random junk of dubious value at the multilingual
    >> >>http://www.trigeminal.com/ and a new book on
    >> >>i18N in VB at http://www.trigeminal.com/michka.asp
    >> >>
    >> >>"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    >> >>news:398355e0$1@news.devx.com...
    >> >>>
    >> >>> Hi
    >> >>>
    >> >>> I am using the GetObject to access a running Excel appplication.
    >> >>>
    >> >>> Set objExcel = GetObject(, "Excel.Application")
    >> >>>
    >> >>> The GetObject in above statement will return the application object

    of
    >> >>Excel,
    >> >>> which was started first. So, if I have got more than one instances

    of
    >> >>Excel
    >> >>> running at the same time, I will be still getting the reference to

    >first
    >> >>> instance of excel.
    >> >>>
    >> >>> Is there a way to get the reference to application object of excel
    >> >>instance
    >> >>> which is active presently.
    >> >>>
    >> >>> FYI, I am using GetForegroundWindow to get the Handle of active Window
    >> >and
    >> >>> GetClassName to get the Class Name of active application. Using that

    >> class
    >> >>> name, I can know if the active application is Excel or not.
    >> >>>
    >> >>> In breif, using GetObject how can we get access to currently active

    >Excel
    >> >>> application, if more than one instances of Excel applications are

    >running.
    >> >>>
    >> >>> I guess it might have something to do with RunningObjectTable of

    >Windows
    >> >>> OS.
    >> >>>
    >> >>> Please Help
    >> >>> Thanx
    >> >>> Sunil
    >> >>
    >> >>
    >> >

    >>

    >
    >



  13. #13
    Brian Leung Guest

    Re: GetObject, with more than one instances of app.


    OK,

    Sunil,

    can you start the instances of excel from you program, or do
    you need to detect instances started elsewhere?



    "Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com> wrote:
    >Which will not get you an objectr fe.... which is the point of GerObject.
    >
    >The question was not how to "find" a Window.... but how to find and use

    it!
    >
    >--
    >MichKa
    >
    >random junk of dubious value at the multilingual
    >http://www.trigeminal.com/ and a new book on
    >i18N in VB at http://www.trigeminal.com/michka.asp
    >
    >"Brian Leung" <bleung@zoo.cam.ac.uk> wrote in message
    >news:39840597$1@news.devx.com...
    >>
    >> Hi Sunil,
    >>
    >> could you use GetWindowThreadProcessId. When you use the
    >> GetForegroundWindow function, you could use that handle to
    >> find the unique Id for process containing that window.
    >>
    >>
    >> Brian
    >>
    >>
    >> "Sunil" <SunilBudhrani@Yahoo.com> wrote:
    >> >
    >> >Hi Michael
    >> >
    >> >But I am not sure if Excel application is working on any .XLS Files.

    How
    >> >for the excel instances which have opened up New Worksheets and not saved
    >> >them?
    >> >
    >> >In other words, I have four excel instances running at the same time

    and
    >> >none of them have opened up any .xls file, so how will I get reference

    to
    >> >any Excel application, but the one which was started first.
    >> >
    >> >Thanx for your help
    >> >Sunil
    >> >
    >> >"Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>

    >> wrote:
    >> >>This is entirely the way that the ROT (the running object table) is

    >defined.
    >> >>
    >> >>In orer to get a unique instance, you must ask for it in a unique way...
    >> >for
    >> >>example by calling GetObject on the file name.
    >> >>
    >> >>--
    >> >>MichKa
    >> >>
    >> >>random junk of dubious value at the multilingual
    >> >>http://www.trigeminal.com/ and a new book on
    >> >>i18N in VB at http://www.trigeminal.com/michka.asp
    >> >>
    >> >>"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    >> >>news:398355e0$1@news.devx.com...
    >> >>>
    >> >>> Hi
    >> >>>
    >> >>> I am using the GetObject to access a running Excel appplication.
    >> >>>
    >> >>> Set objExcel = GetObject(, "Excel.Application")
    >> >>>
    >> >>> The GetObject in above statement will return the application object

    of
    >> >>Excel,
    >> >>> which was started first. So, if I have got more than one instances

    of
    >> >>Excel
    >> >>> running at the same time, I will be still getting the reference to

    >first
    >> >>> instance of excel.
    >> >>>
    >> >>> Is there a way to get the reference to application object of excel
    >> >>instance
    >> >>> which is active presently.
    >> >>>
    >> >>> FYI, I am using GetForegroundWindow to get the Handle of active Window
    >> >and
    >> >>> GetClassName to get the Class Name of active application. Using that

    >> class
    >> >>> name, I can know if the active application is Excel or not.
    >> >>>
    >> >>> In breif, using GetObject how can we get access to currently active

    >Excel
    >> >>> application, if more than one instances of Excel applications are

    >running.
    >> >>>
    >> >>> I guess it might have something to do with RunningObjectTable of

    >Windows
    >> >>> OS.
    >> >>>
    >> >>> Please Help
    >> >>> Thanx
    >> >>> Sunil
    >> >>
    >> >>
    >> >

    >>

    >
    >



  14. #14
    Sunil Guest

    Re: GetObject, with more than one instances of app.


    Hi Brian

    Thanx for response.

    But I want to detect instances started already (not from VB program).

    Sunil

    "Brian Leung" <bleung@zoo.cam.ac.uk> wrote:
    >
    >OK,
    >
    >Sunil,
    >
    >can you start the instances of excel from you program, or do
    >you need to detect instances started elsewhere?
    >
    >
    >
    >"Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>

    wrote:
    >>Which will not get you an objectr fe.... which is the point of GerObject.
    >>
    >>The question was not how to "find" a Window.... but how to find and use

    >it!
    >>
    >>--
    >>MichKa
    >>
    >>random junk of dubious value at the multilingual
    >>http://www.trigeminal.com/ and a new book on
    >>i18N in VB at http://www.trigeminal.com/michka.asp
    >>
    >>"Brian Leung" <bleung@zoo.cam.ac.uk> wrote in message
    >>news:39840597$1@news.devx.com...
    >>>
    >>> Hi Sunil,
    >>>
    >>> could you use GetWindowThreadProcessId. When you use the
    >>> GetForegroundWindow function, you could use that handle to
    >>> find the unique Id for process containing that window.
    >>>
    >>>
    >>> Brian
    >>>
    >>>
    >>> "Sunil" <SunilBudhrani@Yahoo.com> wrote:
    >>> >
    >>> >Hi Michael
    >>> >
    >>> >But I am not sure if Excel application is working on any .XLS Files.

    >How
    >>> >for the excel instances which have opened up New Worksheets and not

    saved
    >>> >them?
    >>> >
    >>> >In other words, I have four excel instances running at the same time

    >and
    >>> >none of them have opened up any .xls file, so how will I get reference

    >to
    >>> >any Excel application, but the one which was started first.
    >>> >
    >>> >Thanx for your help
    >>> >Sunil
    >>> >
    >>> >"Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>
    >>> wrote:
    >>> >>This is entirely the way that the ROT (the running object table) is

    >>defined.
    >>> >>
    >>> >>In orer to get a unique instance, you must ask for it in a unique way...
    >>> >for
    >>> >>example by calling GetObject on the file name.
    >>> >>
    >>> >>--
    >>> >>MichKa
    >>> >>
    >>> >>random junk of dubious value at the multilingual
    >>> >>http://www.trigeminal.com/ and a new book on
    >>> >>i18N in VB at http://www.trigeminal.com/michka.asp
    >>> >>
    >>> >>"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    >>> >>news:398355e0$1@news.devx.com...
    >>> >>>
    >>> >>> Hi
    >>> >>>
    >>> >>> I am using the GetObject to access a running Excel appplication.
    >>> >>>
    >>> >>> Set objExcel = GetObject(, "Excel.Application")
    >>> >>>
    >>> >>> The GetObject in above statement will return the application object

    >of
    >>> >>Excel,
    >>> >>> which was started first. So, if I have got more than one instances

    >of
    >>> >>Excel
    >>> >>> running at the same time, I will be still getting the reference to

    >>first
    >>> >>> instance of excel.
    >>> >>>
    >>> >>> Is there a way to get the reference to application object of excel
    >>> >>instance
    >>> >>> which is active presently.
    >>> >>>
    >>> >>> FYI, I am using GetForegroundWindow to get the Handle of active Window
    >>> >and
    >>> >>> GetClassName to get the Class Name of active application. Using that
    >>> class
    >>> >>> name, I can know if the active application is Excel or not.
    >>> >>>
    >>> >>> In breif, using GetObject how can we get access to currently active

    >>Excel
    >>> >>> application, if more than one instances of Excel applications are

    >>running.
    >>> >>>
    >>> >>> I guess it might have something to do with RunningObjectTable of

    >>Windows
    >>> >>> OS.
    >>> >>>
    >>> >>> Please Help
    >>> >>> Thanx
    >>> >>> Sunil
    >>> >>
    >>> >>
    >>> >
    >>>

    >>
    >>

    >



  15. #15
    Sunil Guest

    Re: GetObject, with more than one instances of app.


    Hi Brian

    Thanx for response.

    But I want to detect instances started already (not from VB program).

    Sunil

    "Brian Leung" <bleung@zoo.cam.ac.uk> wrote:
    >
    >OK,
    >
    >Sunil,
    >
    >can you start the instances of excel from you program, or do
    >you need to detect instances started elsewhere?
    >
    >
    >
    >"Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>

    wrote:
    >>Which will not get you an objectr fe.... which is the point of GerObject.
    >>
    >>The question was not how to "find" a Window.... but how to find and use

    >it!
    >>
    >>--
    >>MichKa
    >>
    >>random junk of dubious value at the multilingual
    >>http://www.trigeminal.com/ and a new book on
    >>i18N in VB at http://www.trigeminal.com/michka.asp
    >>
    >>"Brian Leung" <bleung@zoo.cam.ac.uk> wrote in message
    >>news:39840597$1@news.devx.com...
    >>>
    >>> Hi Sunil,
    >>>
    >>> could you use GetWindowThreadProcessId. When you use the
    >>> GetForegroundWindow function, you could use that handle to
    >>> find the unique Id for process containing that window.
    >>>
    >>>
    >>> Brian
    >>>
    >>>
    >>> "Sunil" <SunilBudhrani@Yahoo.com> wrote:
    >>> >
    >>> >Hi Michael
    >>> >
    >>> >But I am not sure if Excel application is working on any .XLS Files.

    >How
    >>> >for the excel instances which have opened up New Worksheets and not

    saved
    >>> >them?
    >>> >
    >>> >In other words, I have four excel instances running at the same time

    >and
    >>> >none of them have opened up any .xls file, so how will I get reference

    >to
    >>> >any Excel application, but the one which was started first.
    >>> >
    >>> >Thanx for your help
    >>> >Sunil
    >>> >
    >>> >"Michael \(michka\) Kaplan" <former_mvp@spamfree.trigeminal.nospam.com>
    >>> wrote:
    >>> >>This is entirely the way that the ROT (the running object table) is

    >>defined.
    >>> >>
    >>> >>In orer to get a unique instance, you must ask for it in a unique way...
    >>> >for
    >>> >>example by calling GetObject on the file name.
    >>> >>
    >>> >>--
    >>> >>MichKa
    >>> >>
    >>> >>random junk of dubious value at the multilingual
    >>> >>http://www.trigeminal.com/ and a new book on
    >>> >>i18N in VB at http://www.trigeminal.com/michka.asp
    >>> >>
    >>> >>"Sunil" <SunilBudhrani@Yahoo.com> wrote in message
    >>> >>news:398355e0$1@news.devx.com...
    >>> >>>
    >>> >>> Hi
    >>> >>>
    >>> >>> I am using the GetObject to access a running Excel appplication.
    >>> >>>
    >>> >>> Set objExcel = GetObject(, "Excel.Application")
    >>> >>>
    >>> >>> The GetObject in above statement will return the application object

    >of
    >>> >>Excel,
    >>> >>> which was started first. So, if I have got more than one instances

    >of
    >>> >>Excel
    >>> >>> running at the same time, I will be still getting the reference to

    >>first
    >>> >>> instance of excel.
    >>> >>>
    >>> >>> Is there a way to get the reference to application object of excel
    >>> >>instance
    >>> >>> which is active presently.
    >>> >>>
    >>> >>> FYI, I am using GetForegroundWindow to get the Handle of active Window
    >>> >and
    >>> >>> GetClassName to get the Class Name of active application. Using that
    >>> class
    >>> >>> name, I can know if the active application is Excel or not.
    >>> >>>
    >>> >>> In breif, using GetObject how can we get access to currently active

    >>Excel
    >>> >>> application, if more than one instances of Excel applications are

    >>running.
    >>> >>>
    >>> >>> I guess it might have something to do with RunningObjectTable of

    >>Windows
    >>> >>> OS.
    >>> >>>
    >>> >>> Please Help
    >>> >>> Thanx
    >>> >>> Sunil
    >>> >>
    >>> >>
    >>> >
    >>>

    >>
    >>

    >



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