|
Can you use std::string, or do you need to use the managed string ?
This is just convincing me more and more that MC++ sucks. And for the record, I use C# every day, I don't hate .NET.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
|
Christian Graus wrote:
C# would box it for you automatically.
And that is bad. At least under some circumstances.
|
|
|
|
|
when you have a value like that that is not an object you simply put __box(1) or __box(2005), whatever the case may be
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hi,
We have created this Group, 'CUIPL Mailing Group', which we think
you might also be interested in.
CUIPL is an Image Processing Library written in ANSI C++ in order to
be platform independent.
We thought that it would be more useful if we put it on the internet
as an open source, this way people can use it, but most important
they can extend it to cover areas not covered in the initial release.
This library is intended to be a tiny step towards a huge arabian
open soucre community, where we can build the software we need.
We don't have to rely on the west to supply us with - at least - our
software needs, we can do our own, and we are old enough to do so
we have the knowledge, experties, and the tools to achieve our goal.
So,
WHAT ARE WE WAITING FOR!!?
the group address is
http://www.smartgroups.com/groups/cuipl
Email us back if you need any help, or what it's all about...
Regards
Ahmed Mohamed Abdelsalam am_abdelsalam@msn.com
Mohamed Galal El-Din Mohamed eng_mg@yahoo.com
|
|
|
|
|
I have a VC 6 project that I'm converting to .Net and I'm trying to use managed extensions. In the project properties, I've set the 'Use Managed Extensions' option to YES and added the following using directives to my stdafx.h file:
#using <mscorlib.dll>
#using <System.Windows.Forms.dll>
#using <System.dll>
using namespace System;
using namespace System::Windows::Forms;
using namespace System::Text::RegularExpressions;
now when I try to compile the project, I get the following error:
cl : Command line error D2016 : '/RTC1' and '/clr' command-line options are incompatible
can anyone help?
If it's broken, I probably did it
bdiamond
|
|
|
|
|
In my header file, I'm using only get_dataSectionPtr and no set (its value is set in the constructor) and I get the following errors:
c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(43) : error C2086: 'long AbfFileStruct::dataSectionPtr' : redefinition
c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(21) : see declaration of 'AbfFileStruct::dataSectionPtr'
AbfFileStruct.cpp(12) : error C2039: 'set_dataSectionPtr' : is not a member of 'AbfFileStruct'
c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(15) : see declaration of 'AbfFileStruct'
c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(43) : error C2086: 'long AbfFileStruct::dataSectionPtr' : redefinition
c:\Documents and Settings\administrator\My Documents\Visual Studio Projects\byteme\AbfFileStruct.h(21) : see declaration of 'AbfFileStruct::dataSectionPtr'
And the offending code seems to be this:
public __gc class AbfFileStruct
{
public:
//always need at least a FileStream to construct it
AbfFileStruct(FileStream *);
__property long get_dataSectionPtr()
{
return dataSectionPtr;
}
void PrintFileStruct();
private:
long dataSectionPtr;
}; //ENDCLASS
Ideas?
|
|
|
|
|
Oh, and there's another header file (AbfFileInfo.h) that has the get_ properties and doesn't give any errors...
|
|
|
|
|
The reason for this error is that your private member variable (dataSectionPtr) has the same name as your property. That's because from your get_ method, the compiler will generate a property dataSectionPtr. Just rename your private member variable, and your code will compile.
|
|
|
|
|
hi me again, ive been writting code that fills a vector with random numbers from two sources, all even elements are filled from source1 and odd ones from source2...this now works fine after much debuggingmyhead.
ive been trying to to do next part of my function which is more complex, it basically uses a iterator with a const value of 0.002. which is 20millseconds.
this iterator goes to every single element in the array and goes through every element in 0.002 segments..i.e if element value is 3.6 then it goes through it in 1,800 segements. basically splitting up the element into segments,
and it does this to distingusih between numbers from sourceone and sourcetwo because these numbers are usesd elsewhere.. i will paste the code which fills the vector and ive COMMENTEDout the 'new' but it doesnt work imnot sure what else to do.
#include <iostream><br />
#include <vector><br />
#include <stdlib><br />
#include <time><br />
#include <numeric><br />
#include <algorithm><br />
#include "exponentialgenerator.h"<br />
<br />
using namespace std;<br />
<br />
ExponentialGenerator one = 1.41;<br />
ExponentialGenerator two = 1.71;<br />
<br />
double nextNumber = reinterpret_cast<double>(one.generate());<br />
<br />
double nextNumber2 = reinterpret_cast<double>(two.generate());<br />
<br />
int counter = 0;<br />
<br />
void fillVectorToSum(vector<double>& v, double sum)<br />
{<br />
<br />
int total = 0;<br />
do {<br />
if (counter++ % 2){<br />
v.push_back(nextNumber);<br />
total += nextNumber;<br />
nextNumber = one.generate();<br />
}<br />
else {<br />
v.push_back(nextNumber2);<br />
total += nextNumber2;<br />
nextNumber2 = two.generate();<br />
}<br />
<br />
} while(total+nextNumber+nextNumber2 <= sum);<br />
if(total < sum)<br />
v.push_back(sum-total);<br />
}<br />
<br />
<br />
int main()<br />
{<br />
<br />
srand((unsigned) time(NULL));<br />
vector<double> v;<br />
fillVectorToSum(v, 30);<br />
<br />
cout << "Number of elements: " << v.size() << "\nTotal: "<br />
<< accumulate(v.begin(), v.end(), 0) << endl;<br />
copy(v.begin(), v.end(), ostream_iterator<double> (cout," "));<br />
<br />
<br />
<br />
<br />
<br />
<br />
}
|
|
|
|
|
I have a project (MFC Application) in wich I need to insert an Windows Form. So, I've changed my project from unmanaged into managed.
Problem 1:
I have a control "Microsoft Flex Grid". When my project was unmanaged everything was OK. Now, I Have a "Debug Assertion Error" when i try to open the dialog box with the grid control.
Solution1: function AfxOleInit => Problem 2: Everything works ok but after I close the principal dialog box of the application = another Debug Assertion Error (in cmdtarg.cpp in "~CCmdTarget()"). If there is sb who had the same problem or who has a solution...thank you.
Monica
|
|
|
|
|
could you help me ?
How to custom drawing a window in managed C++ . I know about events, how to get DC, HWND and such, is it done this way ?
I lack msdn
thx in advance.
Robert
|
|
|
|
|
i want to put some text programatically from another application inside Yahoo Messangers instant message dialogue, my problem is i am unable to catch the RICHEDIT control inside the instant message window.
|
|
|
|
|
Hi for me you'll have use windows hooks. There's a nice article about subclassing on MSDN.
Try to read something about SetWindowsHookEx specially abaut CBT param of this function and SetWindowLong function. This will let you get a handle to Richedit control and its messages.
Pain is a weakness living the body
|
|
|
|
|
i am trying to send a text message from one application to yahoo instance messanger window but failing.
what i want is my application should send some text and that text should appear in the yahoo messangers instant message window.
please help me
|
|
|
|
|
This isn't really managed code,
This may not be possible, but the following could probably be done to insert messages into the "input text," but probably not the running chat:
- Use the Spy++ tool while an instance of YIM is running to find the YIM window class name and noting it, and finding the chat input child text box's id.
- In code, do a top level enumerations of windows to find the active YIM window, or alternatively, enumerate the user processes and find the process/main window.
- Get the handle of that "input text box" window
- Use that handle to set the window text.
If you're looking to add stuff to the running chat window, you may not be able to do so because it probably has text added by a method call somewhere internal to YIM.
|
|
|
|
|
Can anyone please direct me in the right direction. I am trying to find a prewritten program that will 'listen' for inputs from a serial port, and then launch an application. I'd appreciate any help.
kswisslk
|
|
|
|
|
Look for the article: "Use P/Invoke to Develop a .NET Base Class Library for Serial Device Communications" in the MSDN.
|
|
|
|
|
check out this:
http://www.codeproject.com/managedcpp/howtocomport.asp
...the mind is not a vessel to be filled but a fire to ignited
|
|
|
|
|
This one is good:
http://www.wcscnet.com
--Nikola--
modified 7-Dec-20 21:01pm.
|
|
|
|
|
How can I change the text (caption) color on CButton? I'm using a MFC dialog box.
|
|
|
|
|
Your object.SetWindowText("Caption"); ????
The returned pointer may be temporary and should not be stored for later use.
|
|
|
|
|
Hi,
I'm a bit vague on differences between managed C++ and unmanaged C++. Here's my problem:
#include "stdafx.h"
#using <mscorlib.dll>
#using<system.dll>
using namespace System;
using namespace System::IO;
using namespace System::Text;
using namespace std;
//using namespace System::IO::FileStream;
int _tmain(int argc, _TCHAR* argv[])
{
// TODO: Please replace the sample code below with your own.
string * fileName = &string(argv[1]);
FileStream *fs = new FileStream(fileName,FileMode::OpenOrCreate);
BinaryReader * w = new BinaryReader(File::Open(fileName, FileMode::Open));
return 0;
}
I get:
byteme.cpp(19) : error C2664: 'System::IO::FileStream::FileStream(System::String __gc *,System::IO::FileMode)' : cannot convert parameter 2 from 'System::IO::FileMode' to 'System::String __gc *'
Cannot convert an unmanaged type to a managed type
byteme.cpp(22) : error C2665: 'System::IO::File::Open' : none of the 3 overloads can convert parameter 1 from type 'std::string *'
stdafx.cpp(0): could be 'System::IO::FileStream __gc *System::IO::File::Open(System::String __gc *,System::IO::FileMode)'
while trying to match the argument list '(std::string *, System::IO::FileMode)'
And I was getting an issue with teh string * fileName declaration until I mangled some stuff...question is, what do these errors mean? And with MC++ do you use something other than argv/argc?
Charlene
|
|
|
|
|
try changing to....
String* fileName = new String(argv[1]);
|
|
|
|
|
ive been working on some simulation code, what i have written basically what it does it creates a Vector and fills it with random DOUBLE numbers from two different sources untill maz_size reached.. what im stuck is i want to go thorugh each element in the vector..prob using an iterator such as input_iterator i think?
so the vector is such..
[number_from_first_source, number_from_secondSource, number from_first source...etc etc]
so every odd element is form source1 and every even element is from source 2..
now i want to go thorugh each element with specific iterator value..example lets say 20ms i.e. 0.002..quite small value. the random numbers are all seeded values. so how owul di go through the vector with this small iterator value.
]#include <iostream><br />
#include <vector><br />
#include <stdlib><br />
#include <time><br />
#include <numeric><br />
#include <algorithm><br />
#include "exponentialgenerator.h"<br />
<br />
using namespace std;<br />
<br />
ExponentialGenerator one = 1.41;<br />
ExponentialGenerator two = 1.71;<br />
<br />
double nextNumber = reinterpret_cast<double>one.generate());<br />
double nextNumber2 = reinterpret_cast<double>two.generate());<br />
int counter = 0;<br />
<br />
void fillVectorToSum(vector<double>& v, double sum)<br />
{<br />
<br />
int total = 0;<br />
do {<br />
if (counter++ % 2){<br />
v.push_back(nextNumber);<br />
total += nextNumber;<br />
nextNumber = one.generate();<br />
}<br />
else {<br />
v.push_back(nextNumber2);<br />
total += nextNumber2;<br />
nextNumber2 = two.generate();<br />
}<br />
<br />
} while(total+nextNumber+nextNumber2 <= sum);<br />
if(total < sum)<br />
v.push_back(sum-total);<br />
}<br />
<br />
int main()<br />
{<br />
<br />
srand((unsigned) time(NULL));<br />
vector<double> v;<br />
fillVectorToSum(v, 30);<br />
<br />
cout << "Number of elements: " << v.size() << "\nTotal: "<br />
<< accumulate(v.begin(), v.end(), 0) << endl;<br />
copy(v.begin(), v.end(), ostream_iterator<double> (cout," "));<br />
<br />
}
the exponentialGenerator.h file i use jus to generate numbers if your wondering....
anyway any input to this problem would be appreciated.
|
|
|
|