Search Results

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

Page 9/32 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Marshal a C++ class to C#

    - by Adam Haile
    I need to access code in a native C++ DLL in some C# code but am having issues figuring out the marshaling. I've done this before with code that was straight C, but seem to have found that it's not directly possible with C++ classes. Made even more complicated by the fact that many of the classes contain virtual or inline functions. I even tried passing the headers through the PInvoke Interop Assistant, but it would choke on just about everything and not really no what to do... I'm guessing because it's not really supported. So how, if at all possible, can you use a native C++ class DLL from .NET code. If I have to use some intermediary (CLR C++?) that's fine.

    Read the article

  • Best solution for exporting Word documents to PDF programatically (without using a "software printer

    - by mbmccormick
    I'm looking for a way to export a Word document as a PDF. I would like to do this without the use of a "software printer" (such as CutePDF, etc.) and stick to reference assemblies if at all possible. I'm using Microsoft Office Interop Assemblies to generate a Word Document which I save to a temporary directory. So its not necessary for this solution to interact directly with Microsoft Office, unless it needs to. Any help or feedback you might have would be greatly appreciated! Thanks!

    Read the article

  • Do I need to force the GAC to reload an assembly? Is this possible?

    - by Ben McCormack
    I've added types to my .NET classes that I'm using for COM interop. To get it to work with my VB6 application, I unregistered the DLL and re-registered it (using regasm). I then uninstalled and reinstalled it to the GAC (using gacutil). The types are showing up in the VB6 object explorer, but when I run the application in the VB6 IDE, it breaks on the line that instantiates the new types with the error: Automation Errror - The System cannot find the file specified. I thought this odd since I had already updated the GAC, so I uninstalled the dll from the GAC and got the exact same error, which seems to indicate that the older version of the dll is already in memory and needs to be "reloaded" so that the newer DLL is in memory. Is this possible, and if so, what do I need to do?

    Read the article

  • How to detect the language of MS Excel from C#

    - by Babba
    If i try to use Excel from C# (interop) i receive error (HRESULT: 0x80028018) when current thread language is different from Excel language: so i need to set thread language, they must be the same. Which is the best method to understand the language of Excel/Office? 1) registry (HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\LanguageResources\UILanguage ? How understand wich version (12.0/14.0/...?) 2) with Application like suggested here (http://stackoverflow.com/questions/2804556/how-to-detect-the-language-of-ms-excel) ? It's ok but i need a strong reference to a specific version Microsoft.Office.Core and so i can't do it for different versione of Office: Excel.Application application = new Excel.Application(); int iUi = application.LanguageSettings.get_LanguageID(Microsoft.Office.Core.MsoAppLanguageID.msoLanguageIDUI); MessageBox.Show(iUi.ToString()); 3) other?

    Read the article

  • Powerpoint file can be deleted without consequence

    - by John Maloney
    I am working on a license management type application that copies a password protected zip file to the applications root. The user clicks a button "Open Presentation" and the zipped file is extracted into the root folder and then I use the Office interop to open the file in Powerpoint. At this point to my surprise I am able to delete the extracted file that is currently open in the Powerpoint application. I had assumed that trying to delete the file would fail as the file is still open in Powerpoint. Why is it allowing me to delete the file? Is the file somehow copied to a temp folder and then opened in PowerPoint? Can I move forward with the application relying on this ability to delete the file as soon as it is opened in Powerpoint? This would be optimal because it helps insure that the file cannot be copied(I am also using the xml to stop "Save As" and "Save" from appearing int Powerpoint). Thanks for the insight, John

    Read the article

  • VSTO install package How to check for prerequisites and skip them

    - by ticky
    I created Setup project for my Excel add-in project according to the article: Deploying a Visual Studio Tools for the Office System 3.0 Solution for the 2007 Microsoft Office System Using Windows Installer http://msdn.microsoft.com/en-us/library/cc563937(office.12).aspx I add prerequisites such as 2007 Interop assemblies(Office2007PIA) and when I run my setup file it does install it. But the problem is : That my setup ALWAYS installs it even if my computer already has Office2007PIA. How can I configure my setup project that it will first check if Office2007PIA is installed and continue the installation of my project without installing Office2007PIA? Thanks!

    Read the article

  • DllImport Based on OS Platform

    - by Ngu Soon Hui
    I have a mixture of unmanaged code ( backend) and managed code ( front end), as such, I would need to call the unmanaged code from my managed code, using interop techniques and DllImport attribute. Now, I've compiled two versions of unmanaged code, for both 32 and 64 bit OS; they are named service32.dll and service64.dll respectively. So, in my .Net code, I would have to do a DllImport for both dlls: [DllImport(@"service32.dll")] //for 32 bit OS invocation public static void SimpleFunction(); [DllImport(@"service64.dll")] //for 64 bit OS invocation public static void SimpleFunction(); And call them depending on which platform my application is running on. The issue now is that for every unmanaged function, I have to declared it twice, one for 32 bit OS and one for 64 bit OS. This is a duplication of work, and everytime I change the signature of an unmanaged function, I have to modified it in two places. Is there anyway that I can change the argument in DllImport so that the correct dll will be invoked automagically, depending on the platform?

    Read the article

  • Design interoperable web services

    - by Zyd
    Hi everyone, I'm designing a set of web services to allow our clients to connect from their apps to one of our systems. Our clients have their apps developed in all varieties of frameworks (.NET, Java, PHP, Python and even the occasional all JS app), so obviously WS is the way to go. Investigating a little about truly interop WS I've found that the way to go is to design first the WSDL and XSD and derive the implementations from there. What i'm really looking for is guidance if this is really the way to go. I've read that WCF creates interoperable WS but i'm not a fan of MS creating something standard. Should i use WCF or there is a good set of tools for designing WSDL and XSD without the pain i'm expecting. Thanks in advance

    Read the article

  • Inspecting a Word mail merge data source programmatically

    - by Guy Marom
    I want to iterate over all rows of a MS-Word mail merge data source and extract the relevant data into an XML. I'm currently using this code: Imports Microsoft.Office.Interop Do objXW.WriteStartElement("Recipient") Dim objDataFields As Word.MailMergeDataFields = DataSource.DataFields For Each FieldIndex As Integer In mdictMergeFields.Keys strValue = objDataFields.Item(FieldIndex).Value If Not String.IsNullOrEmpty(strValue) Then strName = mdictMergeFields(FieldIndex) objXW.WriteElementString(strName, strValue) End If Next objXW.WriteEndElement() If DataSource.ActiveRecord = LastRecord Then Exit Do Else DataSource.ActiveRecord = Word.WdMailMergeActiveRecord.wdNextDataSourceRecord End If Loop And it turns out to be a little sluggish (About 1 second for each row). Is there any way to do it faster? My fantasy is finding a function like MailMergeDataSource.ToDatatable and then inspecting the datatable.

    Read the article

  • Calling this[int index] via reflection

    - by tkutter
    I try to implement a reflection-based late-bound library to Microsoft Office. The properties and methods of the Offce COM objects are called the following way: Type type = Type.GetTypeFromProgID("Word.Application"); object comObject = Activator.CreateInstance(type); type.InvokeMember(<METHOD NAME>, <BINDING FLAGS>, null, comObject, new object[] { <PARAMS>}); InvokeMember is the only possible way because Type.GetMethod / GetProperty works improperly with the COM objects. Methods and properties can be called using InvokeMember but now I have to solve the following problem: Method in the office-interop wrapper: Excel.Workbooks wb = excel.Workbooks; Excel.Workbook firstWb = wb[0]; respectively foreach(Excel.Workbook w in excel.Workbooks) // doSmth. How can I call the this[int index] operator of Excel.Workbooks via reflection?

    Read the article

  • debugging c# silverlight projects from vb web application

    - by dave lowe
    Hi, I have a problem whereby I cannot debug a c# silverlight application project that is hosted from within a visual basic web application. I add breakpoints to the main App constructor and the symbols are loaded ok but my breakpoints are never hit. I have concluded that it is a vb/c# interop problem as to test i did the following. Created a new c# web application project Added a c# silverlight application Added a new vb web application project Added references to the silverlight project from both web apps set a breakpoint in App.xaml.cs constructor if i run the c# webapp the break points are hit whereas if i run the vb webapp they are not. has anyone come across this before or can anyone suggest a solution please? Many Thanks

    Read the article

  • How to speed up dumping a DataTable into an Excel worksheet?

    - by AngryHacker
    I have the following routine that dumps a DataTable into an Excel worksheet. private void RenderDataTableOnXlSheet(DataTable dt, Excel.Worksheet xlWk, string [] columnNames, string [] fieldNames) { // render the column names (e.g. headers) for (int i = 0; i < columnNames.Length; i++) xlWk.Cells[1, i + 1] = columnNames[i]; // render the data for (int i = 0; i < fieldNames.Length; i++) { for (int j = 0; j < dt.Rows.Count; j++) { xlWk.Cells[j + 2, i + 1] = dt.Rows[j][fieldNames[i]].ToString(); } } } For whatever reason, dumping DataTable of 25 columns and 400 rows takes about 10-15 seconds on my relatively modern PC. Takes even longer testers' machines. Is there anything I can do to speed up this code? Or is interop just inherently slow?

    Read the article

  • I'd like to preview a Word document on form.

    - by Tychumsempir
    I'm writing a VB program that fills in values within a word document. I'm utilizing the Microsoft Word 12.0 Object Library as a Reference. I'd like to provide a scrollable preview pane to my user that is within the form he or she is using. It would be even cooler if the user could edit the document through this pane. I've done Interop extensively, so I'm well aware of how to write and edit a Word document. I just want to put it into a frame and preview it. I'll probably try to select around the document based on what is changing as the user provides input so they can see what's being changed and where. Thoughts? Thanks

    Read the article

  • Visaul Studio 2010, TlbImp generates .net 4.0 interops in 2.0 projects

    - by DJScrib
    In a C# project we add a reference to a COM object via the Add References setup pointing to a COM object which results in the IDE auto-generating the interop assembly. So this is fine and good, but we are building based on .net 3.5 SP1 aka CLR 2.0, and the generated interops are using the 4.0 CLR making them incompatiable. Is there a way to prevent this? I assume the other option is in our build script to try using tlbimp.exe with the /references parameter? to point to mscorlib v2.0? Anyhow, I'm hoping there's a flag somewhere to allow this.

    Read the article

  • How can I tell if an ADODB::_RecordsetPtr has already been created?

    - by scottm
    I am trying to write a class that uses ADO to retrieve SQL records. The intent is for the class to maintain one private recordset an other methods move forward, retrieve fields, etc. This is a basic example of my class: class SqlADO { private: ADODB::_RecordsetPtr m_recordset; public: void Open(); //open the connection void Execute(const char* sql); // creates or replaces current recordset void Next(); //moves recordset cursor forward void Field(const char* fieldName); //retrieves field name from current record of the recordset }; My Questions: In the Execute method, how can I check to see that the recordset instance has been created (or do I need to) so that I can close it first? Do you know of any good ADO COM Interop references?

    Read the article

  • Extract Bullets and Tables information in Word doc from c#

    - by Siva
    Hi All, I need to create an word document based on the template in c#. I have tags for only the paragraphs. Is there any way to replace the bullets and tables that are already available in the template based on the user input. I was able to replace the paragraph with input text using the Replace command in the Word InterOp. Need help to do the rest of the items. Replace the bullets based on the user input Fill the tables with the input values Code for replacing the Paragraph based on the tag: FindAndReplace(wordApplication, "/date/", DateTime.Now.Date.ToString("MMM dd, yyyy")); FindAndReplace(){ wordApplication.Selection.Find.Execute(ref findText, ref matchCase, ref matchWholeWord, ref matchWildCards, ref matchSoundsLike, ref matchAllWordsForms, ref forward, ref wrap, ref format, ref replaceWithText, ref replace, ref matchKashida, ref matchDiacritics, ref matchAlefHamsa, ref matchControl); } Thanks in Advance. ASAP

    Read the article

  • Why doesn’t Office-applications get focus when run from another application on Win 2008?

    - by JohanK
    I have some different COM-Interop examples that when run on Windows 2008 (Office 2007) always open minimized in the task bar. On Windows 2003 or XP they open like I want them to. Has there been any changes to how Windows deals with this? Or to Office? I know that I can close windows with CTRL-SHIFT-ALT, and by that get them to start maximized next time, but for some dialogs this doesn’t work. Is there any way to make them always open maximized or on top? Any clues that could point me in the right direction would be helpful. I have tried with both our VB6 app and a test app in C#.

    Read the article

  • Exception using Querytables in Excel Automation

    - by sam
    Hi, I'm using Automation to populate a range in Excel using a querytable.. However, when I try to add a querytable to the qorksheet I get an exception. I checked the connection string and its working fine.. Can some one please help me with this?? public void writeproc1() { try { Worksheet ws = (Worksheet)wb.Worksheets.Add(Missing.Value, Missing.Value, Missing.Value, Missing.Value); Range rng = ws.get_Range("A1", "E14"); QueryTable qt = ws.QueryTables.Add("Data Source=(local)\\SQLEXPRESS;initial catalog=temp;Integrated Security=SSPI;", rng, "Select * From Table_1"); qt.RefreshStyle = XlCellInsertionMode.xlInsertEntireRows; qt.Refresh(false); } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.ReadKey(); } } Exception Thrown System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at Microsoft.Office.Interop.Excel.QueryTables.Add(Object Connection, Range Destination, Object Sql) at tmp.Program.writeproc1() in ...Projects\tmp\tmp\Program.cs:line 25

    Read the article

  • How to share session cookies between Internet Explorer and an ActiveX components hosted in a webpage

    - by jerem
    I am currently working on a .Net application which makes HTTP requests to some web applications hosted on a IIS server. The application is deployed through ClickOnce and is working fine on simple networks architectures. One of our customers has a very complex network involving a custom authentication server on which the user has first to log himself in order to be authenticated and get access to other applications on this network. Once authenticated on this server, a session cookie is created and sent to the user. Every time the user then makes a request on a secured server of the network, this cookie is checked to grant access to the user. If this cookie is not sent with the request, the user is redirected to the login page. The only browser used is Internet Explorer. This cookie cannot be accessed from our .net application since it is executed in another process than the Internet Explorer process which was used to log the user in, and thus is not sent with our requests, which cannot be completed since the server redirects every of our requests to the login page. I had a look at embedding my application into Internet Explorer by making the main control COM visible and creating it on an HTML page with an tag. It is working properly, however the sessions cookies set earlier in the browser are not sent when the ActiveX control makes web requests. I was hoping this sharing of the session information would be automatic (although I didn't really believe it). So my questions are : Is it possible to have access to this cookie in the embedded ActiveX? How? Does it make a difference to use a .Net COM-interop component instead of a "true" ActiveX control? Also, are there specific security words to describe this kind of behaviors (given that I am not an expert at all on security topics, this lack of proper terminology makes it a lot harder to find the needed resources)? My goal is to have my application's requests look the same from the requests made by the host browser's requests, and I thought that embedding the application as an ActiveX control into the browser was the only way to achieve this, however any suggestion on another to do this is welcome.

    Read the article

  • System.AccessViolationException: Attempted to read or write protected memory.

    - by Ananth
    I get the following exception when I try to "find and replace" in a word 2007 working on Windows Vista , Windows 7. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at Microsoft.Office.Interop.Word.Find.Execute(Object& FindText, Object& MatchCase, Object& MatchWholeWord, Object& MatchWildcards, Object& MatchSoundsLike, Object& MatchAllWordForms, Object& Forward, Object& Wrap, Object& Format, Object& ReplaceWith, Object& Replace, Object& MatchKashida, Object& MatchDiacritics, Object& MatchAlefHamza, Object& MatchControl) Is there any solution for this ? Iam using .net3.5 C#.

    Read the article

  • Visual Studio project using the Quality Center API remains in memory

    - by Traveling Tech Guy
    Hi, Currently developing a connector DLL to HP's Quality Center. I'm using their (insert expelative) COM API to connect to the server. An Interop wrapper gets created automatically by VStudio. My solution has 2 projects: the DLL and a tester application - essentially a form with buttons that call functions in the DLL. Everything works well - I can create defects, update them and delete them. When I close the main form, the application stops nicely. But when I call a function that returns a list of all available projects (to fill a combo box), if I close the main form, VStudio still shows the solution as running and I have to stop it. I've managed to pinpoint a single function in my code that when I call, the solution remains "hung" and if I don't, it closes well. It's a call to a property in the TDC object get_VisibleProjects that returns a List (not the .Net one, but a type in the COM library) - I just iterate over it and return a proper list (that I later use to fill the combo box): public List<string> GetAvailableProjects() { List<string> projects = new List<string>(); foreach (string project in this.tdc.get_VisibleProjects(qcDomain)) { projects.Add(project); } return projects; } My assumption is that something gets retained in memory. If I run the EXE outside of VStudio it closes - but who knows what gets left behind in memory? My question is - how do I get rid of whatever calling this property returns? Shouldn't the GC handle this? Do I need to delve into pointers? Things I've tried: getting the list into a variable and setting it to null at the end of the function Adding a destructor to the class and nulling the tdc object Stepping through the tester function application all the way out, whne the form closes and the Main function ends - it closes, but VStudio still shows I'm running. Thanks for your assistance!

    Read the article

  • Workflow Foundation (WF) -- Why does setting a DependencyProperty to a COM object using SetValue() t

    - by stakx
    Assume that I have a .NET Workflow Foundation (WF) SequenceActivity class with the following property: public IWorkspace Workspace { get; set; } // ^^^^^^^^^^ // important: this is a COM interface type! public static DependencyProperty WorkspaceProperty = DependencyProperty.Register( "Workspace", typeof(IWorkspace), typeof(FoobarActivity)); // <-- this activity class This activity executes some code that sets both of the above like this: this.Workspace = ...; // exact code not relevant; property set to a COM object SetValue(WorkspaceProperty, this.Workspace); The last line (which makes the call to SetValue) results in an ArgumentException for the second parameter (having the value of this.Workspace): Type […].IWorkspace of dependency property Workspace does not match the value's type System.__ComObject.                                           (translated from German, the English exception text might differ slightly) As soon as I register the dependency property with typeof(object) instead of typeof(IWorkspace) as the second parameter, the code executes just fine. However, that would result in the possibility to assign just about any value to the dependency property, and I do not want that. It seems to me that WF dependency properties don't work for COM interop objects.Does anyone have a solution to this?

    Read the article

  • COM Exceptions in C#

    - by Yaron Naveh
    I am consuming a cpp COM object from c# code. My c# code looks like this: try { var res = myComServer.GetSomething(); } catch (Exception e) { } However the exception never contains any of the details I set in cpp, in particular my error message. In my cpp side I have followed several examples I have found on the web: ... ICreateErrorInfo *pcerrinfo; IErrorInfo *perrinfo; HRESULT hr; hr = CreateErrorInfo(&pcerrinfo); pcerrinfo->SetDescription(L"C++ Exception"); hr = pcerrinfo->QueryInterface(IID_IErrorInfo, (LPVOID FAR*) &perrinfo); if (SUCCEEDED(hr)) { SetErrorInfo(0, perrinfo); perrinfo->Release(); } pcerrinfo->Release(); return E_FAIL; // E_FAIL or other appropriate failure code ... Am I missing anything? Is there anything else that could affect this, like marshaling, the interop creation or attributes of the com server itself?

    Read the article

  • Can WPF based ActiveX control use Reg-Free-COM

    - by embnut
    I have a WPF based ActiveX control (COM interop). I am able to use it correctly by registering the control. When I tried to Reg-Free-COM (using manifest files) the control seems to be activated, but the events (such as mouse click, RequestBringIntoView etc) dont respond. Interestingly, Double click and tab key works. I read in the this article http://blogs.msdn.com/karstenj/archive/2006/10/09/activex-wpf-gadget.aspx that " ... These upsides come with a price: the ActiveX control must be registered in the registry, which requires some kind of installation such as an .msi. The default gadget installation process cannot install ActiveX. The ActiveX control can't be access via reg-free COM. ..." Has anybody had a similar experience? Can anyone explain what is going on? Additional details: When the control is activated after it has been registered it appears as part of the COM client's UI. The control does not receive focus, its elements receive it. When using reg-free-com the control does not load correctly. 1) The control receives focus instead of its sub elements 2) The control has areas that are black instead of the windows default color 3) when I tab in and out of the control or double click it, it's subelements receive focus, the control starts receiving events and the black areas are replaced by the correct color

    Read the article

  • Azure eBook Update #1 &ndash; 16 authors so far!

    - by Eric Nelson
    I just wanted to share with folks where we are up to with the Windows Azure eBook (Check out the original post for full details) I have had lots of great submissions from folks with some awesome stuff to share on Azure. Currently we have 16 authors and 25 proposed articles. There is still a couple of days left to submit your proposal if you would like to get involved (see the original post ) and some topic suggestions below for which we don’t currently have authors. It is official – I’m excited! :-) Article Area Accepted Wikipedia Explorer: A case study how we did it and why. CaseSetudy Optional Patterns for the Windows Azure Platform (picking up 1 or 2 patterns that seem to be evolving) Architecture Optional Azure and cost-oriented architecture. Architecture Yes Code walkthrough of a comprehensive application submitted to newCloudApp contest CaseSetudy Yes Principles of highly scalable apps on Azure Compute Optional Auto-Scaling Azure Compute Yes Implementing a distributed cache using memcached with worker roles Interop Yes Building a content-based router service to direct requests to internal HTTP endpoints Compute Optional How to debug an Azure app by with a custom TraceListener & the AppFabric Service Bus AppFabric Yes How to host Java apps in Azure Interop Yes Bing Maps Tile Servers using Azure Blog Storage Interop Yes Tricks for storing time and date fields in Table Storage Storage Yes Service Runtime in Windows Azure Compute Yes Azure Drive Storage Optional Queries in Azure Table Storage Optional Getting RubyOnRails running on Azure Interop Yes Consuming Azure services within Windows Phone Interop Yes De-risking Your First Azure Project Architecture Yes Designing for failure Architecture Optional Connecting to SQL Azure In x Minutes SQLAzure Yes Using Azure Table Service as a NoSQL store via the REST API Storage Yes Azure Table Service REST API Storage Optional Threading, Scalability and Reliability in the Cloud Compute Yes Azure Diagnostics Compute Yes 5 steps to getting started with Windows Azure Introduction Yes The best tools for working with Windows Azure Tools Author Needed Understanding how SQL Azure works SQLAzure Author Needed Getting started with AppFabric Control Services AppFabric Author Needed Using the Microsoft Sync Framework with SQL Azure SQLAzure Author Needed Dallas - just a TV show or something more? Dallas Author Needed Comparing Azure to other cloud offerings Interop Author Needed Hybrid solutions using Azure and on-premise Interop Author Needed

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >