Checking if Outlook is running
Checking if Outlook is running
Hello,
How can I check in FWH if Outlook is running on my PC?
I tried to use GetTasks() but Outlook can not be found in the tasklist.
Is there a difference in Outlook 2003, 2007, 2010 or 2013?
Anyone any idea?
Thanks a lot in advance.
How can I check in FWH if Outlook is running on my PC?
I tried to use GetTasks() but Outlook can not be found in the tasklist.
Is there a difference in Outlook 2003, 2007, 2010 or 2013?
Anyone any idea?
Thanks a lot in advance.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Checking if Outlook is running
Michel,
This may help you:
This may help you:
Code: Select all
if FWGetOleObject( "outlook.application" ) == nil
MsgInfo( "outlook is not available" )
else
MsgInfo( "outlook is available" )
endif
Re: Checking if Outlook is running
Antonio,
Thanks for you efforts, but I'm afraid it isn't working.
I always get the message "Outlook is available" whether Outlook is running or not.
If Outlook is not running, I can see that Outlook is started invisible for a short moment, then the message "Outlook is available" appears and then Outlook is quited.
I did another test. I added the source you suggested into my source and I removed the try catch end section, just to see what happens.
Then I got this error : "Error TOleAuto/65535 TOLEAUTO:GETACTIVEOBJECT"
Any idea?
Thanks for you efforts, but I'm afraid it isn't working.
I always get the message "Outlook is available" whether Outlook is running or not.
If Outlook is not running, I can see that Outlook is started invisible for a short moment, then the message "Outlook is available" appears and then Outlook is quited.
I did another test. I added the source you suggested into my source and I removed the try catch end section, just to see what happens.
Then I got this error : "Error TOleAuto/65535 TOLEAUTO:GETACTIVEOBJECT"
Any idea?
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
-
- Posts: 310
- Joined: Mon Oct 10, 2005 5:10 am
Re: Checking if Outlook is running
Michel
Maybe the following code will help
Regards
Colin
Maybe the following code will help
Code: Select all
static function lfSetMail(oCMSFolder)
local NameSpace,oInbox
TRY
oOL := TOleAuto():New( "Outlook.Application" )
oNameSpace := oOL:Get( "GetNameSpace", "MAPI" )
oInbox := oNameSpace:Get( "GetDefaultFolder",6) // 6 = Inbox-Folder
TRY
oCMSFolder := oInbox:Folders("cmsmail")
CATCH
MsgAlert('No CMSMAIL Folder Setup')
END
CATCH
MsgAlert('Outlook Not Installed')
END
return(oCMSFolder)
Colin
Re: Checking if Outlook is running
Colin,
Thanks a lot for trying to help me.
I don't want to know if Outlook is installed or not, I want to know if Outlook is running.
Why do I want to know if Outlook is running? Because I want to prevent that Outlook is started moren than one time.
Thanks a lot for trying to help me.
I don't want to know if Outlook is installed or not, I want to know if Outlook is running.
Why do I want to know if Outlook is running? Because I want to prevent that Outlook is started moren than one time.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
-
- Posts: 310
- Joined: Mon Oct 10, 2005 5:10 am
Re: Checking if Outlook is running
Michel
I justed tested outlook and it appears you can not start it multiple times - you can have multiple child windows open
but they are closed when the top window is closed.
Tested on Windows 8 and Outlook 2010.
Regards
Colin
I justed tested outlook and it appears you can not start it multiple times - you can have multiple child windows open
but they are closed when the top window is closed.
Tested on Windows 8 and Outlook 2010.
Regards
Colin
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Checking if Outlook is running
if GetActiveObject( cName ) succeeds without error, it means the app is already running.Because I want to prevent that Outlook is started more than one time.
So the logic should be
Code: Select all
TRY
oObj := GetActiveObject( cApp )
? 'already running'
CATCH
TRY
oObj := CreateObject( cApp )
? 'Created now'
CATCH
? 'app not available
END
END
I advise you to use FWGetOleObject( cApp ) instead of TOleAuto():New(...) to achieve what you wanted.
Please see the code in \fwh\source\function\olefuncs.prg
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Checking if Outlook is running
Thanks a lot everybody for trying to help me.
Unfortunately, whatever I try, I always get the error : "Error TOleAuto/65535 TOLEAUTO:GETACTIVEOBJECT".
What am I doing wrong?
Unfortunately, whatever I try, I always get the error : "Error TOleAuto/65535 TOLEAUTO:GETACTIVEOBJECT".
What am I doing wrong?
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Checking if Outlook is running
If Outlook is not already running, you will and should get this error and getting the error is the way to know that it is not running.driessen wrote:Thanks a lot everybody for trying to help me.
Unfortunately, whatever I try, I always get the error : "Error TOleAuto/65535 TOLEAUTO:GETACTIVEOBJECT".
What am I doing wrong?
Please see my explanation above.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Checking if Outlook is running
Helle everyone,
Of course, I made a mistake by not using TRY .. CATCH ... END in my test.
Now it's running just fine.
Thank you very much for your help.
Of course, I made a mistake by not using TRY .. CATCH ... END in my test.
Now it's running just fine.
Thank you very much for your help.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Checking if Outlook is running
Good.
So I advise you to use FWGetOleObject( cApp ) instead of TOleAuto():New(...).
This function checks if the application is already active and if active uses the active object.
If not active opens the application.
So I advise you to use FWGetOleObject( cApp ) instead of TOleAuto():New(...).
This function checks if the application is already active and if active uses the active object.
If not active opens the application.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Checking if Outlook is running
Mr. Rao,
Thanks a lot for your advice.
Thanks a lot for your advice.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7