{{tag>category:"OpenInsight" author:"Mark B" author:"Donald Bakke" author:"Hank Huizinga" author:"Oystein Reigem" author:"[url=http://www.sprezzatura.com]The Sprezzatura Group[/url]"}}
[[https://www.revelation.com/the-works|Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community]]
==== Checking for a MAPI client (OpenInsight) ====
=== At 31 MAY 2001 02:24:51AM Mark B wrote: ===
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?
----
=== At 31 MAY 2001 10:39AM Donald Bakke wrote: ===
[i]I have used the Findwindow function successfully to check if outlook is running[/i]
So what was the class that worked for you?
dbakke@srpcs.com
[url=http://www.srpcs.com]SRP Computer Solutions, Inc.[/url]
[img]http://www.srpcs.com/srpicon1.gif[/img]
----
=== At 31 MAY 2001 11:06AM Hank Huizinga wrote: ===
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)
----
=== At 31 MAY 2001 07:26PM Mark B wrote: ===
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???
----
=== At 31 MAY 2001 07:54PM Donald Bakke wrote: ===
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
[url=http://www.srpcs.com]SRP Computer Solutions, Inc.[/url]
[img]http://www.srpcs.com/srpicon1.gif[/img]
----
=== At 01 JUN 2001 02:49AM Oystein Reigem wrote: ===
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 [i]"Outlook Express"[/i] the title might be [i]"Happy Mother's Day from MP3.com! - Outlook Express"[/i]. Or something. Does it still work?
- Oystein -
----
=== At 01 JUN 2001 04:38AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote: ===
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:
Mail
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
* // whatever
end
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 )
[url=http://www.sprezzatura.com]The Sprezzatura Group[/url]
[i]World leaders in all things RevSoft[/i]
[img]http://www.sprezzatura.com/zz.jpg[/img]
----
=== At 01 JUN 2001 08:30AM Donald Bakke wrote: ===
Mark,
Just a slight correction on Sprezz's response. It should be [i]GetPrivateProfileString[/i], not [i]GetProfileString[/i]. Also, it should already be prototyped because OI's PrintSetup window and other internal routines use this function regularly.
dbakke@srpcs.com
[url=http://www.srpcs.com]SRP Computer Solutions, Inc.[/url]
[img]http://www.srpcs.com/srpicon1.gif[/img]
----
=== At 04 JUN 2001 03:19AM Mark B wrote: ===
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?
----
=== At 04 JUN 2001 11:10AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote: ===
Mark
[i]1/ I believe GetPrivateProfileString should have one more LpChar after the short parameter. Does anyone know what this should be.[/i]
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.
[i]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?[/i]
The function "succeeded" and returned your default entry for a guess. Do you have a MAPI=1 setting in your WIN.INI file?
[url=http://www.sprezzatura.com]The Sprezzatura Group[/url]
[i]World leaders in all things RevSoft[/i]
[img]http://www.sprezzatura.com/zz.jpg[/img]
----
=== At 04 JUN 2001 11:46AM Donald Bakke wrote: ===
For the record, I stand corrected. Sprezz's function does exist and I wasn't aware of it.
dbakke@srpcs.com
[url=http://www.srpcs.com]SRP Computer Solutions, Inc.[/url]
[img]http://www.srpcs.com/srpicon1.gif[/img]
----
=== At 04 JUN 2001 07:52PM Mark B wrote: ===
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.
----
=== At 04 JUN 2001 07:57PM Mark B wrote: ===
Disregard my last.
I sorted it out. I was just missing common sense for a few minutes...
----
=== At 06 JUN 2001 10:00AM Hank Huizinga wrote: ===
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.
----
=== At 06 JUN 2001 05:05PM Oystein Reigem wrote: ===
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 -
[[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=WORKS_READ&SUMMARY=1&KEY=FEA22EEBC769CF9B85256A5D00233C20|View this thread on the Works forum...]]