I have used the Findwindow function successfully to check if outlook is running, but is it possible to check a system for any mapi client.
I only want to perform certain functions if there is a mapi client but I don't want to insist on outlook.
Suggestions anyone?
I have used the Findwindow function successfully to check if outlook is running
So what was the class that worked for you?
dbakke@srpcs.com
Here is what I use.
Handle=FindWindowByTitle('','Microsoft Outlook':\00\)
FindWindow resides in USER.DLL and the DLL is definition by
SHORT PASCAL FindWindow( LPVOID, LPCHAR ) As FindWindowByTitle
(DLL Declaration taken from a SPREZZATURA ELECTRONIC NEWSLETTER)
Yes, the class you provided Don, did work.
Thanks
Now what I am looking for is another function that will look for mapi clients in general, rather than by specific name.
Is there a specific file where mapi functions reside that I can look for or is there something else I should be doing???
Mark,
I'm not the expert on MAPI in our office, although we have implemented these functions in an application. My initial guess is to call a function that should return an expected value if MAPI is implemented. If you don't get that value then assume no MAPI functions are available.
dbakke@srpcs.com
Hank,
Out of curiosity: Does this work if Outlook's got an open message already? I don't run Outlook myself but assume it does like IE and Word and puts the file name/URL/subject of the current open document/message in the title. So at the time your app looks for a window with the title "Outlook Express" the title might be "Happy Mother's Day from MP3.com! - Outlook Express". Or something. Does it still work?
- Oystein -
Mark,
To check if you've got a MAPI client installed on the workstation you can look at the WIN.INI file for the following entry:
MAPI=1
So, to find out do this:
declare function GetProfileString
result=str( \00\, 16 )
resultLen=GetProfileString( "Mail":\00\, "MAPI":\00\,"0":\00\, result, len( result ) )
if ( result1,\00\ )=1 then
MAPI is installed end else * whateverend
You may have to prototype the GetProfileString() call as I'm not sure if it's already prototypes in a clean OI system. Look in the DLL_KERNEL record in SYSPROCS. If it's not there add the following line, save and run declare_fcns() to create the DLL stub.
USHORT PASCAL GetProfileString( LPCHAR, LPCHAR, LPCHAR, LPCHAR, SHORT )
World leaders in all things RevSoft
Mark,
Just a slight correction on Sprezz's response. It should be GetPrivateProfileString, not GetProfileString. Also, it should already be prototyped because OI's PrintSetup window and other internal routines use this function regularly.
dbakke@srpcs.com
Thanks for the help guys.
I now have two more questions.
1/ I believe GetPrivateProfileString should have one more LpChar after
the short parameter. Does anyone know what this should be.
2/ I passed \00\ in this position and result1,\00\ returned 0 even though I have outlook installed. ResultLen returned 1. Does this indicate success or failure for this function?
Mark
1/ I believe GetPrivateProfileString should have one more LpChar after the short parameter. Does anyone know what this should be.
The name of the INI file you want to read from. GetProfileString() only uses WIN.INI which is why it's not necessary to pass it.
2/ I passed \00\ in this position and result1,\00\ returned 0 even though I have outlook installed. ResultLen returned 1. Does this indicate success or failure for this function?
The function "succeeded" and returned your default entry for a guess. Do you have a MAPI=1 setting in your WIN.INI file?
World leaders in all things RevSoft
For the record, I stand corrected. Sprezz's function does exist and I wasn't aware of it.
dbakke@srpcs.com
Thanks again.
I passed win.ini as the filename and the function succeeded.
Yes I do have MAPI=1 in my win.ini file
One more problem though, trying to add GetProfileString to the DLL_KERNEL record, I was unable to run declare_fcns(). "The object code is missing" was the reason given. I imagine it is more likely that I am missing something.
Any suggestions?
I am happy to use GetPrivateProfileString but curiosity gets the better of me.
Disregard my last.
I sorted it out. I was just missing common sense for a few minutes…
With Outlook running and the Appserver folder picked in my inbox, there are two Outlook window windows. The first with class rctrl_renwnd32 and title AppServer - Microsoft Outlook and the second with class mspim_wnd32 and title Microsoft Outlook.
Hank,
Right. So it doesn't matter if you can find the "AppServer - Microsoft Outlook" window by the title "Microsoft Outlook" or not, because there's always a window with just "Microsoft Outlook" as its title.
Btw - is it the way you describe with every version of Windows and Outlook? Or can there be versions where you might get one window titled "AppServer - Microsoft Outlook" and my question matters after all?
- Oystein -