interop

Unexpected Stackoverflow exception using CLR in a dll

点点圈 提交于 2019-12-12 01:48:35
问题 I have a software that accepts a C dll as plugin. The dll export two functions: init and quit. To test how the plugin works, I wrote three projects after the NativeWrapper concept: a managed library in C++ (dll), a native wrapper in C++ (also dll, that exports the init and quit functions) and a C++ test program. For now I am just testing the init function. All these are built and run inside VS 2013 without any issue. However, When I plug the two dlls in with the said software, it stops

SetupDiGetDeviceRegistryProperty fails with ERROR_INVALID_DATA

自作多情 提交于 2019-12-12 01:47:13
问题 I'm trying to get the display names as they appear in the "Screen Resolution" window (Win8.1 x64). First I tried EnumDisplayDevices var deviceInfo = new DISPLAY_DEVICEW(); uint i = 0; while (true) { if (!NativeMethods.EnumDisplayDevices(null, i++, deviceInfo, 0)) { break; } PrintDeviceInfo(deviceInfo); NativeMethods.EnumDisplayDevices(deviceInfo.DeviceName, 0, deviceInfo, EDD_GET_DEVICE_INTERFACE_NAME); PrintDeviceInfo(deviceInfo); } The second call to EnumDisplayDevices (with EDD_GET_DEVICE

Find Exchange User via Primary Smtp Address

时光总嘲笑我的痴心妄想 提交于 2019-12-12 01:09:24
问题 I have to write a small C# App which is using the Global Outlook Address Book to find the Exchange User from a given E-Mail Address. Finding the Exchange User by his name is simple, but how do I find him by his primary smtp address? Iterating over the whole AddressList is not an option, since it is huge (almost 400k Entries) this takes forever. Is there a better and faster way? public Outlook.ExchangeUser GetAddressBookEntry(string senderName, string senderAddress) { //Get Outlook address

HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG), error, my website is on azure cloud

陌路散爱 提交于 2019-12-12 00:50:34
问题 This error is coming when i am writing excel file thru c# code using interop from website url. It is working perfectly fine on local machine. after running publish of my website to Azure Cloud base server. It is not working on website url. If i have to install MS Excel on Azure, how can i do that. and If there is any other solution, please guide me. 回答1: E_CLASSNOTREG is "Class not registered". You are likely using the Office Interop Assemblies, which require the appropriate version of Office

C# Excel Interop prevent excel window from becoming visible

喜欢而已 提交于 2019-12-12 00:03:13
问题 I make a c# app that does some computations in an Excel file that is load by Excel Interop. I use this to open the excel file using this function: private Workbook OpenExcelFile(String path, String password = null) { if(!File.Exists(path)) { MessageBox.Show("Error loading" + path); } if (null == excel) { excel = new Application(); } excel.Visible = false; Workbook wb = null; if (password != null) { wb = excel.Workbooks.Open(path, ReadOnly: true, Password: password); return wb; } wb = excel

Windows 7, VS2010, .NET and AxMSCommLib

孤人 提交于 2019-12-11 23:16:03
问题 I have a project that is referencing the AxMSCommLib in VS2010 C#.. My Windows 7 Dev machine doesn't have or can't find this reference. Does anyone have any info on where to get this reference to make it work? 回答1: MSCommLib is an ancient VB6 control. I don't have it either anymore, even though I installed the VB6 runtime support on this machine. You'd have to dig up an old VB6 installer somewhere, no idea where to look. Maybe you can get it from an old machine, copy mscomm32.ocx into your c:

Is there a way to programmatically predefine the purpose when signing an office document?

冷暖自知 提交于 2019-12-11 21:25:25
问题 I'm creating an Excel file *.xlsx in a C# environment with Microsoft Excel Interop. I call the signing dialog programmatically with the following commands: using Excel = Microsoft.Office.Interop.Excel; Excel.Application xlapp = null; xlapp = new Microsoft.Office.Interop.Excel.Application(); Excel.Workbook xlwb = xlapp.Workbooks.Add(); object sigID = "{00000000-0000-0000-0000-000000000000}"; xlwb.Signatures.AddNonVisibleSignature(sigID); The "Sign" dialog appears and the user's credentials are

Problem in using a .net dll from c++ dll via c++/cli layer

人盡茶涼 提交于 2019-12-11 20:50:38
问题 I have a c++ dll, which at a certain point, needs to delegate a task to a dll written in .Net. For this i Created a c++/cli static library which consumes/uses the .net dll to achive some TASK. Then i statically link the c++/cli static lib with c++ dll. It looks something like this. cli.aTask() netdll.aTask() c++ dll ----------> c++/cli ----------------> .net dll < static link > <normal assembly inclusion> Now, the connection b/w c++dll and c++/cli is fine. i can do anything using .net library

Pointers using a 32 bit DLL in a 64 bit service

邮差的信 提交于 2019-12-11 19:29:10
问题 Until recently, we were running a service as x86, but changed it to Any CPU to use introduce some new functionality using a 64 bit DLL. One of the third party DLL's left over was 32 Bit. I setup a DLL surrogate for it in the registry, but that is only half the solution. I suspect that the pointer being made in memory is not accessible because it's no longer run inProc. What I need to know is how do I use the System.Runtime.InteropServices.Marshall object to get access to the returned pointer.

COMException on closing Excel workbook

夙愿已清 提交于 2019-12-11 19:26:22
问题 I'm using Excel = Microsoft.Office.Interop.Excel to write various data to Excel sheets. Excel.Workbook wb = null; Excel.Worksheet ws = null; Excel.Application excelApp = new Excel.Application(); excelApp.Visible = true; try { // Create new workbook wb = (Excel.Workbook)(excelApp.Workbooks.Add(Type.Missing)); ws = wb.ActiveSheet as Excel.Worksheet; // write data ... // Save & Close excelApp.DisplayAlerts = false; // Don't show file dialog for overwrite wb.Close(true, targetFilename, Type