|
|
thank you very much for the article.I almost finish qui part of my project
Mert Aydin
|
|
|
|
|
Hey guys, I am trying to understand some codes and came across this.
In the code below, I don't know if its a pointer to RTIambassador object. I don't see why there is RTI:: in front of RTIambassador* and also ms_rtiAmb is not a method of class ObjectRoot. I don't see why they have ObjectRoot:: in front of ms_rtiAmb.
Thanks,
Jay
RTI::RTIambassador* ObjectRoot::ms_rtiAmb = NULL;
|
|
|
|
|
don't cross post the forums
we already answered you on the other board... can't you just wait for an answer more than 5 minutes ??
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
|
Hi,
I've got an application that uses mixed C++.
Sometimes, the application crashes with AccessViolationException
It seems that the cause is that I'm using unmanaged pointers without pinning.
Here is the code that crashes sometimes
<br />
__gc class CRichTextBuffer<br />
{<br />
public:<br />
CRichTextBuffer()<br />
{<br />
m_BufferSize = 32;<br />
m_BufferPosition = 0;<br />
m_buf = new char[m_BufferSize];<br />
}<br />
<br />
public:<br />
bool CreateCDParagraph(CDPABDEFINITION __gc *Definition)<br />
{<br />
Int32 nSize;<br />
bool bResult = false;<br />
int nStep = 0;<br />
<br />
try<br />
{<br />
nSize = ODSLength(_CDPABDEFINITION); nStep++;<br />
<br />
<br />
if ( CheckSize(nSize) ) <br />
{<br />
LPTSTR LPStrResult = new TCHAR[nSize]; nStep++;<br />
LPTSTR LPStrTmp = LPStrResult;
nStep++;<br />
<br />
CDPABDEFINITION Def;<br />
CopyStructure( &Def, Definition ); nStep++;<br />
<br />
ODSWriteMemory( &LPStrTmp, 10, &Def, 1 ); nStep++;<br />
<br />
CopyMemoryInBuffer(LPStrResult, nSize); nStep++;<br />
delete [] LPStrResult; nStep++;<br />
<br />
bResult = true;<br />
}<br />
}<br />
catch (Exception* e)<br />
{<br />
String *sMsg = String::Concat("Exception: ", e->get_Message()," - Step=", nStep.ToString());<br />
System::Diagnostics::Debug::Assert(false, sMsg);<br />
bResult = false;<br />
}<br />
<br />
return bResult;<br />
}<br />
<br />
protected:<br />
char *m_buf;<br />
int m_BufferPosition;<br />
int m_BufferSize;<br />
}<br />
I'm new with __pin pointers
where is the problem? where need I use __pin pointers?
I know that I can't __pin the class member m_buf. How can I prevent the application from crash?
Thanks in advance for your help
Stf
|
|
|
|
|
I've got an unmanaged C++ library which I've now compiled as a managed assembly (changed the output type etc.) When I try to use this in another Managed C++ project, I get C2871 - a namespace with this name does not exist. I have tried using both:
#using (with the Resolve #using references setting)
Adding a reference (automatic /FU switch)
but neither works; I still get C2871 on the first "using namespace" line.
The really strange thing is that I have built a test c# application and this is able to use the assembly just fine!
Any clues anyone?
Mark
|
|
|
|
|
if u r sure that u can use the assembly from C#, no doubt u should be able to use the same from managed cpp as well.
To confirm the namesapce/class names u used in managed cpp:
* chk it in c#, by press ctrl+alt+j and see the namespace details in the object browser.
* or use ildasm.exe to di assemble the assembly and see the namespace type informations.
cheers...milton kb
|
|
|
|
|
Thanks for the advice. The strange thing is, I've already checked this.
ildasm.exe shows the namespace just as I'm trying to use it and C# uses it without a problem. The Managed C++ compiler picks up the dll from the #using statement but can't seem to find the namespace in a subsequent "using namespace ..." statement.
I've tried using a different dll in the project and this works OK. I've also tried compiling the included dll in a complete new project - same problem. So it seems to be something wrong with this particular dll. I just don't understand how the C# compiler can see the namespace whereas the C++ one can't.
Ideally I want to get the C++ compiler to verbosely tell me exactly what it's searching and what it 'sees'. I guess that's not possible!
Mark.
|
|
|
|
|
hello,
I want to create a managed C++ dll to access a .net component.
The managed C++ dll is used in a plain C++ application.
Is this possible?
greetings,
Niko
|
|
|
|
|
For accessing a .net component from palin c++(unmanaged)you have to use CCW com callable wrapper.
For this, if the .net component is already written in such a way that it be used for generating the ccw, directly use it. or else write a managed c++/c# wrapper which is compliant with requirements fo a CCW. then use the ccw from plain c++
cheers...milton kb
|
|
|
|
|
Hi,
As I mentioned in the subject line, I am an experienced C programmer. I want to upgrade myself to a C++ programmer. I am a little bit familiar with Object Oriented Programming concepts, so I believe myself to overcome this transition from C to C++, but I need your proper directions to my this aim. In order to appropriately achieve this, could you send your directions and suugestions?
Thank you in advance.
Semih
|
|
|
|
|
I usually grab a good book. Go though the book and do some exercises. As you are familiar with C syntax and some OOP, the learning curve shouldn't be steep for you.
If you want to develop on .NET, after you gain a fair grasp of Standard C++, find a recent book that teaches C++/CLI extensions. Don't jump on C++/CLI before you know Standard C++.
Best,
Jun
|
|
|
|
|
Thank you for your suggestions, which compiler environment should I prefer to develop my codes in C++? This compiler environment is surely helpful to implement and interesting to increase work desire.
Best regards,
Semih
|
|
|
|
|
sergin80 wrote: which compiler environment should I prefer to develop my codes in C++?
C/C++ uses the same compiler. I recommend Visual C++ and GCC.
sergin80 wrote: This compiler environment is surely helpful to implement and interesting to increase work desire.
True. In this regard, VC++ probably motivates the learning process more.
Best,
Jun
|
|
|
|
|
sergin80 wrote: In order to appropriately achieve this, could you send your directions and suugestions?
I highly recommend Accelerated C++[^] as a standard C++ introductionary text.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I'm working with the XmlTextReader and I'm having some difficulty navigating through the xml document. The issue I'm running into is getting the attributes from the child nodes of a specific element. Here is a sample layout of the xml document.
<sample>
<hw id="HP-D500" name="Compaq Evo D500 Desktop" type="Desktop">
<software fn="SP26150.exe" title="HP Easy Access Keyboard Driver for Windows 2000/XP" type="DRIVER"
category="Input Devices" version="8.0.0.683" path="OS\ID\HP\KB" si="setup.exe -s"></software>
</hw>
<hw id="HP-D510" name="Compaq Evo D510 Small Form Factor" type="Desktop">
<software fn="SP26150.exe" title="HP Easy Access Keyboard Driver for Windows 2000/XP" type="DRIVER"
category="Input Devices" version="8.0.0.683" path="OS\ID\HP\KB" si="setup.exe -s"></software>
</hw>
<hw id="HP-N600c" name="Compaq Evo n600c Notebook PC" type="Laptop">
<software fn="SP22515.exe" title="Easy Access Buttons" type="Application"
category="Input Devices" version="3.00" path="OS\ID\SP22515" si="setup -s -SMS"></software>
<software fn="SP27852.exe" title="HP Notebook LidSwitch Policy" type="DRIVER"
category="OS and OS Enhancements" version="2.02" path="OS\Enh\SP27852" si="setup.exe -s"></software>
<software fn="SP21661.exe" title="Synaptics Touchpad Driver for Windows 2000 and XP" type="DRIVER"
category="Input Devices" version="6x" path="OS\ID\SP21661" si="setup.exe -s -SMS"></software>
<software fn="SP22442.exe" title="Compaq Hotkey Support Software" type="Application"
category="OS and OS Enhancements" version="1.1" path="OS\Enh\SP22442" si="\disk1\setup.exe -s -SMS"></software>
</hw>
</sample>
Here is the function implementation that is parsing the file.
StringCollection* ESBPARSER::getModelSoftware(XmlTextReader* Reader,String* modelName)
{ //modelName contains the attribute from a hw element name id.
StringCollection* SOFTWARE_LIST = new StringCollection();
try {
while (Reader->Read())
{
if (Reader->NodeType == XmlNodeType::Element)
{
if (Reader->HasAttributes)
{
Reader->MoveToAttribute("name");
int strVal = Reader->Value->ToString()->CompareTo(modelName);
if (strVal == 0)
{
// Logic to Get each Child element attribute name title
}
}
}
}
}
catch(...){
MessageBox::Show(S"An Error has occurred while trying updating hardware list box.");
}
return SOFTWARE_LIST;
}
Any help would be greatly appreciated.
TIA
|
|
|
|
|
Is it possible to use C++/CLI for Mobile Device, PPC 2003 /2005
thank
|
|
|
|
|
Yes VS2005 supports Windows mobile developemnt using C++/CLI.
cheers ..Milton KB
|
|
|
|
|
Thank for your answer,
So I tried to create 2 smart device projects in MFC and WTL , but I can find /clr option for compiler in project Setting, it is normal?
@+
PS: I use VS2005 Professional Edition
|
|
|
|
|
Yes It is. this is normal. it means that u can use >net assemblies as well.
cheers... Milton KB
|
|
|
|
|
Ok,
I adde in my project
#using <mscorlib.dll>
#using <System.dll>
using namespace System;
An d I got this error :
error C2871: 'System' : a namespace with this name does not exist
What happend ?
Thank
|
|
|
|
|
Which project template and project type u selected ?
|
|
|
|
|
It is Visual C++ /Smart Device /MFC Smart Device Application and WTL ATL/WTL Application Wizard for Windows CE.
?
|
|
|
|
|
So I think C++/CLI is not supported for Smart Device, I can't find any information about this possibility
@+
|
|
|
|