c# - How to pass RECT in COM -


i need rect com c# in 64 bits, defined simple method in idl as:

[id(23), helpstring("method getrect")] hresult getrect([out,retval] rect* prect); 

and implemented in c++ as

stdmethodimp cspot::getrect(rect* prect) { crect rec = get_position();  *prect = rec; return s_ok; } 

i called in c# as:

tagrect rec = pspot.getrect(); 

most time ok, 0xc0000005: access violation writing location 0x0000000000000000.

in line:

*prect = rec; 

what cause exception?

not sure if problem, when using rect com methods, need 'define' rect object following:

[structlayout(layoutkind.sequential, pack = 0)] public struct rect {     public int left;     public int top;     public int right;     public int bottom; } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -