Search Results

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

Page 16/32 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • How can I manipulate a VB6 Collection in .NET?

    - by jhominal
    Hello all, I am currently in the process of designing an interface for .NET software that would be consumed by COM objects - specifically, VB6. While I have found a number of pages by Microsoft detailing how to make an COM-interoperable interface, I am currently tripping over the use of Collections in design time: I would like to be able to use a standard VB6 "Collection object" in the .NET program - for example, specify an argument as being a VB6 collection - and thus minimize the time necessary for clients to consume the interface. Thank you in advance.

    Read the article

  • How do I pass a function to NUnit Throws.Constraints?

    - by Serge Belov
    I'm trying to write some NUnit tests in F# and having trouble passing a function to the ThrowsConstraint. A distilled (non)working sample is below. open System.IO open NUnit.Framework [<TestFixture>] module Example = [<Test>] let foo() = let f = fun () -> File.GetAttributes("non-existing.file") Assert.That(f, Throws.TypeOf<FileNotFoundException>()) This compiles just fine but I get the following from the NUnit test runner: FsTest.Tests.Example.foo: System.ArgumentException : The actual value must be a TestDelegate but was f@11 Parameter name: actual While I'm able to work around the problem using ExpectedException attribute, my question is what is the correct way of using an F# function in this situation?

    Read the article

  • DeviceIoControl returning false

    - by Anand
    In my C# code,DeviceIoControl is returning false,the handle is correct DeviceIoControl(deviceHandle, IOCTL_STORAGE_GET_DEVICE_NUMBER, IntPtr.Zero, 0, OutBuffPtr,//&psdn, OutBuffSize, ref dwBytesReturned, IntPtr.Zero);

    Read the article

  • How can I create an Outlook PST file using .Net?

    - by brendan
    I'm writing an app that will manipulate Outlook data. I want to make a backup of that data first and am hoping I could just loop through the contact/calendar items, etc and write them out to a PST file. How can I write the contents of 1 or several Outlook folders to a PST using .Net? [vb or c# no matter]

    Read the article

  • How to check whether given file is in PROPER word file format?

    - by shekhar
    Hi, I am developing one application using C# for processing MSWord files. My application gets hang when I pass invalid .doc file as an input. For example, if I have one foo.pdf file and I pass it to my application after changing its extension (foo.doc). Is it possible to check whether file is valid doc file before trying to open it? Please enlighten !!!! Thanks in advance

    Read the article

  • PowerPoint PlugIn does not read defaults from .dll.config file

    - by Nick T
    I'm working on a very simple PowerPoint plugin, and I'm quite a bit stumped. In my settings.settings file, I have configured a setting "StartPath", which references where the PowerPoint plugin will navigate to using a Browser component. After I compile the application, and run the installer generated by the Setup project, the application is installed and uses the default value in the settings file. However, if I edit the application.dll.config file, the plugin still uses the old values. How can I set things up such that the plugin references the .dll.config file and not its default settings? The code to access the settings is listed below, including the other variants I have tried: //Attempt 1 string location = MyApplication.Properties.Settings.Default.StartPath; //Attempt 2 string location = ConfigurationManager.AppSettings["StartPath"]; //Attempt 3: Configuration element is inaccessible due to its protection level string applicationName = Environment.GetCommandLineArgs()[0] + ".exe"; string exePath = System.IO.Path.Combine(Environment.CurrentDirectory, applicationName); Configuration config = ConfigurationManager.OpenExeConfiguration(exePath); string location = config.AppSettings["StartPath"];

    Read the article

  • c++/cli pass (managed) delegate to unmanaged code

    - by Ron Klein
    How do I pass a function pointer from managed C++ (C++/CLI) to an unmanaged method? I read a few articles, like this one from MSDN, but it describes two different assemblies, while I want only one. Here is my code: 1) Header (MyInterop.ManagedCppLib.h): #pragma once using namespace System; namespace MyInterop { namespace ManagedCppLib { public ref class MyManagedClass { public: void DoSomething(); }; }} 2) CPP Code (MyInterop.ManagedCppLib.cpp) #include "stdafx.h" #include "MyInterop.ManagedCppLib.h" #pragma unmanaged void UnmanagedMethod(int a, int b, void (*sum)(const int)) { int result = a + b; sum(result); } #pragma managed void MyInterop::ManagedCppLib::MyManagedClass::DoSomething() { System::Console::WriteLine("hello from managed C++"); UnmanagedMethod(3, 7, /* ANY IDEA??? */); } I tried creating my managed delegate and then I tried to use Marshal::GetFunctionPointerForDelegate method, but I couldn't compile.

    Read the article

  • Windows user control hosted in IE is not working.

    - by kumar
    Hi i have hosted a windows user control in IE. Every thing is working fine, if i open the application in the same machine where the Web application is hoste. if i access the same appication from a remote client IE, A blank box is coming with a small image in the corner. I have added the site as trusted site in the IE and made all the security settings needed. let me know, what am i doing wrong. Thanking you.

    Read the article

  • What is the best way to create a shortcut hook mechanism for Office

    - by rak3sh
    I am looking to create shortcut handler for MS Office. I am creating an addin with VS2010 for Office 2010. The handler needs to listen to all keyboard events when Word/PowerPoint is active. Although there is a lot of material for creating application level shortcut handlers, I couldn't find one that was specific to Office. It would be great if somebody could suggest techniques with sample c# code. Thanks

    Read the article

  • How can I run some common code from both (a) scheduled via Windows Task & (b) manually from within W

    - by Greg
    Hi, QUESTION - How can I run some common code from both (a) scheduled via Windows Task & (b) manually from within WinForms app? BACKGROUND: This follows on from the http://stackoverflow.com/questions/2489999/how-can-i-schedule-tasks-in-a-winforms-app thread REQUIREMENTS C# .NETv3.5 project using VS2008 There is an existing function which I want to run both (a) manually from within the WinForms application, and (b) scheduled via Windows Task. APPROACHES So what I'm trying to understand is what options are there to make this work eg Is it possible for a windows task to trigger a function to run within a running/existing WinForms application? (doesn't sound solid I guess) Split code out into two projects and duplicate for both console application that the task manager would run AND code that the winforms app would run Create a common library and re-use this for both the above-mentioned projects in the bullet above Create a service with an interface that both the task manager can access plus the winforms app can manage Actually each of these approaches sounds quite messy/complex - would be really nice to drop back to have the code only once within the one project in VS2008, the only reason I ask about this is I need to have a scheduling function and the suggestion has been to use http://taskscheduler.codeplex.com/ as the means to do this, which takes the scheduling out of my VS2008 project... thanks

    Read the article

  • C# and C++ Library Again

    - by Betamoo
    Please take a look at previous question: http://stackoverflow.com/questions/2892343/c-and-c-library After implementing a wrapper class library in C++/CLI as suggested before, I wonder now how to use C++ pre-compiled header file in C#.....? PS: I did not find a dll file -or something simillar- to import to C# as I have expected... Any hints?

    Read the article

  • How to take a collection of bytes and pull typed values out of it?

    - by Pat
    Say I have a collection of bytes var bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; and I want to pull out a defined value from the bytes as a managed type, e.g. a ushort. What is a simple way to define what types reside at what location in the collection and pull out those values? One (ugly) way is to use System.BitConverter and a Queue or byte[] with an index and simply iterate through, e.g.: int index = 0; ushort first = System.BitConverter.ToUint16(bytes, index); index += 2; // size of a ushort int second = System.BitConverter.ToInt32(bytes, index); index += 4; ... This method gets very, very tedious when you deal with a lot of these structures! I know that there is the System.Runtime.InteropServices.StructLayoutAttribute which allows me to define the locations of types inside a struct or class, but there doesn't seem to be a way to import the collection of bytes into that struct. If I could somehow overlay the struct on the collection of bytes and pull out the values, that would be ideal. E.g. Foo foo = (Foo)bytes; // doesn't work because I'd need to implement the implicit operator ushort first = foo.first; int second = foo.second; ... [StructLayout(LayoutKind.Explicit, Size=FOO_SIZE)] public struct Foo { [FieldOffset(0)] public ushort first; [FieldOffset(2)] public int second; } Any thoughts on how to achieve this?

    Read the article

  • How do I marshal a pointer to an array of pointers to structures?

    - by Daniel Stutzbach
    I have a C function with the following signature: int my_function(int n, struct player **players) players is a pointer to an array of pointers to struct player objects. n is the number of pointers in the array. The function does not modify the array nor the contents of the structures, and it does not retain any pointers after returning. I tried the following: [DllImport("mylibary.dll")] static extern int my_function(int n, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] player_in []players); However, that marshals the data as a pointer to an array of structures, not a pointer to an array of pointers to structures.

    Read the article

  • Loading a Win32 control in C# (specifically WPF)

    - by Mmarquee
    I have written a set of Win32 dlls that encapsulate a Delphi Frame (see Snippet 1 below), and can load them into another Delphi program by loading the dll and assigning the right variables (Snippet 2). I now want to be able to do the same thing in C# (I can load the DLL in pinvoke, but am unsure how to connect up the control to the basic WPF 'form'. Snippet 1 var frame : TFrame1; function CreateFrame(hParent:TWinControl):Integer; stdcall; export; begin try frame := TFrame1.Create(hParent); frame.Parent := hParent; frame.Align := alClient; finally result := 1; end; end; exports CreateFrame name 'CreateFrame'; Snippet 2 DLLHandle := LoadLibrary('Library/Demo.Frame.dll'); If DLLHandle > 32 then begin ReturnValue := GetProcAddress(DLLHandle, 'CreateFrame'); end; ts1 := TTabSheet.Create(PageControl1); with ts1 do begin PageControl := PageControl1; Name := 'tsExternal'; Caption := 'External'; Align := alClient; ReturnValue (ts1); end; Any help would be greatly appreciated.

    Read the article

  • A Simple C# DLL - how do I call it from Excel, Access, VBA, VB6 ?

    - by divinci
    Hi all, I have a simple class library written in c#. using System; namespace TestDll { public class Test { public string HelloWorld { get { return "Hello World"; } } } } My question is how can I call this HelloWorld function from Microsoft Office Visual Basic (which I think is VB6)? My first step was to add the DLL as a reference - but on browsing and selecting the compiled DLL the message "Can't add a reference to the specified file." was thrown. Can anyone point me in the right direction as to why/how to get this working? Thanks in advance SO!

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >