|
Oh sure, bring RTFM technology into the discussion
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello....I have this function(printinstance()) who generate me randomly boxes(whith another function) with width,height and depth, and I want to save the results in XML, but it only save me just the last box generated...can you figure out what it is the problem in my code please...I have to do this very quick and I am a beginer in XML.
where f-is the first box generated and l-is the last box generated
void printinstance(item *f, item *l, itype W, itype H, itype D)
{ int p,Wcont,Hcont,Dcont;
int const max=1000;
item *i,*j;
itype x1, y1, z1,x2, y2, z2;
stype vol, totvol;
int notip,po;
Wcont=(int)(W);
Hcont=(int)(H);
Dcont=(int)(D);
for (i=f;i<=l;i++)
{
notip=1;
x1 = i->dx; y1 = i->dy; z1 = i->dz;
for (j=i+1;j<=l;j++)
{
if ((i->dx==j->dx)&&(i->dy==j->dy)&&(i->dz==j->dz)) notip++;
}
p=1;
for (j=f;j if ((j->dx==i->dx)&&(j->dy==i->dy)&&(j->dz==i->dz))
{
p=0;
break;
}
if (p)
{
x1=i->dx;
y1=i->dy;
z1=i->dz;
XmlTextWriter^ writer = gcnew XmlTextWriter("d:\\contload.xml",Encoding::UTF8);
writer->Formatting = Formatting::Indented;
writer->Indentation=4;
writer->WriteStartDocument();
writer->WriteStartElement("ContainerSolution");
writer->WriteStartElement("ContainerDimensions");
writer->WriteAttributeString("ContainerWidth",W.ToString());
writer->WriteAttributeString("ContainerHeight",H.ToString());
writer->WriteAttributeString("ContainerDepth",D.ToString());
writer->WriteStartElement("Boxes");
writer->WriteAttributeString("BoxWidth",x1.ToString());
writer->WriteAttributeString("BoxHeight",y1.ToString());
writer->WriteAttributeString("BoxDepth",z1.ToString());
writer->WriteEndElement();
writer->WriteEndElement();
writer->WriteEndElement();
writer->WriteEndDocument();
writer->Close();}}}
and I call my function in the main program like this printinstance(f, l, W, H, D);
|
|
|
|
|
I tried to look through your code but because of HTML reformatting there's some stuff missing.
This is a short function - can't you step through with the debugger?
If it's only writing the last box then single stepping through one iteration should show you why
it's not writing any items except the last.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi all,
I've hunted around, but can't seem to find anything on this. I could be searching for the wrong keywords.
What I'd need to do, is monitor all the shares on the local pc, and take note of open files, and which user has the files open. So far I can use NetSession enum to get some info, but it gives me "[::1]" in the sesi2_cname field. It doesn't tell me what files are open though for the user it tells me about.
Does anyone have any recommendations?
Cheers
Jubjub
"If you're too careful, your whole life can become a f---in' grind." - Mike McD ( Rounders)
|
|
|
|
|
Finally found what I needed.
Use NetFileEnum.
"If you're too careful, your whole life can become a f---in' grind." - Mike McD ( Rounders)
|
|
|
|
|
I got this error from command prompt
DOS/16M: [2] not a DOS/16M executable 'C:\ASMM77\ASMM77.EXE'
How i can solve this error?
Thank You.
|
|
|
|
|
Wow - not only is this not a C++/CLI question, it doesn't look like a C++/programming question at all.
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 friends
i have problem with my data structure in c++ and i need resource for data structure in c++ please introduce me new source and tell me how i can pass this course?
Thanks
|
|
|
|
|
|
Hi,
My class is defined as follows:
[DebuggerDisplay("Path: {m_hFilePath}")]
public ref class CVNAFile : Object
{
.
.
public:
String^ m_hFilePath;
.
.
};
It compiles without warnings but I see no change in debug from the way it worked without the attribute. Also I see no evidence of the attribute in ILDASM but I don't really know what to look for.
Thanks,
Bill Below
|
|
|
|
|
I'm a bit new to Managed C++, (and frankly, am not overly experienced with C++ at all, being more conversant with Java) and so I was wondering what techniques are commonly used to separate the view from the model in Managed C++.
Specifically, we are working on a distributed application that is hoped to be very platform independent although we are using .NET for the initial implementation.
In addition, we would like to eventually be able to use a Software Engineering CASE Tool to generate as much of the "model" part of the code as possible. The tool we have in mind doesn't emit .NET Windows Forms code, which is another reason for wanting to separate the model from the view.
So the question is, what "patterns" or techniques are commonly used or considered "best practice" for using .NET forms to display and control other "workhorse" modules which are written in "pure" C++?
_________
. | homas
|
|
|
|
|
George L. Jackson wrote: This is just being introduced with the Windows Presentation Foundations (WPF) in .NET Framework 3.0.
If by "just" you mean "not prior to" that is not accurate. If you mean in a platform from MS then arguably MFC is very close to MVC and has been around for a long-long time. Also a discussion of MVC and a Controller framework has been available on the Microsoft Patterns and Practices for ??? not sure but at least two years.
led mike
|
|
|
|
|
tcompter wrote: I was wondering what techniques are commonly used to separate the view from the model in Managed C++.
Well I don't know how "common" it is, especially by people that frequent Code Project, but I have been using the MVC Pattern[^] for years with great success.
Another place you might want to check out is the Microsoft Patterns and Practices site[^].
led mike
|
|
|
|
|
I'm writing a programme for my final project which I have to finish in two days This programme includes a TCPListener to get some data over TCP/IP protocols. So I've made a second thread for this TCPListener. Otherwise, other components woudn't work at the same time due to infinite loop as u predict. But, now I have an other problem; When I start my thread as I wrote below;
Form1^ s = gcnew Form1();
ThreadStart^ serverDelegate = gcnew ThreadStart(s,&MyMessenger::Form1::ServerActivate);
Thread^ serverThread = gcnew Thread(serverDelegate);
serverThread->Start();
ServerActivate function (which includes TCPListener) works correctly, can call other functions, but while this thread is working I can not control the properties of components of Form1, such as textbox->text. I've tried many things, but I couldn't. Please help me, how can I solve this problem?
|
|
|
|
|
See if this[^] helps
led mike
|
|
|
|
|
I will study. I hope I find necessary things. Thanks...
|
|
|
|
|
Hi, I'm using Visual Studio 2005 C++/CLI. I am trying to automate Excel 2003. I can get the application and workbook and sheets and ranges but I can't seem to figute out what method to use to actually populate the cell with data. With MFC it used to be Range.SetValue but I can't find the new CLI method that does this. The Microsoft site has a location for the Application, Workbook, Worksheet, and Range interfaces but when I go to look at the details of these the documentation says "the methods are listed in the table below" and there is no table.
Buck
|
|
|
|
|
There seems to be a problem with the Office Documentation but somehow I found my way in, it wasn't pretty.
This[^] seems to indicate that (Value) is a property.
If you are not using the Primary Interop Assembly available from the MSDN web site you should be. It might make things a bit simpler.
Also if you are struggling with the CLI part start a C# project and reference Excel assembly in there so you can use it to see how to work with the Object Model then port to CLI. Alternatively you can build your own C# Library that encapsulates what you want to do with Excel and then use that interface in your CLI code.
led mike
|
|
|
|
|
Thanks Mike,
I will focus on this. I am using the PIA's.
Buck
Buck
|
|
|
|
|
Hello,
I am trying to implement a bit shift function that would shift bit positions either to the right or left using the codes below.
The bit shift is not working can someone help with why it is not working?
public: System::Void apply_BitShift(String ^myString, String ^direction, int numOfShifts)
{
bitShiftVal = "";
array<__wchar_t> ^shiftArray = gcnew array<__wchar_t> (myString>Length);
//copy characters from myString into shiftArray
myString->CopyTo(0, shiftArray, 0, myString->Length);
if(direction->Equals("left"))//Perform left shifts
{
bitShiftVal = gcnew String(shiftArray, numOfShifts, (myString->Length)-numOfShifts);
for(int indx=0; indx<numofshifts; indx++)
="" bitshiftval="String::Concat(bitShiftVal," "0");=""
="" }
="" else="" if(direction-="">Equals("right"))//perform right shifts
{
for(int indx=0; indx<numofshifts; indx++)
="" bitshiftval="String::Concat(bitShiftVal," "0");
=""
="" for(int="" indx="0;" indx<shiftarray-="">Length-numOfShifts; indx++)
bitShiftVal = String::Concat(bitShiftVal, shiftArray[indx].ToString());
}
}//end of apply_BitShift
dee
|
|
|
|
|
Have you stepped through your code to see what exactly is happening?
led mike
|
|
|
|
|
I'm not seeing any bit shifting going on in your code...
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
we probably aren't seeing the code correctly due to the '<' '>' characters. Also in my browser there is a giant Fish Filet obscuring his post.
led mike
|
|
|
|
|
I guess we use the same browser!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hello, I have an project which generate boxes(bin packing) and I want to save the results on the disk so I can use this results in matlab or to save this results in xml so i can use xml for further reaserch please..if you know how can i do this help me .... ...if you can give me some clues...
lavi
|
|
|
|