You're right. I must use double blackslashes. In fact, I've adapted the code before submitting it here.
So the correct code is :
ofn.lpstrInitialDir = "C:\\Documents and Settings\\Administrator\\My Documents";
What problem? Regardless of the setting, ofn.lpstrFile will contain the correct value (with the extension intact) if the OK button is clicked. You will have to correctly assign that member to a buffer, however, like:
I should write a Windows32 form, in which I can input Unicode. When I create multiple instances of application.all the form must display some content, and When I change the content, the content in all instances must change according to the changed Unicode.
Now I can get the content of input, but how can I put the value into the variable in commen memory area?
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// Summary for Form1
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
public ref class Form1 : public System::Windows::Forms::Form
//TODO: Add the constructor code here
/// Clean up any resources being used.
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::Button^ button1;
i.e. don't dynamically alloc shared data unless you are prepared to handle all multi-proc ownership issues.
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
UpdateWindow just sends the WM_PAINT message to your app, it doesn't actually cause painting to happen. basically painting happens whenever your app has nothing else to do and your app gets around to processing the WM_PAINT message. that's not going to happen in the middle of a function (unless you're doing something like an old-school Message Pump between statements).
but, basically, there is no "erase" functionality. there is only draw. if you need to erase drawing A, you have to draw what was there before you drew A.