|
It means you've passed an invalid HANDLE to some API. For example:
#include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HANDLE hBad = reinterpret_cast<HANDLE>(0xBAADF00D);
CloseHandle(hBad);
return 0;
}
Steve
|
|
|
|
|
When deriving from CWnd, is there a way to effectively hide CWnd::Create from showing up in things like intellisense? CEdit, CButton, etc... all do this but I fail to see how they are doing it in the MFC source code.
I'm trying to bury the window class registration stuff inside the class in a static sort of way and I can't seem to figure out how to hide CWnd::Create.
Does anybody know how to do this?
|
|
|
|
|
hello..... I have my code like this ....but I want to write my xml in a file like "Results.xml".......please help me.... ..how can i give the path?
#using "System.Xml.dll"
using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
//Create a writer to write XML to the console.
XmlTextWriter^ writer = nullptr;
writer = gcnew XmlTextWriter( Console::Out );
//Use indentation for readability.
writer->Formatting = Formatting::Indented;
writer->Indentation = 4;
//Write an element (this one is the root).
writer->WriteStartElement( "book" );
//Write the title element.
writer->WriteStartElement( "title" );
writer->WriteString( "Pride And Prejudice" );
writer->WriteEndElement();
//Write the close tag for the root element.
writer->WriteEndElement();
//Write the XML to file and close the writer.
writer->Close();
}
|
|
|
|
|
This is managed code, not C++. Please use the appropriate forum[^] (and use the formating tags when you post code).
|
|
|
|
|
lavy2883 wrote: want to write my xml in a file like "Results.xml".......
Use the constructor in your previous post - the one that takes a String^ and an Encoding^.
writer = gcnew XmlTextWriter("C:\\Results.xml" , Encoding::UTF8 );
...
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: writer = gcnew XmlTextWriter("C:\\Results.xml" , Encoding::UTF8 );
A managed code on the C++ forum
|
|
|
|
|
WhiteSky wrote: A managed code on the C++ forum
Yeah Yeah.
I mix managed C++ code with MFC code - where should I post my questions?
I know the answer
Frankly, I'm just lazy - I'd rather type a possible solution then explain the proper forum.
In this case I didn't even think about it - looked like C++ to me!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello all,
I need to translate an application to a language that uses a special character set.
I need to show special characters from that special character set in my CStatics and other controls.
How should I do that?
I can imagine that using unicode I will be able to use them, but I still don't get how to write those texts.
As always thank you in advance.
|
|
|
|
|
Joan Murt wrote: I need to show special characters from that special character set
By "special character set" do you mean "font"? If so, then simply select the font by calling SetFont() on the static control.
|
|
|
|
|
Hello Hans,
I do not mean that, I use the character set of the Spanish language, and I want to use special characters like AE (a letter that has the A and E joined) and other ones used in Danish.
But anyway, thank you for your feedback.
|
|
|
|
|
To start with you need to compile with UNICODE
led mike
|
|
|
|
|
OK, I knew about UNICODE, but how I make some chars to appear? I mean, UNICODE will allow me to use them, but how do I use them?
Thank you for your feedback.
|
|
|
|
|
Just a stupid question, but have you installed that particular language on your machine? If not, please do it: Control panel -> Regional and language options -> ...
You may use the language bar to switch between languages and type it.
Shog on learning VB6: Ah, that would have been VB6. Kicked my ass anyway. So easy to learn, just like falling down a flight of stairs...
|
|
|
|
|
I guess I'll have to do that...
PS: Now I'll go to home and commit suicide by eating my computer keyboard...
Thank you for your help.
|
|
|
|
|
When we start something new, it would be the little things, that we would miss.
Anything I will say you will bring it down to whatever you want.
|
|
|
|
|
You hould hve tol m tht bfor... I'm finihing ith th lft prt of th kybord...
Thnk you for your fbck...
|
|
|
|
|
Didn't your mother teach you to not talk with your mouth full?
I can sympathize with learning about UNICODE. I went through this several years ago, when we first started worrying about Japanese versions of our products. Once you learn the 'best practices' for UNICODE, you'll never go back to writing MBCS-only applications. Well, maybe not .
Software Zen: delete this;
|
|
|
|
|
I have my algorithm in vc++2005 and I want to save my results in XML,I declared
#using <system.xml.dll>
using namespace System::Xml;
using namespace System::IO;
using System::Console;
using namespace System::Text;
using System::String;
and now I have some example made in c# for saving my data in XML, the two line from below are made in c++ :
String^ path = gcnew String("c:\\results.xml");
XmlTextWriter myXmlTextWriter = gcnew XmlTextWriter(path,0);
and it give me 2 errors like:
Error 1 error C2664: 'System::Xml::XmlTextWriter::XmlTextWriter(System::IO::Stream ^,System::Text::Encoding ^)' : cannot convert parameter 1 from 'System::String ^' to 'System::IO::Stream ^'
Error 2 error C3767: 'System::Xml::XmlTextWriter::XmlTextWriter': candidate function(s) not accessible
please help me ...I have to do this in 2 days..I am realy disperate
lavi
|
|
|
|
|
|
sorry I declare and : #using <system.xml.dll>
|
|
|
|
|
Maybe change
XmlTextWriter myXmlTextWriter = gcnew XmlTextWriter(path,0);
to
XmlTextWriter^ myXmlTextWriter = gcnew XmlTextWriter(path,0);
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
Hi, sorry for my bad english.
I have build a DLL with Visual C++ 2005 (C++/ATL) that use the Netica API for creating a bayesian net. With this API, I can only load a file from the disc and passing from a stream for reading the net. I would to embedd the net file (a simple txt) in the resource file (.rc), and passing to a stream.
The step that I using is :
stream = NewStreamFile_ns ("C:\PathToNetFile", ... );
net = ReadNet_bn ( stream, ... );
If I can redirect the file from the resource to the stream, I will be an happy man
I hope that someones help me.
Thanks in advance.
|
|
|
|
|
One way...
You can insert the text into the resource in Visual Studio by creating a custom resource.
Project Menu/Add Resource...
Click Custom... button
Name the resource type "TEXT" or whatever
paste the text into the binary editor.
To retrieve the resource you can use FindResource()/LoadResource()/LockResource()/etc.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thank u, but I'm not an expert of this kind of programming, and I don't understand how I can do this.
The API is in C language.
the stream is defined as
typedef struct stream__ns stream_ns; //The structure is ignote (opaque pointer)
and I define the var as follow:
stream_ns * stream = NewStreamFile_ns ("C:\PathToNetFile", otherParams... );
net = ReadNet_bn ( stream, otherParams... );
Please help me
|
|
|
|