Visual studio c++?

I have run into all sorts of issues with using c++ in visual studio the biggest one of all is that when it defines classes as ref class I can no longer assign pointers...

1
2
	
AutoTyper* autoTyper = (AutoTyper *)lParam;


Errors:


Error 2 error C2440: 'type cast' : cannot convert from 'LPVOID' to 'AutoTyper ^' C:\Users\User\Documents\Visual Studio 2013\Projects\Dans Auto Typer\Dans Auto Typer\AutoTyper.cpp 8 1 Dans Auto Typer

Error 1 error C3699: '*' : cannot use this indirection on type 'AutoTyper' C:\Users\User\Documents\Visual Studio 2013\Projects\Dans Auto Typer\Dans Auto Typer\AutoTyper.cpp 8 1 Dans Auto Typer

3 IntelliSense: an ordinary pointer to a C++/CLI ref class or interface class is not allowed c:\Users\User\Documents\Visual Studio 2013\Projects\Dans Auto Typer\Dans Auto Typer\AutoTyper.cpp 8 11 Dans Auto Typer



That code should work fine but it doesn't! I can't cast like this when defining a ref class and when I change it to a normal class I get problems with the GUI. How can I reference a pointer to this please?
Last edited on
bump
3 IntelliSense: an ordinary pointer to a C++/CLI ref class or interface class is not allowed

There is a difference between managed memory and unmanaged memory in C++/CLI. You cannot treat them as if they were the same. Why do you think you need to create an unmanaged pointer to an object allocated in the managed heap?
Last edited on
Topic archived. No new replies allowed.