Pointers and Mangaged types

G

Guest

I have the follow srtuct

public struct tDEVFOUND
{
public char[] bda;
public char[] dev_class;
public char[] name;
public int connected;
};

and i want to be able to the members, but i wanted to make a pointer..ie
tDEVFOUND *a;

but i get a compile error...is there anyway to do this??
 
G

Guest

it may seem odd to have a pointer to the tDEVFOUND, but this is why

protected override void WndProc(ref Message msg)
{
switch (msg.Msg)
{
case WM_BRCM_INQ_COMPL:
unsafe
{
tDEVFOUND *a;
a = (tDEVFOUND *)msg.LParam.ToPointer();
destinationForm.OnDevFound(a->bda, a->dev_class, a->name, a->connected);
}
break;
..
..
..
}

this is the code i am trying to get working, howeverit wont complie

Sylvain Lafontaine said:
In unsafe mode, you can have pointer; however, I don't see the purpose here
for having a pointer to tDEVFOUND. Also, don't forget that with pointers,
you will loose some capabilities of the managed environment.

See:
http://msdn.microsoft.com/library/d.../en-us/csref/html/vcwlkunsafecodetutorial.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrffixed.asp

S. L.

Thaynann said:
I have the follow srtuct

public struct tDEVFOUND
{
public char[] bda;
public char[] dev_class;
public char[] name;
public int connected;
};

and i want to be able to the members, but i wanted to make a pointer..ie
tDEVFOUND *a;

but i get a compile error...is there anyway to do this??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top