Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi i need help with this.
Currently im doing a google earth application.
but i've met with this problem,

It's showing me this error:
A using namespace directive can only be applied to namespaces; 'System.Runtime.InteropServices.HandleRef' is a type not a namespace

What can i do ?
Please help. Thanks.
Posted

1 solution

you should be doing this:
Remove HandleRef. HandleRef is a type

instead add
using System.Runtime.InteropServices

to your list of namespaces.
 
Share this answer
 
Comments
bearbear91 27-Jul-11 0:26am    
i've added that in, but it still doesn't work. thanks.
Kim Togo 27-Jul-11 2:28am    
What does not work? It cannot compile, it has runtime error ?
bearbear91 27-Jul-11 3:58am    
yeah. it has a error saying override. the following is my coding:


protected override HandleRef BuildWindowCore(HandleRef hwndParent)
{
// start google earths
EARTHLib.ApplicationGE ge = null;
ge = new ApplicationGEClass();

ge.LoadKmlData(@"\Resources\Etc\GoogleEarth.kml");

int googleearth = ge.GetRenderHwnd();

IntPtr hwndControl = IntPtr.Zero;
IntPtr hwndHost = IntPtr.Zero;
int hostHeight = 200;
int hostWidth = 300;

hwndHost = CreateWindowEx(0, "static", "",
WS_CHILD | WS_VISIBLE,
0, 0,
hostHeight, hostWidth,
hwndParent.Handle,
(IntPtr)HOST_ID,
IntPtr.Zero,
0);

int oldPar = SetParent(googleearth, (int) hwndHost);
// check to see if I'm now a child
if (IsChild(hwndHost.ToInt32(), googleearth)) {
System.Console.WriteLine("now a child");
}

return new HandleRef(this, hwndHost);
}

protected override void DestroyWindowCore(HandleRef hwnd)
{
throw new NotImplementedException();
}
}
}

It's not the full coding. It's where the error are found.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900