|
|
|
If Christian Graus were around he would let you know that this is the C++/CLI forum, as the first message in the forum states, and your question does not seem to pertain to that subject therefore it is in the wrong forum.
To find the answer to your question read the documentation on the _T() macro.
led mike
|
|
|
|
|
Hi,
I have a function DataPeak(const void* el1, const void* el2) in class oconvew.h
Now i have to pass this as an argument to other function
qsort(void*, size_t, size_t,pointer to DataPeak)
I did like this
qsort(x,num,sizeof(m),&oconvew::DataPeak)..
It is giving qsort cannot convert all required two arguments.
Any help is appreciated.
Thanks, Eswari
|
|
|
|
|
If Christian Graus were around he would let you know that this is the C++/CLI forum, as the first message in the forum states, and your question does not seem to pertain to that subject therefore it is in the wrong forum.
To learn more about function pointers in C++ search Google for: cplusplus "function pointers"
led mike
|
|
|
|
|
sorry for posting in the wrong forum and at the same time thanks for your answer
|
|
|
|
|
|
Hello,
first off, bear with me as i posted this question on another newsgroup a couple of hours ago (but my thread does not look like getting answered during the next week).
So here's the problem. I tried to translate this c# example to c++/cli:
CustomVertex.PositionNormalTextured[] verts =<br />
(CustomVertex.PositionNormalTextured[])_mesh.VertexBuffer.Lock( 0,<br />
typeof( CustomVertex.PositionNormalTextured ),<br />
LockFlags.None,<br />
_mesh.NumberVertices );<br />
Looks simple and should be simple to translate. But...
array<Direct3D::CustomVertex::PositionNormalTextured, 1>^ myVertices = gcnew<br />
array<Direct3D::CustomVertex::PositionNormalTextured, 1><br />
(myMesh->NumberVertices);<br />
myVertices = safe_cast<array<Direct3D::CustomVertex::PositionNormalTextured,<br />
1>^> (myMesh->VertexBuffer->Lock(0,<br />
Direct3D::CustomVertex::PositionNormalTextured::typeid,<br />
Direct3D::LockFlags::None));<br />
gives me an IndexOutOfRangeException.
So i think i have to use gcnew in the second line. But how?
I just can't figure out the right syntax to solve this problem.
Or is there just something else wrong?
I hope, someone is able to help me on this.
|
|
|
|
|
VertexBuffer.Lock returns an Array pointer but you are casting it to an array pointer.
Maybe something like this...
Array ^myVertices = myMesh->VertexBuffer->Lock(0,
Direct3D::CustomVertex::PositionNormalTextured::typeid,
Direct3D::LockFlags::None);
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
You are right, but the cast seems to be needed as i'm going from system::array to array<...> and as system::array is an abstract class (ok one can create an instance of such an array, but that's another story), i had to go through a cast.
But the problem was solved (not by me btw )
Here's the right way to do it:
array<Direct3D::CustomVertex::PositionNormalTextured>^ myVertices = safe_cast<array<Direct3D::CustomVertex::PositionNormalTextured>^> (myMesh->VertexBuffer->Lock(0, Direct3D::CustomVertex::PositionNormalTextured::typeid, Direct3D::LockFlags::None, myMesh->NumberVertices));
The last parameter made it.
Thanks for trying to help me, Mark.
|
|
|
|
|
Cool thanks for the update! I didn't know you could cast between those
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I am doing like this in my .h file
String^ strpath="dff";
CString strDataPath(strpath);
GetXcaliburDataPath(&strDataPath);
In the last line the compiler is issuing a error like this
cannot convert from CString* to CString&.
Thanks in advance.
|
|
|
|
|
It seems, function GetXcaliburDataPath is declared to take CString& as parameter, where as you are sending address of string.
Modify it to,
GetXcaliburDataPath(strDataPath);
Prasad
MS MVP - VC++
|
|
|
|
|
In that case i am getting linker errors as unrecognzed token in the function GetXcaliburDataPath?
Thanks in advance.
Regards, Eswari
|
|
|
|
|
subramanyeswari wrote: CString strDataPath(strpath);
I'm curious what CString constructor takes a managed String pointer as an argument?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
The VC7 CString class has a constructor that takes a managed String pointer and loads the CString with its contents:
//#include <atlstr.h>
System::String * str = S"Hello world\n";
CString str3(str);
printf(str3);
|
|
|
|
|
I figured that but I didn't see it in VS2003 so I thought maybe it was new to 2005...
I just looked again and there it is!
Thanks!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello,
I am trying to define an array , with the codes below , but it throws and exception can anyone tell me what i'm doing wrong?
array<__wchar_t> ^xArray = gcnew array<__wchar_t>(x->Length);
array<__wchar_t> ^yArray = gcnew array<__wchar_t>(y->Length);
dee
|
|
|
|
|
Obvious question, but you're using C++/CLI, right?
Are x and y both non-null ?
What exception are you getting?
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
Instant C++: converts C# to C++/CLI and VB to C++/CLI
Instant Python: converts C# to IronPython and VB to IronPython
|
|
|
|
|
Yes x and y are both non-null I get a null reference exception
dee
|
|
|
|
|
This is obviously C++/CLI - what is the exception ? What happens when you step through/check variables in the debugger ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all,
I am transferring from .NET 2003 to .NET 2005 now. I have one application made in Visual C++.NET 2003. It is compiling fine in .NET 2005 but it gives one run time error at ShowDialog() function of OpenFileDialog Class object. Error is
"An unhandled exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll
Additional information: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process."
Can I know what is wrong with this? And how can I solve this problem.
Thanks in advance,
Priyank
|
|
|
|
|
See here[^]
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Is there any good samaritan there who could explain the difference between:
Visual C++ / MFC
(Managed) C++/CLI
Which forum should I address my questions if I am programming in C++ using the Win32 console application of VS2005?
Thanks
|
|
|
|
|
J_E_D_I wrote: Which forum should I address my questions if I am programming in C++ using the Win32 console application of VS2005
The Visual C++ / MFC one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|