Salut a tous,
étant un développez sous Linux avec GTK+. J'ai décider de tenter ma chance sous Windows.
J'ai jeter un oeil au tutoriel http://melem.developpez.com/tutoriel.../?page=gdi#LIV
Je suis sous Visuel Studio C++ 2008 Express.
Mais lorsque je compile le code suivant :
j'obtiens le message d'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 #include <windows.h> LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASS wc; HWND hWnd; MSG msg; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hInstance = hInstance; wc.lpfnWndProc = WndProc; wc.lpszClassName = "Classe 1"; wc.lpszMenuName = NULL; wc.style = CS_HREDRAW | CS_VREDRAW; RegisterClass(&wc); hWnd = CreateWindow("Classe 1", "Notre première fenêtre", WS_OVERLAPPEDWINDOW, 100, 100, 600, 300, NULL, NULL, hInstance, NULL); ShowWindow(hWnd, nCmdShow); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int)msg.wParam; } LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, message, wParam, lParam); } return 0L; }
Je n'arrive pas a trouver mes erreurs.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 1>------ Build started: Project: fenetreqindow, Configuration: Debug Win32 ------ 1>Compiling... 1>main.cpp 1>c:\users\stephane\documents\visual studio 2008\projects\fenetreqindow\fenetreqindow\main.cpp(18) : error C2440: '=' : cannot convert from 'const char [9]' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>c:\users\stephane\documents\visual studio 2008\projects\fenetreqindow\fenetreqindow\main.cpp(31) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [9]' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>Build log was saved at "file://c:\Users\stephane\Documents\Visual Studio 2008\Projects\fenetreqindow\fenetreqindow\Debug\BuildLog.htm" 1>fenetreqindow - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
1iere erreur : comment ca c'est un const?
2ieme erreur : pourquoi se serait encore un const étant donné que c'est le titre de ma fenetre?
Merci d'allumer mes lumières!
Partager