|
|
I am calling DllImport so I need the namespace "System::Runtime::InteropServices" but I keep getting the error:
error C2872: 'FILETIME' : ambiguous symbol
If I comment out the namespace, this problem goes away, instead it gives me this error:
error C2337: 'DllImport' : attribute not found; it is neither a built-in nor a custom attribute that is accessible in the current namespace
Any help would be great.
|
|
|
|
|
use _FILETIME instead.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
I have an app that I recently ported to .Net (an SDI app with Richedit as the view type). Everything is working fine and it runs fine with native and managed code mixed. But when I close the app, I get this error message: An unhandled exception of type 'System.NullReferenceException' occurred in FB.exe
Additional information: Object reference not set to an instance of an object.
this is happening in the following procedure, which I have never touched. (the offending line is pointed out)
CRichEditCntrItem* CRichEditView::GetInPlaceActiveItem() const
{
ASSERT(m_lpRichEditOle != NULL);
CRichEditDoc* pDoc = GetDocument();
CRichEditCntrItem* pItem = NULL;
CReObject reo;
HRESULT hr = m_lpRichEditOle->GetObject(REO_IOB_SELECTION, &reo,
REO_GETOBJ_ALL_INTERFACES);
if (GetScode(hr) == S_OK && (reo.dwFlags & REO_INPLACEACTIVE))
{
pItem = pDoc->LookupItem(reo.poleobj);
if (pItem == NULL)
pItem = pDoc->CreateClientItem(&reo);
ASSERT(pItem != NULL);
}
return pItem;
} I hope anyone can help me. Thanks
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Need to devise code for the following problem
String Line
Character CharSelect
Integer Begin
Returns the index of the first occurrence of the character CharSelect in string Line starting from index Begin
If Line has value “Most people find this hard” and if CharSelect has value ‘t’ and Begin has value 5 then 18 is returned.
Any help much appreciated.
Bill
|
|
|
|
|
String *Line = S"Most people find this hard";
String *char = S"t";
Int16 iBegin = 5;
//Substring Line to all characters from iBegin on
//Find index of 'char' in the substring
Int16 iIndex = Line->Substring(iBegin)->IndexOf( char );
//Index total by adding whatever iIndex found with iBegin
Console::Write( iIndex + iBegin );
***
That's probably the most simple way. There are some other ways (using IndexOf/IndexOfAny, or some other string functions that I don't recall at the moment) that may also work for finding a character within a specific range.
Cyric
|
|
|
|
|
I have just started moving to Visual C++ 2003, and I have faced the following problem. I want to make an index (std::map<int, int> and std::map<string, int> in VC6.0). I have seen the Hashtable and the SortedList, but I couldn't use them. I got the error that myHashtable->Add(1, 2) can't convert from int to a managed object, and I couldn't solve it.
I hope someone can help me solve this problem. Thank you in advance.
|
|
|
|
|
Why don't you keep using the STL ? Just because you're using managed C++ ( why? ) does not mean you have to use .NET containers, does it ?
It looks like MC++ sucks, and cannot handle that a number is not an object. C# would box it for you automatically.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Thank you very much for the idea. I would really like to use the STL, but I couldn't make std::map<int, String*> for example. I get an error in the following line for example:
myMap.insert(std::pair<int, String*>(1,S"One");
I get an error telling me that I can't make the pair, because the pair is unmanaged and I can't include a managed pointer in an unmanaged pair.
Thank you for all your help and patience.
|
|
|
|
|
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.
|
|
|
|