Gość utworzono 30 września 2011 utworzono 30 września 2011 Witam, dopiero zaczynam zabawę z obiektowym C++. Piszę w Visual Studio 2008, wybrałem projekt Windows Forms Aplication i mam taki kod: [quote] #pragma once #include "stdafx.h" #include <iostream> #include <cstdio> #include <stdlib.h> namespace Okienka { using namespace std; 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> /// 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. /// </summary> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // cout << "test"; } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void InitializeComponent(void) { System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid)); this->SuspendLayout(); // // Form1 // this->AccessibleDescription = nullptr; this->AccessibleName = nullptr; resources->ApplyResources(this, L"$this"); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->BackgroundImage = nullptr; this->Font = nullptr; this->ForeColor = System::Drawing::SystemColors::ActiveCaptionText; this->Icon = nullptr; this->Name = L"Form1"; this->TransparencyKey = System::Drawing::Color::Transparent; this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); this->ResumeLayout(false); } #pragma endregion private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { } }; } [/quote] Ja w nim dodałem biblioteki, std i wpisałem cout << "napis"; Problem taki że tego napisu nigdzie nie widać ... co jest tu nie tak zrobione, może ja zegoś nie rozumiem ze nie działa. Zaprogramowane okno mam jako gotowiec od programu. Jego wypełnienie miałem zrobić sam. Może ktoś pomóc ?
tom300 komentarz 1 października 2011 komentarz 1 października 2011 W Visual C++ wybierając opcję Windows Form Application korzystasz z technologii .NET. Jeśli chcesz programować w WinApi musisz stworzyć nowy projekt w okienku wybrać Win32 Console Application, później w zakładce Application Settings wybrać opcję Windows Application (jeżeli chcesz okienkowy program) albo Console Application (jeśli chcesz program z konsolą).
Wciąż szukasz rozwiązania problemu? Napisz teraz na forum!
Możesz zadać pytanie bez konieczności rejestracji - wystarczy, że wypełnisz formularz.