|
Please ask in the right forum, first. Also, type 'screen capture C++' into google and you'll find tons of articles on it.
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 )
|
|
|
|
|
Hello,
i try for display a file event log list, i use For each;
EventLog^ myLog = gcnew EventLog;<br />
for each (System::Diagnostics::EventLogEntry^ entree in myLog->Entries)<br />
MessageBox::Show(entree->Message);
there are a sam code in C#
System.Diagnostics.EventLog eventLog1;<br />
foreach (System.Diagnostics.EventLogEntry entree in eventLog1.Entries)<br />
{ MessageBox.show(entree.Message);}
There are error: An unhandled exception of type 'System.ArgumentException' occurred in System.dll
Additional information: Log property value has not been specified
Please help me to resolve this great problem
|
|
|
|
|
That is not the same code! The C++/CLI code:
EventLog^ myLog = gcnew EventLog; ,
and the C# code:
System.Diagnostics.EventLog eventLog1;
are different.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi ,
Why this small C++ code not working ?
Unable to Identify: Pl. Help:
******************************************************
#include <iostream>
#include <string>
#include
#include <vector>
using namespace std;
class c
{
string *cc ;
public:
c(const string& s1):cc(new string(s1)){}
c(const c& k)
{
cc = new string(k.get());
}
string get(){ return *cc;}
~c(){delete cc;}
};
/*
class x
{
vector <c*>cc;
public:
}
*/
int main()
{
c kk("bvls");
cout<<kk.get()<<endl;
c b(kk);
cout<<b.get()<<endl;
c="" ck="b;
cout<<ck.get()<<endl;
return" 0;
}
***********************************************
whats="" the="" mistake="" i="" am="" committing?="" how="" to="" overcome="" it..??
thank="" you="" in="" anticipation.=""
prasad.=""
<div="" class="ForumSig">Programming is Understanding
--Stroustroup
|
|
|
|
|
When you ask this again, in the correct forum ( this is the C++/CLI forum ), define 'not working' so people don't have to run your code to work out what's going wrong.
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 )
|
|
|
|
|
I am using Visual C++ 2005 C++/CLI and I want to sort the columns in my listView. There is a Microsoft article from 01/09/2006 (Article ID 816183) that explains exactly how to do it using the ListViewColumnSorter object but this does not work for me because the line 'private: ListViewColumnSorter^ lvColumnSorter' does not compile. Can anyone direct me to any other articles that may provide insight?
Thanks
Buck
Buck Brown
|
|
|
|
|
I beleive I've figure this out. The article has the reader use the class BEFORE the article defines the class! What a back asswards way to describe something. The article should define the classes first THEN show you how to use them.
|
|
|
|
|
I am using Visual Studio 2005 C++/CLI. I am new to CLI and I am using Ivor Horton's book "Beginning Visual C++ 2005". Following the example in the book I get the error in this message's title. I'm thinking that the compiler may not be configured correctly. This is pretty straight forward. Does anyone see what is causing this problem.
-------------------
// Container.h
#pragma once
using namespace System;
ref class Container abstract
{
public:
virtual double Volume() abstract;
virtual void ShowVolume() { Console::WriteLine(L"Volume is {0}", Volume()); }
};
-------------------
// Box.h
#pragma once
#include "Container.h"
ref class Box : Container
{
public:
virtual void ShowVolume() override { Console::WriteLine(L"Box usable volume is {0}", Volume()); }
virtual double Volume() override { return m_Length * m_Width * m_Height; }
Box() : m_Length(1.0), m_Width(1.0), m_Height(1.0) {}
Box(double lv, double wv, double hv) : m_Length(lv), m_Width(wv), m_Height(hv) {}
protected:
double m_Length;
double m_Width;
double m_Height;
};
---------------------------------
// Ex9_14.cpp : main project file.
#include "stdafx.h"
#include "Box.h"
using namespace System;
int main(array<system::string ^=""> ^args)
{
array<box^>^ boxes = gcnew Box(); // without this line the app builds just fine
Console::WriteLine(L"Hello World");
return 0;
}
Thanks in advance.
Buck
|
|
|
|
|
What is "array"?
Never mind - I was looking at Managed Extensions
Did you want an array of Boxes?
Something like this..
array<Box ^> ^boxes = gcnew array<Box ^>(10);
Mark
-- modified at 16:26 Thursday 19th April, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I took the example code and stipped it down for simplicity but in the process I broke the code. The actual code looks like this,
array<box^>^ boxes = { gcnew Box(1.0, 2.0, 3.0), gcnew Box(3.0, 4.0, 5.0)};
This initializes two Box objects and when written this way it does compile. I will look at my original app to see how I am initializing my stuff. I must be initializing my array incorrectly.
Thanks
|
|
|
|
|
Are the <> signs being stripped in your posts?
array^ boxes = { gcnew Box(1.0, 2.0, 3.0), gcnew Box(3.0, 4.0, 5.0)};
shouldn't compile.
array<Box ^>^ boxes = { gcnew Box(1.0, 2.0, 3.0), gcnew Box(3.0, 4.0, 5.0)};
works fine.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Okay, the initialization is working for me now. This all started yesterday when I begain getting a LINK error concerning the virtual override function. Then I started commenting out the bulk of the code (my app has quite a few variable to initialize). Right now it seems to be using the abstract class and the override function in the derived class correctly with no errors. I will proceed by adding one initializing variable at a time and then test it.
Thanks again,
Buck
|
|
|
|
|
I have created an MFC ActiveX Control through the wizard. In the 2nd Step of the wizard I have enabled the checkbox saying “Available in Insert Object Dialog”, so that I can use my control in Microsoft Office Application like MS Word, Excel, PowerPoint etc using Insert Objects.
I am using property sheet to change the text contents of my control. For that I followed the steps mentioned the MSDN Example CIRC.
http://msdn2.microsoft.com/en-us/library/c6hzbzz6(VS.80).aspx
My control features the following characteristics.
• Changing the painting behavior of an ActiveX control
• Adding stock properties
• Adding custom properties
• Responding to mouse events
• Adding custom events
• Using text and fonts
• Implementing ActiveX control property pages
• Using simple data binding for control properties
But at present I am stuck up problems.
1. Using property sheet I can update the text contents in ActiveX test container. But it doesn’t get updated in Word, and other Office Applications. In fact its not even recognizing any of the event fired by the user (like changing the color on mouse click, key press etc) in any of the office application.
2. I am using this control for assigning digital signatures to a document. For that I am using X509 libraries. But these libraries use Common Language Runtime (/CLR) Support. And if I enable CLR from the project settings, the control crashes while loading on the Office application, ultimately crashing the entire document.
|
|
|
|
|
I don't see anywhere that you say you're using C++/CLI ? Try asking in the Visual C++ forum.
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 )
|
|
|
|
|
I am using C++/CLI 2005. I have a 'for each' loop to access each element in an array. I would like to access the array index number within the loop but there doesn't appear to be any function that will return the index value. Can this be done?
Buck
|
|
|
|
|
No, you have to keep track of it yourself.
array<String^>^ names = {L"George", L"John", L"James"};
int index = 0;
for each (String^ name in names)
{
Console::WriteLine(L"{0}[{1}]", name, index++);
}
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
foreach is just syntactic sugar, it just generates a for loop. Use a for loop if you need the index.
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 )
|
|
|
|
|
Christian Graus wrote: syntactic sugar
That's a good name for a band!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I am using C++ 2005. I placed a listView control on a tab page and defined three columns using the property page of the listView control. When the Columns property is selected the 'ColumnHeader Selection Editor' dialog box comes up and under the Misc section of the ColumnHeader properties is a TextAlign property. If I select 'Center' for columnHeader2 and columnHeader3, the headers center justify as you would expect them to. But when I select 'Center' for columnHeader1 the property remains 'Left' justified, I can't seem to change it. Is this a little MS bug? Does this behavior occur for anyone else out there?
Buck
|
|
|
|
|
Are you using "Managed" containers for this? This is the "Managed" C++ forum. If you are not using "Managed" code in your solution you didn't manage to post in the correct forum. If you are using the Standard Template Library (STL) there is a forum dedicated to ATL / WTL / STL[^]
led mike
|
|
|
|
|
sorry in advanced if i posted in wrong forum
I am looking for help how to output a chart into the arrays, all i was given was that i need to put a loop inside of a loop. The chart given is:
0 0 0 0
0 1 2 3
0 2 4 6
0 3 6 9
This is what I have so far:
#include "stdafx.h"<br />
#include "pattern.h"<br />
#include <vector> <br />
#include <fstream><br />
#include <iostream><br />
#include <iomanip><br />
#include <string><br />
<br />
using namespace std;<br />
CWinApp TheApp;<br />
<br />
<br />
<br />
int main()<br />
{<br />
int j;<br />
int i;<br />
int test_score[4][4];<br />
<br />
for(i = 0; i < 4; i++)<br />
{<br />
for(j= 0; j < 4; j++)<br />
{<br />
test_score[i][j] = 0;<br />
cout<< test_score[i][j];<br />
}<br />
<br />
cout<<endl;<br />
}<br />
<br />
<br />
return 0;<br />
}
-- modified at 9:17 Wednesday 18th April, 2007
|
|
|
|
|
Hello
re : nested loops
Your loop should look like this:
for(int i = 0 ; i< 4; i++)
{
for(int j = 0 ; j< 4; j++)
{cout << j*i << " " ;
}
cout<< endl;
}
multiplying the outer loop i with the inner j
seems to get the result;
hope this might help
Phill
|
|
|
|
|
Sorry for such a simple question im sure, but how does a person make sure data types are correct for creating an easy robust program.
code : cout << "Enter number of terms" << endl;<br />
cin >> terms;
I want to make sure terms is an Interger type, can i do that with an if statment?
if (terms = ?(some function call))
or is there another way to code to make sure what is entered is an Integer and not a character or string value?
If at first you don't succeed .... DENY EVERYTHING!
|
|
|
|
|
This is standard C++. You're in the C++/CLI forum, try the visual C++ forum.
If terms is an int, I believe it will keep asking until you enter an int value. Or you can accept a std::string and try to parse it yourself and give custom errors. Things like atoi will help here.
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,
How can i access filesystem within c++?
Can i use standard C functions? Like chdir, etc?
Thx,
Nuno
|
|
|
|