Search Results

Search found 800 results on 32 pages for 'interop'.

Page 13/32 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Need to call COM component using reflection in .NET

    - by Usman
    I need to determine the COM component(unmanaged code) type and invoke the exposed interface's methods using reflection in C# at runtime. First What member of "Type" tells that type is COM component and we can take CLSID at runtime? Is Type.COMObject? I need to call methods of exposed interfaces as they called in unmanaged code using CoCreateInstance by passing CLSID and REFID ... I am using InvokeMember but it returns null or 0 as out parameter. How to pass out parameter in this case.? Is there any need to pass out parameter? As all my COM unmanaged code suppose to take last parameter as an OUT parameter and after executing it puts the result into that out param. But I've converted all my unmanaged COM code to .NET managed assemblies using tlbimp.exe.

    Read the article

  • ExecutionEngineException thrown when loading native dll

    - by Axarydax
    I have a 32-bit .net application that uses a native 32-bit DLL via DllImport(). The native DLL is our internal file analysis library, and I need to use it as porting it to C# would be a problem if people update it (other software uses it). The problem is that when I try to execute any method in the native DLL I get a System.ExecutionEngineException thrown. In fact, I've reduced the managed application to a simple tester that just calls a native method, but it still fails. I am on 64-bit Windows 7, but that should not matter as I'm compiling everything as 32-bit binaries. What is also interesting, when I look at the native DLL in the Dependency Walker, it shows that it can't find msvcr90.dll - but when I open any other of our native DLLs in the Dependency Walker, it can find their referenced msvcr90.dll just fine. Can there by some wrongness in the compilation of native DLL that messes up its DLL references?

    Read the article

  • ExecutionEngineException thrown when loading native dll in c#

    - by Axarydax
    Hi there. I have a 32-bit .net application that uses a native 32-bit DLL via DllImport(). The native DLL is our internal file analysis library, and I need to use it as porting it to C# would be a problem if people update it (other software uses it). The problem is that when I try to execute any method in the native DLL I get a System.ExecutionEngineException thrown. In fact, I've reduced the managed application to a simple tester that just calls a native method, but it still fails. I am on 64-bit Windows 7, but that should not matter as I'm compiling everything as 32-bit binaries. What is also interesting, when I look at the native DLL in the Dependency Walker, it shows that it can't find msvcr90.dll - but when I open any other of our native DLLs in the Dependency Walker, it can find their referenced msvcr90.dll just fine. Can there by some wrongness in the compilation of native DLL that messss up its DLL references?

    Read the article

  • Producing Mini Dumps for _caught_ SEH exceptions in mixed code DLL

    - by Assaf Lavie
    I'm trying to use code similar to clrdump to create mini dumps in my managed process. This managed process invokes C++/CLI code which invokes some native C++ static lib code, wherein SEH exceptions may be thrown (e.g. the occasional access violation). C# WinForms -> C++/CLI DLL -> Static C++ Lib -> ACCESS VIOLATION Our policy is to produce mini dumps for all SEH exceptions (caught & uncaught) and then translate them to C++ exceptions to be handled by application code. This works for purely native processes just fine; but when the application is a C# application - not so much. The only way I see to produce dumps from SEH exceptions in a C# process is to not catch them - and then, as unhandled exceptions, use the Application.ThreadException handler to create a mini dump. The alternative is to let the CLR translate the SEH exception into a .Net exception and catch it (e.g. System.AccessViolationException) - but that would mean no dump is created, and information is lost (stack trace information in Exception isn't as rich as the mini dump). So how can I handle SEH exceptions by both creating a minidump and translating the exception into a .Net exception so that my application may try to recover?

    Read the article

  • Making a COM dll to be invoked from c#, HRESULT error handling?

    - by Daniel
    I'm making a COM interface that c# will be using, however i am wondering how i am to check for errors and exception handling on the c# end as at the moment i am just returning a HRESTULT or bool for most methods. But several things can go wrong in some of these methods and returning a E_FAIL just doesn't cut it. What can i do in order to return more information? Can i make a HRESULT of my own?

    Read the article

  • Excel Object in asp.net

    - by Xyz
    Hi I have a serious issue. I am using excel object for opening the excel file it works fine i my PC. when i make application as a website and running the page and uploading it gives the error "'C:\Documents and Settings\Administrator\Desktop\Work\SABRE MSO Mapping Request Template.xlsx' could not be found. Check the spelling of the file name, and verify that the file location is correct. If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted. ". I think it taking server path...but i want to open client excel file before saving the file to the server. Plz help.

    Read the article

  • Calling a running C# application from VBA

    - by Robert
    I have some VBA code that needs to talk to a running c# application. For what it's worth, the c# application runs as a service, and exposes an interface via .net remoting. I posted a question regarding a specific problem I'm having already (http://stackoverflow.com/questions/2556163/from-vb6-to-net-via-com-and-remoting-what-a-mess) but I think I may have my structure all wrong... So I'm taking a step back - what's the best way to go about doing this? One thing that's worth taking into account is that I want to call into the running application - not just call a precompiled DLL...

    Read the article

  • How to obtain the native stacktrace from native exceptions caught in managed code

    - by aaa
    I have some managed code that calls to a method inside some native DLL(i have the appropriate symbol files). Sometimes, that native method throws an exception which I catch in my managed code. However, when i print the stacktrace from my caught exception, I see only managed code (the last frame is the call to the native code .. but it don't see the stacktrack within the native code). How can I obtain the native callstack as well? *When i'm debugging the code, i am able to step into the native code, and see the actuall call stack.

    Read the article

  • How to check name of Domino Server to which lotus notes is configured? using C#

    - by Preeti
    Hi, I am trying to login Domino server. For that i am taking Lotus Notes Password and Domino Server Name from user. if (notesPassword == "" && serverName == "") { MessageBox.Show("Please enter the server name !! "); return; } else { if (connectToDomino(notesPassword, serverName)) { MessageBox.Show("Connection Established Succesfully!!.."); } else { MessageBox.Show("Connection Fail.Please Login Again To Begin"); } }//else and in public bool connectToDomino(string NotesPassword, string strDominoServerName) { try { if (_lotesNotesSession == null) { NotesSession notesSession = new Domino.NotesSessionClass(); notesSession.Initialize(NotesPassword); } return true; } catch(Exception ex) { return false; } } Here i am initializing notes password.So in this case it is just verifying Notes Password. So even if user enters invalid entry of server name above function will return true. I tried : string serverName = notesSession.ServerName; But it is showing null value. :( Regards, Preeti

    Read the article

  • Strange behaviour using Drag and Drop in word 2003 automation in headers

    - by Oliver Hanappi
    Hi! I am developing a template based addin for Word 2003 which allows the user to drag and drop elements from a listbox into the word document. Unfortunately I'm getting a really strange behaviour when trying to drop elements in the document's header. Open the template and type something in the header Close the header and insert some content on the page Add a page break. Switch to page layout mode where and set zoom level to "Two Pages" Open the header Slowly Drag and Drop an list item from the list box to the header. See multiple Page Setups dialogs occur which cause Word to crash. Here is my code: // in ThisDocument.cs public MyUserControl _control; public void Init() { _control = new MyUserControl(); ActionsPane.Controls.Add(_control); ActionsPane.Visible = true; } // in MyUserControl.cs public void listBox1_MouseDown(object sender, MouseEventArgs e) { DoDragDrop("something", DragDropEffects.Copy); } Have I done somethinkg wrong with implementing Drag and Drop? Is there a workaround for this strange behaviour? Thanks in advance, Oliver Hanappi

    Read the article

  • Why would you need to run regasm and caspol on a .net component more than once?

    - by Craig Johnston
    Why would you need to run regasm and caspol on a .NET component more than once? I have a COM client that uses a .NET component residing on another machine. Consequently I need to run regasm and caspol on this .NET component. What could cause there to be the need to do this again on the same machine to the same component? Is the effect of regasm and caspol only temporary? Or can I assume that someone has reset or cleared something on a machine if I am having to do this again?

    Read the article

  • Blittable Value Types

    - by Michael Covelli
    Here is a list of blittable types. It contains Int32 and Int64. But I don't see just plain "int" on the list. How does C# treat the plain "int" type? Does it just get replaced with Int32 or Int64 depending on the system? Or is there a subtle difference? Will using "int" ever cause a performance hit for marshalling?

    Read the article

  • Parsing a .NET DataSet returned from a .NET Web Service in Java

    - by Chris Dail
    I have to consume a .NET hosted web service from a Java application. Interoperability between the two is usually very good. The problem I'm running into is that the .NET application developer chose to expose data using the .NET DataSet object. There are lots of articles written as to why you should not do this and how it makes interoperability difficult: http://www.hanselman.com/blog/ReturningDataSetsFromWebServicesIsTheSpawnOfSatanAndRepresentsAllThatIsTrulyEvilInTheWorld.aspx http://www.lhotka.net/weblog/ThoughtsOnPassingDataSetObjectsViaWebServices.aspx http://aspnet.4guysfromrolla.com/articles/051805-1.aspx http://www.theserverside.net/tt/articles/showarticle.tss?id=Top5WSMistakes My problem is that despite this not being recommended practice, I am stuck with having to consume a web service returning a DataSet with Java. When you generate a proxy for something like this with anything other than .NET you basically end up with an object that looks like this: @XmlElement(namespace = "http://www.w3.org/2001/XMLSchema", required = true) protected Schema schema; @XmlAnyElement(lax = true) protected Object any; This first field is the actual schema that should describe the DataSet. When I process this using JAX-WS and JAXB in Java, it bring all of XS-Schema in as Java objects to be represented here. Walking the object tree of JAXB is possible but not pretty. The any field represents the raw XML for the DataSet that is in the schema specified by the schema. The structure of the dataset is pretty consistent but the data types do change. I need access to the type information and the schema does vary from call to call. I've though of a few options but none seem like 'good' options. Trying to generate Java objects from the schema using JAXB at runtime seems to be a bad idea. This would be way too slow since it would need to happen everytime. Brute force walk the schema tree using the JAXB objects that JAX-WS brought in. Maybe instead of using JAXB to parse the schema it would be easier to deal with it as XML and use XPath to try and find the type information I need. Are there other options I have not considered? Is there a Java library to parse DataSet objects easily? What have other people done who may have similar situations?

    Read the article

  • Is there any way, short of "copy and paste inheritence" to share a .net class with a Silverlight app

    - by Jekke
    I have a project in two parts: a Silverlight front end and a WCF duplex service. Ideally, I would like to pass a message of a custom type (call it TradeOffer) from the WCF service to be consumed by the Silverlight application. When I try to, I get an error that indicates I can't pass an object of an unknown type across the wire like that and that, maybe, I could do so if I used the InternalsVisibleTo attribute on the server component. I'm not sure if that would work in this environment and know it would be messy in development. I originally put the message definition in a library to be used by both the service and the client, but couldn't add a reference to the library from the Silverlight client (because it's not a Silverlight assembly.) Is there some way I can access the definition of a message class from both the Silverlight client that consumes it and the service that publishes it without using the InternalsVisibleTo attribute or should I write the application another way?

    Read the article

  • Access COM object through a windows process handle.

    - by Sivvy
    I'm currently automating an application at work using COM, and have an issue where anyone using my application has a problem if the original application is already open when my application runs. I know how to locate the process if it's open, but instead of having to worry about closing it, or working around it, etc., I want to try to use the existing application instead of opening a new one. This is how I normally start the application in my automation program: Designer.Application desApp = new Designer.Application(); Now I'm attempting to try and use the handle from an existing application: Designer.Application desApp = (Designer.Application)((System.Diagnostics.Process.GetProcessesByName("Designer.exe")[0]).Handle) (I know this doesn't work, since .Handle returns an IntPtr, but I'm using it as an example.) Is there any way to accomplish this? How do I return a usable object if I know the handle/process?

    Read the article

  • How to declare and implement a COM interface on C# that inherits from another COM interface?

    - by Carlos Loth
    I'm trying to understand what is the correct why to implement COM interfaces from C# code. It is straightforward when the interface doesn't inherit from other base interface. Like this one: [ComImport, Guid("2047E320-F2A9-11CE-AE65-08002B2E1262"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellFolderViewCB { long MessageSFVCB(uint uMsg, int wParam, int lParam); } However things start to become weired when I need to implement an interface that inherits from other COM interfaces. For example, if I implement the IPersistFolder2 interface which inherits from IPersistFolder which inherits from IPersist as I usually on C# code: [ComImport, Guid("0000010c-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IPersist { void GetClassID([Out] out Guid classID); } [ComImport, Guid("000214EA-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IPersistFolder : IPersist { void Initialize([In] IntPtr pidl); } [ComImport, Guid("1AC3D9F0-175C-11d1-95BE-00609797EA4F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IPersistFolder2 : IPersistFolder { void GetCurFolder([Out] out IntPtr ppidl); } The operating system is not able to call the methods on my object implementation. When I'm debugging I can see the constructor of my IPersistFolder2 implementation is called many times, however the interface methods I've implemented aren't called. I'm implementing the IPersistFolder2 as follows: [Guid("A4603CDB-EC86-4E40-80FE-25D5F5FA467D")] public class PersistFolder: IPersistFolder2 { void IPersistFolder2.GetClassID(ref Guid classID) { ... } void IPersistFolder2.Initialize(IntPtr pidl) { ... } void IPersistFolder2.GetCurFolder(out IntPtr ppidl) { ... } } What seems strange is when I declare the COM interface imports as follow, it works: [ComImport, Guid("0000010c-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IPersist { void GetClassID([Out] out Guid classID); } [ComImport, Guid("000214EA-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IPersistFolder : IPersist { new void GetClassID([Out] out Guid classID); void Initialize([In] IntPtr pidl); } [ComImport, Guid("1AC3D9F0-175C-11d1-95BE-00609797EA4F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IPersistFolder2 : IPersistFolder { new void GetClassID([Out] out Guid classID); new void Initialize([In] IntPtr pidl); void GetCurFolder([Out] out IntPtr ppidl); } I don't know why it works when I declare the COM interfaces that way (hidding the base interface methods using new). Maybe it is related to the way IUnknown works. Does anyone know what is the correct way of implementing COM interfaces in C# that inherits from other COM interfaces and why?

    Read the article

  • Using TaskDialogIndirect in C#

    - by Dennis Delimarsky
    I've been working for a while with the regular Windows Vista/7 TaskDialog for a while, and I wanted to add some additional functionality (like custom buttons and a footer), so I need to use TaskDialogIndirect. Following the MSDN documentation for TaskDialogIndirect, I got this signature: [DllImport("comctl32.dll",CharSet = CharSet.Unicode,EntryPoint="TaskDialogIndirect")] static extern int TaskDialogIndirect (TASKDIALOGCONFIG pTaskConfig, out int pnButton, out int pnRadioButton, out bool pfVerificationFlagChecked); The TASKDIALOGCONFIG class is shown below: public class TASKDIALOGCONFIG { public UInt16 cbSize; public IntPtr hwndParent; public IntPtr hInstance; public String dwFlags; public String dwCommonButtons; public IntPtr hMainIcon; public String pszMainIcon; public String pszMainInstruction; public String pszContent; public UInt16 cButtons; public TASKDIALOG_BUTTON pButtons; public int nDefaultButton; public UInt16 cRadioButtons; public TASKDIALOG_BUTTON pRadioButtons; public int nDefaultRadioButton; public String pszVerificationText; public String pszExpandedInformation; public String pszExpandedControlText; public String pszCollapsedControlText; public IntPtr hFooterIcon; public IntPtr pszFooterText; public String pszFooter; // pfCallback; // lpCallbackData; public UInt16 cxWidth; } The TASKDIALOG_BUTTON implementation: public class TASKDIALOG_BUTTON { public int nButtonID; public String pszButtonText; } I am not entirely sure if I am on the right track here. Did anyone use TaskDialogIndirect from managed code directly through WinAPI (without VistaBridge or Windows API Code Pack)? I am curious about the possible implementations, as well as the callback declarations (I am not entirely sure how to implement TaskDialogCallbackProc). PS: I am looking for a direct WinAPI implementation, not one through a wrapper.

    Read the article

  • Outlook VSTO AddIn Configuration

    - by Deepak N
    I'm working on VSTO addin for outlook 2003.Outlook can read the startup section from Outlook.exe.config. <startup> <supportedRuntime version="v1.0.3705" /> <supportedRuntime version="v1.1.4322" /> <supportedRuntime version="v2.0.50727" /> </startup> But it is not able to read the system.diagnostics section of the config file. Basically i'm trying add trace listeners as i have explained here.Am I missing any thing here.

    Read the article

  • Marshal a list of objects from VB6 to C#

    - by Andrew
    I have a development which requires the passing of objects between a VB6 application and a C# class library. The objects are defined in the C# class library and are used as parameters for methods exposed by other classes in the same library. The objects all contain simple string/numeric properties and so marshaling has been relatively painless. We now have a requirement to pass an object which contains a list of other objects. If I was coding this in VB6 I might have a class containing a collection as a member variable. In C# I might have a class with a List member variable. Is it possible to construct a C# class in such a way that the VB6 application could populate this inner list and marshal it successfully? I don't have a lot of experience here but I would guess Id have to use an array of Object types.

    Read the article

  • Accessing underlying managed object through a COM interface

    - by mfeingold
    I have a third party assembly with a public abstract class implementing a certain COM interface. Something to the effect of [ComVisible(true)] public abstract class SomeClass: ISomeInterface { .... public void Method1() {...} } The actual object is an internal object extending the SomeClass and is instantiated by the third party code Is there a way to access public methods of this class if all I have is the CCW to the ISomeInterface?

    Read the article

  • C#: Recurrence Calandar issue of Lotus notes

    - by Royson
    Hi all, I am creating a Recurrence pattern in calendar items. But there is a issue as before clicking "Save and Send Invitations" button of Lotus notes 8.5, i am able to view the "RepeatForUnit" field from document property and based on its value i am identifying the Recurrence type like (D: for daily, W: for Weekly, M: for monthly etc). But, After clicking on the "Save and Send Invitations" button, the Recurrence is getting saved but after that, i am unable to get the "RepeatForUnit" field in Document Properties. Kindly help me, how to identify the Recurrence type and the related fields. Note: I am using Domino.dll using C#.

    Read the article

  • Visual C# | Capturing data from a window in a closed-source third-party Win32 application

    - by Zach Albia
    I'm planning on creating a C# Windows Forms app as an extension for a third-party Win32 application but I'm stumped as to how to do this right now. The farthest I've gotten is knowing it involves Win32 Hooking and that there's this open source project called EasyHook that's supposed to allow me to do this. I'd like to know how I can get the text from a textbox or some other data from a control in a third-party Win32 application. The text/data in a control is to be captured from the external application's running window the moment the user presses a button. I guess the question can be summed up as follows: How do you determine the event to hook to when the user clicks a certain button? How do you get the value displayed by a Win32 control at the time the button is clicked?

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >