Re: [ADVANCED-DOTNET] PInvoke with an LPWSTR* parameter

2002-09-27 Thread Mattias Sjögren
Chad, >Just out of >curiosity, is there a setting some where to change this default behavior? If you set CharSet=CharSet.Unicode in the DllImport attribute on the function, the default for all string parameters becomes LPWSTR. And CharSet.Auto => LPTSTR. Mattias === Mattias Sjögren [EMAIL P

Re: [ADVANCED-DOTNET] PInvoke with an LPWSTR* parameter

2002-09-27 Thread Chad M. Gross
I didn't try your parameters below, but one thing for sure is that when using the string for the LPWSTR*, you must use the [MarshalAs (UnmanagedType.LPWStr)] attribute in the declaration on the string. If you don't, the string will only contain the first character. This is because the default ma

Re: [ADVANCED-DOTNET] In C#, is a "const" member accessible in static methods?

2002-09-27 Thread Christopher Brown (NDP)
Pierre is right and in these instances, sometimes it helps to look at the IL generated: Here's a simple class with both a const and a static readonly: using System; public class Testcctor { const int this_is_const = 6; public static readonly int this_is_sro =5; public v

Re: [ADVANCED-DOTNET] PInvoke with an LPWSTR* parameter

2002-09-27 Thread Mattias Sjögren
Chad, In this case "[MarshalAs(UnmanagedType.LPWStr)] ref/out string" will work, because the runtime frees the string memory with CoTaskMemFree() by default, and FindMimeFromData() allocates it with CoTaskMemAlloc(). If you for some reason want to use an IntPtr parameter instead, free the mem

Re: [ADVANCED-DOTNET] PInvoke with an LPWSTR* parameter

2002-09-27 Thread Oren Novotny
Chad, Have you tried the following definition? You shouldn't need to worry about memory management at all--that's Interop's job. You also shouldn't need to declare the exact type, as the types should be automatically mapped as listed in the MSDN docs[1]. I'm also pretty sure that the [DllImpo

Re: [ADVANCED-DOTNET] The dreaded licenses.licx

2002-09-27 Thread James Crowley
Kevin, Basically, your LicenseProvider can be called when context.UsageMode is Runtime or Designtime. At designtime, you want to be grabbing the license key from a text file/registry entry. At runtime, you want to grab it from the compiled assembly that is calling your control. When the licenses

[ADVANCED-DOTNET] PInvoke with an LPWSTR* parameter

2002-09-27 Thread Chad M. Gross
I am calling the FindMimeFromData in urlmon and I want to make sure I don't have any memory leaks on the unmanaged side. I have two versions of the call, one using a ref IntPtr and one using a [MarshalAs (UnmanagedType.LPWStr)] ref string to represent the LPWSTR*. My hunch is the latter "Marshal

[ADVANCED-DOTNET] The dreaded licenses.licx

2002-09-27 Thread James Crowley
(Thanks to Mattias for answering my last question) Hi, I've implemented my own LicenseProvider and License for my component. This bit works fine; it grabs the key from the registry and saves it. However, obviously, in order for it to save it, I need a licenses.licx file in the hosting applicatio

Re: [ADVANCED-DOTNET] Design Issues using .Net Remoting

2002-09-27 Thread Ross Diesel
Thomas, the web service invocation is async (by default) so the webservice component could partially process the call and then effect an efficient system wait on an event without blocking the client. I'm obviously assuming here that the webservice component is multithreaded. Cleanup issues under

Re: [ADVANCED-DOTNET] Design Issues using .Net Remoting

2002-09-27 Thread Thomas N. Schwarz
Ross Diesel suggested... > I would use a WebServices behaviour, which is a reusable DHTML component > that uses Web Services by communicating over HTTP using SOAP... Using the WebServices/SOAP method your'e suggesting looses the asynchronous notification (Server -> Browser) capabilites Giri is

[ADVANCED-DOTNET] out of process session management and NLB with .NET server

2002-09-27 Thread Eric F. Cotter
Hello, I'm using the Windows .NET 2003 Enterprise NLB service in conjunction with the out of process session management service. I'm not certain why, but when I try to hit a test page on one of the host boxes it crashes! I'm using IIS 6.0 Worker Process Isolation Mode with an application pool a

Re: [ADVANCED-DOTNET] Interposer class and problems

2002-09-27 Thread Petter Nilsen
...and to answer myself again, change the following line: System.Reflection.ParameterModifier pm = new System.Reflection.ParameterModifier( tempArgs.Length ); to this so it will handle COM calls without arguments: System.Reflection.ParameterModifier pm =