Iam trying to create an Automation in Install Shield,
But Whenever I try to create object of ISWiRelease it throws following exception.
Additional information: Retrieving the COM class factory for component
with CLSID {16C4628B-361F-4739-8D75-4E8FA8C4A348} failed due to the
following error: 80040154 Class not registered (Exception from
HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
I tried changing target platform to x86,Still Iam getting this exception.
Iam using Install Shield 2015 SP2.
DLL which I loaded is ISWiAuto22
Please help me to fix this issue.
Code:
public void BuildProject()
{
ISWiProductConfigs oProdConfigs;
ISWiProductConfig oProdConfig;
ISWiRelease oRelease = new ISWiRelease();
ISWiProject oISWiProj = new ISWiProject();
try
{
//Create IS object
oISWiProj.OpenProject(sProjectFileName, false);
//oISWiProj.ProductVersion = sBuildNumber;
oProdConfigs = oISWiProj.ISWiProductConfigs;
oProdConfig = oProdConfigs[oProdConfigs.Count];
oRelease = oProdConfig.ISWiReleases[1];
oRelease.ProgressIncrement += new __ISWiRelease_ProgressIncrementEventHandler(release_ProgressIncrement);
oRelease.StatusMessage += new __ISWiRelease_StatusMessageEventHandler(this.release_StatusMessages);
oRelease.BuildLocation = sBuildLocation;
oRelease.Build();
oISWiProj.SaveProject();
oISWiProj.CloseProject();
}
catch
{
//log("Build Failed...");
}
finally
{
oRelease.ProgressIncrement -= new __ISWiRelease_ProgressIncrementEventHandler(release_ProgressIncrement);
oRelease.StatusMessage -= new __ISWiRelease_StatusMessageEventHandler(this.release_StatusMessages);
}
}
Related
I'm trying to follow this tutorial to connect my C# program to HANA Database On-Premise server using SAP DI API, but it does not work for me. I always got an error info like this;
Retrieving the COM class factory for component with CLSID {632F4591-AA62-4219-8FB6-22BCF5F60090} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
This is the code that I used;
private void btnConnection_Click(object sender, EventArgs e)
{
SAPbobsCOM.Company oCompany = new SAPbobsCOM.Company();
try
{
oCompany.CompanyDB = "DBSYS1";
oCompany.Server = "DBSYS1#192.168.xx.xxx";
oCompany.LicenseServer = "DBSYS1#192.168.xx.xxx:30015"; //IP Address of HANAsystem followed by Port number
oCompany.UserName = "username";
oCompany.Password = "password";
oCompany.DbServerType = BoDataServerTypes.dst_HANADB;
oCompany.UseTrusted = true;
int ret = oCompany.Connect();
string errMsg = oCompany.GetLastErrorDescription();
int ErrNo = oCompany.GetLastErrorCode();
if (ErrNo != 0)
{
MessageBox.Show(errMsg);
}
else
{
MessageBox.Show("Connected");
}
}
catch (Exception errMsg)
{
throw errMsg;
}
}
I have tried to find some solutions and I got this link.
It mentioned that the program platform target has to change to x86 or x64. But it still does not work for me.
I am trying to write a windows service which check my outlook inbox every minute.
I have the following code setup.
protected override void OnStart(string[] args)
{
timeDelay = new System.Timers.Timer(30000);
timeDelay = new System.Timers.Timer();
timeDelay.Elapsed += new System.Timers.ElapsedEventHandler(WorkProcess);
timeDelay.Enabled = true;
}
public void WorkProcess(object sender, System.Timers.ElapsedEventArgs e)
{
ReadMyEmail();
}
private void ReadMyEmail()
{
string content;
Application outlookApplication = null;
NameSpace outlookNamespace = null;
MAPIFolder inboxFolder = null;
Items mailItems = null;
try
{
outlookApplication = new Application(); // m getting the error here...
outlookNamespace = outlookApplication.GetNamespace("MAPI");
inboxFolder = outlookNamespace.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
mailItems = inboxFolder.Items;
foreach (MailItem item in mailItems)
{
if (item.UnRead)
......
...... all the code for reading emails.
}
}
}
I am getting the following error while i am trying to debug the application.
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
What am I doing wrong here.. I am just trying to read emails using a service.
This should not have been written as a Windows Service. For a "scheduled" application, you could have written this as a normal console application and setup the schedule to run it using Windows Scheduler. You can also set it up to run as you instead of as the system.
I am using below code to connect to a SAP cms server to get the reports from it.
using CrystalDecisions.Enterprise;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string username = "user";
string password = "pwd";
string server = "srv_name";
string auth_type = "authType";
// logon
SessionMgr session_mgr = new SessionMgr();
EnterpriseSession boEnterpriseSession = session_mgr.Logon(username , password, server, auth_type);
//boInfoStore = (IInfoStore)boEnterpriseSession.getService("InfoStore");
//boInfoStore = (IInfoStore)boEnterpriseSession.GetService("InfoStore");
// get the serialized session
//string session_str = session.SerializedSession;
// pass the session to our custom bypass page on the CRS
}
}
But I am getting below mentioned error while executing following line of code : SessionMgr session_mgr = new SessionMgr();
An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in
CrystalDecisions.Enterprise.Framework.dll
Additional information: Retrieving the COM class factory for component
with CLSID {6670DE06-3F39-4C5D-9238-71FF984D2654} failed due to the
following error: 80040154 Class not registered (Exception from
HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
According to nobugz's answer here
https://social.msdn.microsoft.com/Forums/vstudio/en-US/88a6ea68-f476-4231-822f-27fabe59f458/error-80040154-retreiving-com-class-factory?forum=vbgeneral
It is suggested that you check the keys in HKCR\CLSID for the GUID. if it is not in there, It may be in another folder(c:\windows\system32...).
The another way is to debug with Regmon.
"It shows you how your app uses the registry. Run it on yours and run it on the customer's and compare the two".
Try:
ISessionMgr sessionMgr = CrystalEnterprise.GetSessionMgr();
IEnterpriseSession enterpriseSession = sessionMgr.Logon("userName", "password", "cmsName", "secEnterprise");
string token = enterpriseSession.LogonTokenMgr.DefaultToken;
Im trying make automated page design with Adobe InDesign CC.
this is my code in C# :
public class HomeController : Controller
{
public ActionResult Index()
{
object missing = Type.Missing;
Type type = Type.GetTypeFromProgID("InDesign.Application");
if (type == null)
{
throw new Exception("Adobe InDesign CC is not installed");
}
_Application app = (_Application)Activator.CreateInstance(type);
Document document = (Document)app.Documents.Add(true, missing);
Page page = (Page)document.Pages[1];
TextFrame textFrame = page.TextFrames.Add(missing,
idLocationOptions.idUnknown, missing);
textFrame.GeometricBounds = new string[] { "6p", "6p", "24p", "24p" };
textFrame.Contents = "Hello from .Net!";
return View();
}
now when i run it gives this error to me :
An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll but was not handled in user code
Additional information: Retrieving the COM class factory for component with CLSID {FB6F0F4B-0467-4F63-88EC-3960B8E1B3EE} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
error happens in line :
_Application app = (_Application)Activator.CreateInstance(type);
this is the screenshot :
also , when i run this code , Adobe Indesign getting opened but do nothing happend until error shows up.
Hi I am working on C# application in which i am trying to read the mails from the Outlook Inbox.
I am using VS2010 and MS-Office 2007, I have added the refernce in the visual studio, The application is working fine in my system, but when i run the same application in client system, its throwing COM exception,
The exception message is like this
Unable to cast COM object of type System_ComObject to InterfaceType "Microsoft.Office.Interop.Outlook.MailItem" . This operation failed because the QueryInterface Call on the Com Component for the Interface with ID'{00063034-0000-0000-C000-00000000046} failed due to the following error. No such interface supported (Exception from HRESULT: 0x80004002)
(E_NONINTERFACE)
I am getting exception while trying to access MailItem ex code :
subject = ((Microsoft.Office.Interop.Outlook.MailItem)myInbox.Items[i]).Subject;
I tested in 3 to 4 systems in which VS2010 is installed, and the client system in which its throwing exception doesnt contain vs2010 in it, but .net 4.0 framework,ms-office 2007 is installed in client system.
what may be the error ?
Any suggestions plz ..
Thanks in advance..
Well there are two errors here - not all items in Inbox are of type MailItem, secondly subject can be null; so the correct code should look like:
using Microsoft.Office.Interop.Outlook;
var myApp = new Application();
NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
mapiNameSpace.SendAndReceive(false);
if (myInbox.Items.Count > 0) {
for (var i = 1; i < myInbox.Items.Count; i++) {
string subject;
var mailItem = myInbox.Items[i] as MailItem;
if (mailItem != null) {
subject = mailItem.Subject;
if (!string.IsNullOrEmpty(subject)) {
subject = subject.Replace('\'', '\"');
}
}
}
}
where the most important line is
var mailItem = myInbox.Items[i] as MailItem;
if (mailItem != null) {
...
and
if (!string.IsNullOrEmpty(subject)) {
...