Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(Services) SRVANY -> ACTIVEX DLL -> MAPI ?

Status
Not open for further replies.

xSMOKEx

Programmer
Feb 26, 2004
2
AT
hello
i did wrote a activex dll for a application
(it uses mapi)
send/read/save emails..
its working quite good :) when i run it local
but when i add it as service (i need to have it as service![with options logon as]) the programm that access the dll crashs all the time
i did add a little error handle to check whats going on and get this msg back when the programm crash
(the error occurs when the other program runs a function that creates the outlook.application object)
Error MSG:
Error -2147221246: Could not complete the operation because the service provider does not support it.
(also known as invalid window handle)

well as i said i run srvany and this program runs a little application that interacts with the dll
problem is that this little app crash with that error msg
is it bec the activex dll is used? like that?
(because its using another user that isnt logged in really?
(remeber it uses Logon as: (in service properties!)
can u run a activex dll (with createobject/outlook.application? like that?
i did search the web but infos are really rare!

(before u answer:
yes the user exists
yesservice running
no the dll is working
yes class id is ok (exe<->dll)
yes the user has a email account and outlook is setup
everyone is admin
im running this on SBS 2003 (small buisness server)

it must run as service bec if server crash (server restarts!) and if not service it wont start..
nope cant run it in autostart! *g* i have to use 1 email account! thats why i use it as service (logon as)!

hope someone can help me!
or at least give me some links to forums or whatever else..
where i could maybe get some answers/help ?
 
Check out the following link, it really helped me with creating a service that does something similar to what your doing with the exception that I had to use lotus notes.

I know outlook is different, but do you the outlook application running in the foreground or the background?
In some cases you may want to have outlook running on the desktop. You may have to try different things with it.

Soemthing else you may want to try and this will more than likely work for you, Look into CDO, it's a much easier way of creating and sending emails than using the Outlook Application.

Keep me posted, I may be able to help some more.
 
uhmm thx for reply but cdo isnt supported in Windows 2003
(they dont want to support it anymore)
cmc/cdo (as far as i know)
anyway the problem was:
(maybe someone gets same prob?)
a: i had to add to my dll
(after:)
Set objNameSpace = objOutlook.GetNamespace("MAPI")
objNameSpace.Logon "profilename", "", False, False
^
this is only needed if u want to run it as service under windows!
next problem was that for whatever reason...
microsoft edited the registry:
normaly: there is under
HKCU\Software\Microsoft\Windows(or Windows NT)\CurrentVersion\Windows Messaging Subsystem\Profiles\DefaultProfile the name of the profile
(looks like that vb with its createobject(outlook.application need this !
(if u run it as service..) however under win2003 sb-server
doesnt this entry exist i just created it and added the logon method in my dll to use the profile and viola the dll works :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top