marshalling

CharSeT.Ansi does not contain defination for ansi

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 06:09:10
问题 In C# i am trying to add some additional info like [DllImport("\\SD Card\\ISAPI1.dll", CharSet = CharSet.Ansi)] but build process giving error Error 1 'System.Runtime.InteropServices.CharSet' does not contain a definition for 'Ansi' and the same error "does not contain a defination" i am receiving with Marshal.PtrToStringAnsi(intPtr); i am creating a c# application for WinCE 6.0 回答1: The compact framework does not support ANSI at all. Hence those parts of the framework relating to ANSI do not

CharSeT.Ansi does not contain defination for ansi

↘锁芯ラ 提交于 2019-12-25 06:08:58
问题 In C# i am trying to add some additional info like [DllImport("\\SD Card\\ISAPI1.dll", CharSet = CharSet.Ansi)] but build process giving error Error 1 'System.Runtime.InteropServices.CharSet' does not contain a definition for 'Ansi' and the same error "does not contain a defination" i am receiving with Marshal.PtrToStringAnsi(intPtr); i am creating a c# application for WinCE 6.0 回答1: The compact framework does not support ANSI at all. Hence those parts of the framework relating to ANSI do not

RemotingServices.Marshal(foo, uri) only works for a short period of time. How to keep it working?

。_饼干妹妹 提交于 2019-12-25 05:45:19
问题 When I do RemotingServices.Marshal(foo, uri); And the Client connects, everything works. When I wait for a few minutes and then try to connect the client, the Client throws a RemotingException: Object '{name of service}' has been disconnected or does not exist at the server. What happens here? Is there a timeout of some sort? 回答1: To avoid timeouts, you can add to your remoted object the following overridden method: public override object InitializeLifetimeService(){ return null; } 来源: https:

WICBitmapSource.CopyPixels to GDI Bitmap Scan0

一世执手 提交于 2019-12-25 04:04:08
问题 I've modified the C# IWICBitmapSource.CopyPixels interface to allow both array marshaling and passing a pointer: void CopyPixels( WICRect prc, uint cbStride, uint cbBufferSize, [Out] [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] pbBuffer ); new void CopyPixels( WICRect prc, uint cbStride, uint cbBufferSize, IntPtr pbBuffer ); I'm calling it like this public static Bitmap FromWic(IWICBitmapSource source) { Guid format; source.GetPixelFormat(out format); PixelFormat gdiFormat =

jaxb namespaces in each element instead of root element during marshalling

自闭症网瘾萝莉.ら 提交于 2019-12-25 03:38:29
问题 By default, jaxb 2 lists all (all possible required) namespaces in root element during marshalling: <rootElement xmlns="default_ns" xmlns:ns1="ns1" xmlns:ns2="ns2"> <ns1:element/> </rootElement> Is there a way to describe namespace in each element instead of root element ?: <rootElement xmlns="default_ns"> <element xmlns="ns1"/> </rootElement> It also solves the problem of "unnecessary namespaces", which is also important in my case. Any suggestions appreciated. 回答1: The answer is negative,

PInvoke FbwfFindFirst - FbwfCacheDetail problems

寵の児 提交于 2019-12-25 03:11:33
问题 I'm trying to create a PInvoke for FbwfFindFirst and am struggling with the struct FbwfCacheDetail. In short, I'm not sure how to marshal WCHAR fileName[1]; seeing as it's a variable length array and a non-null terminated. Any help would be welcomed 回答1: Since the whole structure is of variable size, one way to do this is like this (I can't test it because I don't have this dll on my system): string volume = ""; int size = 0; // ask for whole structure size FbwfFindFirst(volume, IntPtr.Zero,

demarshalling an xml where attributes determine type

回眸只為那壹抹淺笑 提交于 2019-12-25 00:34:58
问题 I'm being given xml documents (which I have no control its format). I would like to know if it is possible to demarshal this xml based on element attribute id. So different object types will share the same element name. Also, I'm planning on using Simpile XML because I'm on Android and JAXB doesn't like Android. So I would like something like: class Root { Person p; Car c; ArrayList<Person> plist; } class Person{ String name; } class Car { String type; } from <root> <object id="person"> <name

Cacheing an ActiveRecord Object that has_many through:

自作多情 提交于 2019-12-24 21:50:14
问题 When I try to cache an ActiveRecord object that has a has_many through: relationship, I can't cache the object until I reload or save it. person.rb: class Person < ActiveRecord::Base attr_accessible :name has_many :person_locations has_many :locations, through: :person_locations has_many :person_items has_many :items, through: :person_items end person_item.rb: class PersonItem < ActiveRecord::Base attr_accessible :item_id, :person_id belongs_to :item belongs_to :person end item.rb: class Item

How to marshall java.lang.Exception using JAXB Marshaller?

回眸只為那壹抹淺笑 提交于 2019-12-24 20:38:45
问题 I am trying to marshall java.lang.Exception, but without success. Here's my code - import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; public class JAXBTester { public static void main(String[] args) throws Exception { TestReport report = new TestReport(); report.setReportLog("Tests successful."); File file = new File("TestReport.xml"); JAXBContext jaxbContext = JAXBContext.newInstance(TestReport.class); Marshaller

Marshalling a VARIANT back from COM to C++ client

谁说胖子不能爱 提交于 2019-12-24 18:59:18
问题 I'm attempting to marshal a safearray of BSTRs from a COM object, back to a C++ client application. My IDL definition of the function involved: [id(5), helpstring("method GetStreams")] HRESULT GetStreams( [out,retval] VARIANT* pvarStreamNames ); Here's my implementation of the GetStreams() function: STDMETHODIMP CArchiveManager::GetStreams(VARIANT* pvarStreamNames) { CComSafeArray<BSTR, VT_BSTR> saStreamNames; CComVariant varOutNames; Stream* pNext = NULL; int nNumStreams = m_Streams