microsoft.public.dotnet.framework.interop Archive - December 2001
Post a message to this list
Messages
Page: 12
req. help with NetGetDCName (4 replies)
microsoft.public.dotnet.framework.interop
Hello, I need some help in writing unmanaged code (c#) for windows API NetGetDCName. NET API STATUS NetGetDCName( LPCWSTR servername, LPCWSTR domainname, LPBYTE *bufptr ); where system allocates memory for bufptr. I think i am either missing correct declaration for LPBYTE *bufptr or I am not able to access the memory allocated by system in the managed code. I would appreciate if any of you could p...
why can't I use GetIPictureDispFromPicture? (2 replies)
microsoft.public.dotnet.framework.interop
Why is the static method GetIPictureDispFromPicture only available as a protected method in AxHost? The documentation says "this member supports the ..NET Framework infrastructure and is not intended to be used directly in your code." This would be a really useful function in cases where an ActiveX control wants an IPictureDisp object... it seems this method is the only method that would do that, ...
The Complete Picture about marshaling types (2 replies)
microsoft.public.dotnet.framework.interop
the types which should marshaled are here: "wtypes.h C Managed Extensions Common language runtime HANDLE void * void * IntPtr, UIntPtr BYTE unsigned char unsigned char Byte SHORT short short Int16 WORD unsigned short unsigned short UInt16 INT int int Int32 UINT unsigned int unsigned int UInt32 LONG long long Int32 BOOL long bool Boolean DWORD unsigned long unsigned long UInt32 ULONG unsigned long ...
Connecting to DCOM server in C# (2 replies)
microsoft.public.dotnet.framework.interop
Hello! I have COM component running on remote machine, how could I connect to it? In old C I was using CoCreateInstanceEx, how I can use this in C# Pozdrawiam Marcin Zielinski e mail: zielu1@polbox.com http://www.zielu.w.pl
GetLastError when calling DLLs (2 replies)
microsoft.public.dotnet.framework.interop
Hello All, In the DllImport attribute there is an attribute called GetLastError. Can anyone please tell me how to use it? I am calling a dll from my program and I am not getting the desired result. I want to know what error is occurring when I make a call to the native dll. Thanks and best regards, Abhishek.
No constructor defined? (3 replies)
microsoft.public.dotnet.framework.interop
Hi Interop gurus! wonder if enyone came accross a similar problem. I'm building a .NET client interface for a (3rd party) COM object. While using VS I am able to add the COM component as a reference and it creates the rcw, no problem, but as soon as I try to use it by either inheritance or instancing i get the following error (following sample code): using System; using theDLL; namespace TestGUI{ ...
Using remote COMs from .NET (C#) (2 replies)
microsoft.public.dotnet.framework.interop
Hello, I want to use COM objects on the remote computer. I've succeded calling methods on remote COMs by using reflection: type.InvokeMember(......); Is there any more convenient way to call methods on remote COMs? Can .NET Studio generate wrappers for remote COMs just like they can be generated for local COMs? I could not find such functionality. The point is that the COMs will reside on differen...
file access synchronization (5 replies)
microsoft.public.dotnet.framework.interop
If i want to write to a shared file with different processes at the same time, how can i do that? Here is the class i tried but it fails: class TestFile { ReaderWriterLock rwl new ReaderWriterLock(); FileStream fs new FileStream("a.txt", FileMode.Append, FileAccess.Write, FileShare.ReadWrite); public void Write(String message) { rwl.AcquireWriterLock(Timeout.Infinite); try { StreamWriter writer; t...
returning string from C# (2 replies)
microsoft.public.dotnet.framework.interop
Im trying to make a C# COM server that returns a string to a c native caller. If i declare my C# method void getText( [In,Out] String str, out int i); i do not get the string back when i call it from native c but i get the int. char t[1000]; long i; cpi getText(t,&i); // i is changed but t is unchanged I know this probertly a very simple question but I have browsed the documentation for hours with...
Initiate DCOM (5 replies)
microsoft.public.dotnet.framework.interop
Is it possible to use Activator.CreateInstance to start COM object in remote machine (i.e. in vb, we can use createobject(Pogid, machinename)). Is any function that can do the job?
Beta 2 vs. RC1 (4 replies)
microsoft.public.dotnet.framework.interop
We are planning to release on Friday. Is there any news you can give me about RC1 that might influence us to upgrade to RC1? Or maybe convince us to stay with Beta 2? I'm looking for things like bugs fixed or bugs introduced, how much work involved to upgrade, anything kind of information you can share. How about when is Microsoft planning on shipping the general release. Thanks in advance, Carl
I want to access to specific interface of IE(WBC) by C-Sharp. (4 replies)
microsoft.public.dotnet.framework.interop
Hi, I want to access to specific interface of IE(WebBrowserControl WBC) in C Sharp code. The situation is : I got a stream of XML document and have customized editing UI in C Sharp code. Don't blame me for using C Sharp in client circustomce. This is a sort of pilot project. ...And as using C Sharp, I found it's not so slow. It's very productive and supports classical OOP and more, it has been wel...
StringBuilder in native call to managed COM server (3 replies)
microsoft.public.dotnet.framework.interop
I have a C# com server that needs to return a string to a native c app. The definition of the C# method is: void getText(string property,[Out,MarshalAs (UnmanagedType.LPStr)] StringBuilder str) I call it from native c by char test [1000]; csi getText(test); But I get a chrash if the C# methods writes more than 16 chars to str. I guess I need to specify the size of the buffer somehow. But how? I ha...
managed code in COM+ (2 replies)
microsoft.public.dotnet.framework.interop
Can I add managed code component in COM . I get an error 'One or more files do not contain components or type libraries. These files cannot be installed.' Why?
Single instance COM (2 replies)
microsoft.public.dotnet.framework.interop
I want to expose my assembly to COM as a single instance COM server, so I can call CreateObject in one VBScript to create the first instance, then GetObject in another VBScript to get the same instance previously created. Currently, both CreateObject and GetObject calls work, but the GetObject call creates a new instance. Is there a way (interop attribute?) to do this? Chris
.NET calling COM+ object questions (6 replies)
microsoft.public.dotnet.framework.interop
I have a very simple COM object. It has one class with one function that simply returns my name in string. I have this object installed in COM manager. I use tlbimp.exe to create the type lib required for .Net I reference this newly created type lib from a .NET VB forms app and a ASP.NET app. VB.NET ******* I make the call and get required result. Everytime I call the object i notice the number of...
Marshalling a structure with an array of structures as a member (3 replies)
microsoft.public.dotnet.framework.interop
I need an example of how to marshal a structure that has an array of structures as a member. Here's the definition in C : typedef struct { ULONG ulField1; LPSTR lpszString1; } SubStruct, FAR * lpSubStruct; typedef struct { ULONG ulField1; LPSTR lpszString1; ULONG nArrayCount; lpSubStruct lpStructArray; } MainStruct, FAR * lpMainStruct; typedef ULONG (FAR PASCAL MYFUNC)( lpMainStruct lpMain ); MYFU...
GDI and .Net (6 replies)
microsoft.public.dotnet.framework.interop
Hello In general, how should I be using GDI functions in .Net? (e.g. MapWindowPoints()). Should I interop to the GDI funtions or should I be using the .Net classes? As a newbie C#/.Net programmer, I'm not sure what's frowned upon. Should I fall back on functionality I'm used to by interop ing or should I stay within the framework's class library? A specific example is the MapWindowPoints() functio...
CryptoAPI Wrapper Class (2 replies)
microsoft.public.dotnet.framework.interop
Hallo, I just try to write a wrapper for the CryptoAPI for .Net. I have a problem with one method, which I declare as follows: /* BOOL WINAPI CryptGetHashParam( [in] HCRYPTHASH hHash, [in] DWORD dwParam, [out] BYTE *pbData, [in,out] DWORD *pdwDataLen, [in] DWORD dwFlags); */ [DllImport("advapi32.dll", EntryPoint "CryptGetHashParam", CharSet CharSet.Auto)] public static extern bool CryptGetHashPara...
Excel automation error (2 replies)
microsoft.public.dotnet.framework.interop
I am trying to automate Excel 2002 from C#. I create a Windows Application, add a reference to "Microsoft Excel 10.0 Object Library", and write the following code: .... Excel.Application eApp; Excel.Workbook eBook; Excel.Worksheet eSheet; eApp new Excel.Application(); eApp.Visible true; eBook eApp.Workbooks.Add (Excel.XlWBATemplate.xlWBATWorksheet); .... The last line generates the following excep...
Unable to find entry point in DLL (4 replies)
microsoft.public.dotnet.framework.interop
Hi, I'm experimenting with VS.NET (RC1) and C interop via P/Invoke. I've built a DLL with a simple exported function and have tried to access via C# interop and am having the following problem: After compilation, when I run the C# executable it can't find the DLL. So, I put a shortcut to it in the Debug directory of the C# executable still no joy. Even a comple copy of it in the Debug directory is...
Standalone EXE Hosting COM Objects (8 replies)
microsoft.public.dotnet.framework.interop
Is there a way to create an WinForm EXE and expose COM interfaces so that when an instance of this EXE is running and an unmanaged piece of code want to create an instance of interface, the CCW will use the currently running instance an not create a new instance all the time? I want to create a C# application that mimics the functionality of a standalone local .EXE COM Server. Thanks,
System.InvalidCastException: QueryInterface for Interface HSServer._OLESteuerung failed. (4 replies)
microsoft.public.dotnet.framework.interop
Hi, another problem while calling a remote COM Server from a WebApplication. If I create a WinForm application and call the methods of the COM Server, it works. Doing exactly the same inside a WebApplication results in the following error message: "System.InvalidCastException: QueryInterface für Schnittstelle HSServer. OLESteuerung fehlgeschlagen." (Translation see topic) Yesterday I created one s...
Problems with interop and third-party COM object (3 replies)
microsoft.public.dotnet.framework.interop
I have a COM object from a third party that I would like to use inside a C# object. I set a reference to the object and the RCW was constructed. I am having trouble with type casting objects returned from method calls on the object. Assume, sample code to call the component in VB/VBScript looks like: set obj CreateObject("ThirdParty.MyObject") set hash obj.CreateHash() has.put "foo", "bar" obj.Som...
Equivalent of VB "GetObject" in C# (4 replies)
microsoft.public.dotnet.framework.interop
I am trying to get to a running instance of Visio in C#. In VB it is a no brainer GetObject( ,"Visio.Application" ) In C#, I import the Visio type library and do a new Visio.Application(), or Activator.CreateInstance, but of course they always create a another instance. I looked into Activator.GetObject but the stumbling block there us properly defining the URL. I've tried a few things, but no luc...
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com