Questions tagged [interopservices]

84 questions
2
votes
1 answer

COM Exception when using Range.InsertParagraphAfter()

Hello Guys good afternoon (argentina time), i had recieved a project where the system formats a word document according to some requirements from the client. The word document that i recieve is on .doc and and the word document that i export or…
zoriox
  • 19
  • 1
2
votes
2 answers

Converted From VB.NET to C# - Not Returning Values Correctly

The original VB.net, which is working perfectly: Declare Function HolderName Lib "myCard.dll" (ByVal buf As String) As Integer Declare Function Photo Lib "myCard.dll" (ByRef photo As Byte) As Integer ... buff = Space(200) : res =…
sam byte
  • 697
  • 9
  • 11
2
votes
1 answer

Read Write C++ Dynamic Arrays in C# (InteropServices)

I have a C++ class which has a header(matrixheader.h) such that : #pragma once class M { public: M(int m,int n); void MSet(int m,int n,double d); double MGet(int m,int n); ~M(); private: double**…
2
votes
3 answers

Problem assigninging values to a struct in C++ to a structure passed from C#

I have a function in C# that is passing an array of structures into a DLL written in C++. The struct is a group of ints and when I read out the data in the DLL all the values come out fine. However if I try to write to the elements from C++ the…
QueueHammer
  • 10,515
  • 12
  • 67
  • 91
1
vote
1 answer

Calling c++ function in a struct with C#

i have a c++ dll. i have to use this dll in c# code. in this dll: struct UserRecord { int login; //some properties here } struct CServerInterface { int __stdcall ClientsAddUser(UserRecord *inf); //some other functions…
1
vote
0 answers

How to get in C# struct of a C++ function that returns a struct as a pointer?

The following simple example looks very natural, however it is not getting the right values from the structure. C++ code: #define E __declspec( dllexport ) struct XY { int x, y; }; extern "C" { E XY* get_xy_ptr() { XY p; …
Sith2021
  • 3,245
  • 30
  • 22
1
vote
0 answers

microsoft excel cannot access the file there are several possible reasons + Workbooks.Open +

In my C#.net application, I am creating excel file and it is working fine at my local system but its give below error when deployed the application in IIS My Web server don't have office installed. Error: ExceptionMessage> Microsoft Excel cannot…
umesh.chape
  • 2,895
  • 5
  • 16
  • 17
1
vote
1 answer

How to create Office documents on a Linux based server?

I developed a "Reporting App" on C# that creates reports (basically on .doc's and .ppt's formats (using the MS Office interops libraries)) based on some parameters received from the user. Everything works as expected when the app is executed on a…
Che'Piyo
  • 21
  • 2
1
vote
1 answer

Consume COM DLL from multiple clients

I'm trying to build a COM DLL that will be consumed by several clients. for that purpose, I have 2 clients. Console App (subscriber) WPF App (publisher) the WPF app will call the Publish method of the COM DLL, which in turn will raise an event,…
kaycee
  • 1,199
  • 4
  • 24
  • 42
1
vote
2 answers

How to get creation DateTime of file from very long path?

I have file paths which are very long, so can be handled only using SafeFileHandle. Want to get creation datetime. When tried getting millies and then converted in DateTime then it is 1600 years less. Code: [DllImport("kernel32.dll", CharSet =…
Prem
  • 316
  • 1
  • 5
  • 23
1
vote
1 answer

Cannot open xls file with C# service

I have to create a service to import data from an excel file into a SQL Server table; the whole system belongs to one of my company's customer so I must use Visual Studio 2010. Some open may have this file opened so I decided to copy it to a…
SCdev
  • 101
  • 2
  • 12
1
vote
1 answer

How to Show a wpf window from another process

I have created 3 different application Application 1: It is a WPF application it has 1 Window(MainWindow) which display "Hello Word". Application 2: It is a WPF Application This application will create an instance of MainWindow of Application…
1
vote
1 answer

Apply Color Scale to Excel Range in C#

I am trying to apply a color scale to an excel range. My below code snippet almost does what I want, formatting my highest cell to Red and my lowest cell to black, and scaling the cells in between, but I would like to make it apply a color scale…
Starwfanatic
  • 584
  • 2
  • 13
  • 29
1
vote
1 answer

Is user32.dll the "WinApi" msdn speaks of?

In the following code, using System.Runtime.InteropServices; [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint…
joseph taylor
  • 123
  • 12
1
vote
1 answer

Sending float* from Objective C to C#

I am making a Unity project and trying to send float* array received at BLE (BlueTooth) at iPhone to C# code at Unity project. Those function calls initiated from C# to C++ side to receive data by passing array is quite common. But here, this data…
batuman
  • 7,066
  • 26
  • 107
  • 229