|
Is there a possible redefinition / undef of the same variable in that .cpp file ?
Darka [Xanya]
|
|
|
|
|
no unfortunately not.. It just seems to be ignoring anything that I put in as a preprocessor variable.
|
|
|
|
|
bugger, i suppose you've checked spelling, etc.
Darka [Xanya]
|
|
|
|
|
Yeah, it's the wierdest thing. I mean it uses precompiled headers via stdafx.h
I am not sure why this is not working. The other thing that is sort of unique is that the MIDL compiler has a preprocessor variable as well. I don't think that should matter though, but I am pretty sure that is rare.
The IDL is compiling correctly though with the preprocessor doing what it should.
|
|
|
|
|
Can anyone tell me how can I overcome the following error:
Error 39 error C2440: '=' : cannot convert from 'void *' to 'System::Data::DataColumn ^'
Here is the code which is generating error:
CPtrList* MYpclFields; // this is working fine
POSITION MYposField; // is having the right value
DataColumn^ pColumnInfo; // System::Data::DataColumn object
...
...
...
pColumnInfo = MYpclFields->GetNext (MYposField); // error lies here
actually GetNext() fn. returns a (void *) and I want to convert that into (DataColumn^).
Plz...
Thanks...
|
|
|
|
|
Handle (^) and pointer (*) are not castable. The former is managed; the latter is unmanaged.
Best,
Jun
|
|
|
|
|
What should I do to get rid of it?
I need to convert void* to System::Data::DataColumn^
It's very important.
-- modified at 8:32 Thursday 13th July, 2006
Eariler I converted managed (^) to unmanaged (*)
pclFields->AddTail ((void *) pclFieldInfo);
Where pclFiledInfo is of type DataColumn^ and it's working perfectly fine.
|
|
|
|
|
Handle(^) walks through the managed heap, while pointer(*) walks through the unmanaged heap. They don't see eye to eye.
arvindbhateja wrote: I need to convert void* to System::Data::DataColumn^
You can't.
arvindbhateja wrote: Eariler I converted managed (^) to unmanaged (*)
pclFields->AddTail ((void *) pclFieldInfo);
This is wrong. By doing so, you may have corrupted GC (garbage collection) on the managed heap. On the other hand, the managed C++ provides a mechanism to pin an object on the managed heap. The pinning is a process to temporarily keep the contant address of an object on the managed heap. Here is some sample code extracted from the C++/CLI spec:
void f(int* p) { *p = 100; }
int main() {
array<int>^ arr = gcnew array<int>(100);
pin_ptr<int> pinp = &arr[0];
f(pinp);
}
You could consider this as a temporary "conversion" from managed to unmanaged. But I'm not aware of any "conversion" in the reverse direction.
Best,
Jun
|
|
|
|
|
Thanks for the response.
Is there any alternate to CPtrList which I can use in C++/CLI?
|
|
|
|
|
Yes, there are a whole bunch of collection tyeps you can choose from: link.
Best,
Jun
|
|
|
|
|
Thanks for replying.
If I don't get a solution then I'll have to rewrite a very big logic. Actually I'm migrating an application from VC6 to VC8.
|
|
|
|
|
Hopefully, you don't need to write much logic. CPtrList is just a pointer list (MFC class). It can be easily replaced by a simple list (.NET class), which stores a pointer to a node.
Best,
Jun
|
|
|
|
|
Thanks for helping me so much.
Can u tell me just one more thing - What is the alternate to CMapStringToOb MFC class in C++/CLI. Plz can u suggest me what should I do to write the code in C++/CLI for the code shown below:
<br />
int nCount = clRecSet.GetFieldCount();<br />
CDaoFieldInfo* pclFieldInfo;
CMapStringToOb clTables;
CPtrList* pclFields = NULL;
<br />
for (int ii = 0; ii < nCount; ii++)<br />
{<br />
pclFieldInfo = new CDaoFieldInfo;<br />
clRecSet.GetFieldInfo(ii, *pclFieldInfo, AFX_DAO_SECONDARY_INFO);<br />
if (clTables.Lookup (pclFieldInfo->m_strSourceTable, <br />
(CObject*&) pclFields) != TRUE )<br />
{<br />
pclFields = new CPtrList;<br />
clTables.SetAt (pclFieldInfo->m_strSourceTable, pclFields);<br />
}<br />
pclFields->AddTail ((void *) pclFieldInfo);<br />
}<br />
...<br />
...<br />
<br />
POSITION pos = clTables.GetStartPosition();<br />
while (pos != NULL)<br />
{<br />
pclFields = NULL;<br />
CPtrList* pclFields;<br />
CDaoFieldInfo* pFieldInfo;
<br />
clTables.GetNextAssoc (pos, strCurrTbl, (CObject*&) pclFields);<br />
POSITION posField = pclFields->GetHeadPosition();<br />
int nIndex = 0;
while (posField != NULL)<br />
{<br />
pFieldInfo = (CDaoFieldInfo *) pclFields->GetNext (posField);<br />
<br />
.....<br />
<br />
In the the above code I can replace :
CMapStringToOb -> ?
CPtrList -> ArrayList
CDaoFieldInfo -> DataColumn (Problem with fetching the database table name not the table name which comes from dataset object)
In DataColumn I can't get the name of the table, the column actually belongs to as we can do in CDaoFieldInfo::m_strSourceTable. Actually I've to map the name of the table with it's corresponding column and put that into a CMapStringToOb object.
|
|
|
|
|
CMapStringToOb doesn't seem to have a counterpart in .NET collection classes. It looks you have some work to do.
Best,
Jun
|
|
|
|
|
in VC++.Net I have drawn a Rectangle on the form.
My task is ,when i keep the cursor on Rectangle and (move the Mouse + Mouse Left Button Down) it should move accordingly.
Suggest me..
Thanks In Advance
Bye....
Nagaraju
-- modified at 7:58 Thursday 13th July, 2006
|
|
|
|
|
You should handle some of the mouse events such as MouseEnter, MouseDown, MouseUp, MouseMove and MouseLeave.
Best,
Jun
|
|
|
|
|
that is not my problem.
I have drawn Rectangle On the Form Using Graphics Class.
My code is
Graphics ^gr=this->CreateGraphics();
gr->DrawRectangle(gcnew Pen(Color::Black),90,50,60,60);
and when I keep the mouse on drawn Rectangle
MouseMove+LeftClickMOuse ,the rectangle should move accordingly
plz suggest me
Nagaraju
|
|
|
|
|
Nagaraju_Focus wrote: when I keep the mouse on drawn Rectangle
MouseMove+LeftClickMOuse ,the rectangle should move accordingly
What do you mean "should"? You have to implement this capability manually. Here is what you should do:
1) Identify the mouse events you want link to the rectangle movement and handle these events.
2) In your event handler(s), based on new (x, y) location of your cursor, redraw the screen and rectangle.
Best,
Jun
|
|
|
|
|
Should means the Rectangle On the Frame which i Drawn.
I do a lot work to move the rectangle with mouse events.
Even though they aren't work.
plz suggest me
Nagaraju
|
|
|
|
|
You can look my project whih is named "about event handler" in previous page.
in my code just change drawline into drawrect then u have a rectangle which move with mouse movement.
I have to say that i found mouse stick code in codeproject.com and written in visualbasic.
-- modified at 9:01 Friday 21st July, 2006
|
|
|
|
|
I have the following error while building a sample Form based application. Is this a bug ??
*****************************************************************
Output Window Compiling managed resources...
Unhandled Exception: System.NullReferenceException: [Resource lookup failed - infinite recursion detected. Resource name: Arg_NullReferenceException]
Sample : error PRJ0002 : error result returned from 'resgen.exe'.
*****************************************************************
Pavan
|
|
|
|
|
|
Is loading .NET framework / SDK a solution ?
|
|
|
|
|
it looks like your resource file is attempting to load itself or something like that as the problem is infinite recursion
check your resources very carefully, make sure you don't have a #include "resource.h" in your "resource.h" file.
Darka [Xanya]
|
|
|
|
|
I'm working on a simple game engine, and I'm trying to find out the best method of releasing a Managed Direct3D Device. I'm using VS.NET 2005 SE and the April 06 DirectX SDK, if that helps anyone.
The reason why I want to manually release the device is incase the person playing my game decides to change resolutions in the game, and I have to recreate the device. Or, is resizing the device a better idea?
|
|
|
|