Click here to Skip to main content
15,915,019 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Displaying pictures on a web page from a folder Pin
Christian Graus29-Jan-07 22:59
protectorChristian Graus29-Jan-07 22:59 
QuestionCannot Uninstall Windows Services.... Pin
Draqonis29-Jan-07 10:00
Draqonis29-Jan-07 10:00 
AnswerRe: Cannot Uninstall Windows Services.... Pin
Vasudevan Deepak Kumar29-Jan-07 22:39
Vasudevan Deepak Kumar29-Jan-07 22:39 
QuestionHow doI scroll a webbrowser element via code? (c#) Pin
Jasmin Tabatabai29-Jan-07 3:24
Jasmin Tabatabai29-Jan-07 3:24 
AnswerRe: How doI scroll a webbrowser element via code? (c#) Pin
Thomas Stockwell3-Feb-07 16:04
professionalThomas Stockwell3-Feb-07 16:04 
QuestionCan any body tell me what are the steps and requisites to host an asp.net Pin
indian14328-Jan-07 19:35
indian14328-Jan-07 19:35 
AnswerRe: Can any body tell me what are the steps and requisites to host an asp.net Pin
Christian Graus28-Jan-07 19:44
protectorChristian Graus28-Jan-07 19:44 
GeneralRe: Can any body tell me what are the steps and requisites to host an asp.net Pin
indian14328-Jan-07 19:50
indian14328-Jan-07 19:50 
Questionhow to add crystal reports to vs .net 2005 standard edition Pin
MD1228-Jan-07 19:20
MD1228-Jan-07 19:20 
QuestionHow can I create a short cut key any button in .net Pin
indian14328-Jan-07 18:02
indian14328-Jan-07 18:02 
AnswerRe: How can I create a short cut key any button in .net Pin
Christian Graus28-Jan-07 18:42
protectorChristian Graus28-Jan-07 18:42 
GeneralRe: How can I create a short cut key any button in .net Pin
indian14328-Jan-07 19:37
indian14328-Jan-07 19:37 
GeneralRe: How can I create a short cut key any button in .net Pin
Christian Graus28-Jan-07 19:43
protectorChristian Graus28-Jan-07 19:43 
GeneralRe: How can I create a short cut key any button in .net Pin
indian14328-Jan-07 23:27
indian14328-Jan-07 23:27 
QuestionExtending large project to Unix (Mono) Pin
Libor Tinka28-Jan-07 10:36
Libor Tinka28-Jan-07 10:36 
QuestionDetecting AxWebBrowser scroll bars Pin
the red baron27-Jan-07 20:37
the red baron27-Jan-07 20:37 
Questioncan any body tell me the code for customizing the crystal reports Pin
indian14326-Jan-07 18:30
indian14326-Jan-07 18:30 
Question.Net Reactor Pin
Glen Harvy26-Jan-07 13:55
Glen Harvy26-Jan-07 13:55 
Questionwebcam preview Pin
sini8725-Jan-07 12:15
sini8725-Jan-07 12:15 
AnswerRe: webcam preview Pin
Christian Graus26-Jan-07 10:51
protectorChristian Graus26-Jan-07 10:51 
Questionmanaged c++.net: allocating the memory for an array of struct in a coherent memory area Pin
HUMPPAAA!25-Jan-07 9:43
HUMPPAAA!25-Jan-07 9:43 
Hi,

first of all, plz excuse my rusty english Wink | ;)

I'm writing a little wrapper in c++ .net which allows me to access some old unmanaged win32 c++ dlls from a c# program.

There is one function in the dll which drives my crazy.

It wants an array of struct as an argument, called by reference.

Its code is looking like that (a bit simplified):
the struct in c++.net and in the dll code:
<br />
struct ParaList<br />
{<br />
  BYTE adress;<br />
  WORD length;<br />
};<br />


the dll function prototype (in the dll -> non c++.net):
<br />
BOOL RequestValues(ParaList list[], int listlength);<br />


I included it into my c++ .net like following code:
<br />
[DllImport("mydll.dll",EntryPoint="_RequestValues@12")]<br />
extern "C" bool_cdecl RequestValues(ParaList *list, int listlength); <br />


What it does is: I can request the values of some parameters by executing the RequestValues() function.
After that I can read the requested values by executing a readfunction().

I'm calling the function in managed c++.net like that:
<br />
ParaList list[8];<br />
list[0].adress = 0x1;<br />
list[0].length = 0x1;<br />
bool error = RequestValues(list, 1); //querying for one parameter value<br />

The problem now is: when the list only has one parameter (like in the example above) the function works correct. But when I request more than one parameter, the dll will put out some error.

In a c++ mfc example the dll is working correct!

I think the problem is related in the memory management of c++.net.
I'm pretty new to c++.net. Am I right that in managed c++.net the allocated memory for an array must not be in sequence? So the single elements of the array are distributed all over the memory?
In that case the dll would get only the pointer on the first array element but the second element is not the neighbour, so the dll reads garbage when it wants to read the data of the second array element.

I tried a few things with __pin and __nogc keywords which led to nothing Frown | :(

Does anyone have a clue how I can tell c++.net to allocate the memory for the array in a coherent memory area?

Thanks for reading this!
~Sepp
AnswerRe: managed c++.net: allocating the memory for an array of struct in a coherent memory area Pin
Christian Graus26-Jan-07 10:51
protectorChristian Graus26-Jan-07 10:51 
GeneralRe: managed c++.net: allocating the memory for an array of struct in a coherent memory area Pin
HUMPPAAA!31-Jan-07 23:25
HUMPPAAA!31-Jan-07 23:25 
GeneralRe: managed c++.net: allocating the memory for an array of struct in a coherent memory area Pin
Luc Pattyn1-Feb-07 1:56
sitebuilderLuc Pattyn1-Feb-07 1:56 
QuestionDataBinding the UI control to the array element ? Pin
Patrick Sky24-Jan-07 20:57
Patrick Sky24-Jan-07 20:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.