alors ...
Il faut que tu crées un programme en mode console
la première chose à faire est d'appeler
AttachConsole( ATTACH_PARENT_PROCESS );
pour le permettre, il faut inclure windows.h
1 2
| #define WIN32_LEAN_AND_MEAN
#include <windows.h> |
Ensuite, tu peux ajouter une nouvelle form et l'instancier dans l'application
pour ca, il faut inclure form1.h par exemple, utiliser les bons namespace et instancier la form.
Ensuite, tout appel postérieur à AttachConsole de Console::WriteLine sera visible :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| #include "stdafx.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "form1.h"
using namespace System;
using namespace System::Windows::Forms;
int main(array<System::String ^> ^args)
{
AttachConsole( ATTACH_PARENT_PROCESS );
Console::WriteLine(L"Hello World");
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault( false );
Application::Run(gcnew testConsoleWinform::Form1());
return 0;
} |
Partager