Bonjour, j'ai un problème concernat un programme dont j'ai pris l'exemple sur le tutoriel de CGi (qui est excellent).
Voici le code source :
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
      
#include <windows.h>  /*Pour les fonctions windows*/
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
                                                LPSTR lpCmdLine, int nCmdShow)
{
    HWND hwnd;
    MSG msg;
    WNDCLASS wc;
    wc.style = 0;
    wc.lpfnWndProc = MainWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = NULL;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
    wc.lpszMenuName =  NULL;
    wc.lpszClassName = "MaWinClass";
    RegisterClass(&wc);
    hwnd = CreateWindow("MaWinClass", "Titre", WS_OVERLAPPEDWINDOW,
                                   CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
                                                   NULL, NULL, hinstance, NULL);
    if (!hwnd) return FALSE;
    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);
 
    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return msg.wParam;
}
/***************Fonction de traitement des messages**************/
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
 
        /*case WM_KEYDOWN :
    {
        int y;
        char st[]="Bienvenue sur Developpez.com";
        HDC hdc=GetDC(hwnd);
        SetBkMode(hdc, TRANSPARENT);
        for (y=10; y<=200; y+=20)
         TextOut(hdc, 10, y, st, lstrlen (st));
        ReleaseDC(hwnd, hdc);
        return (0);
             }*/
 
        /*WM_PAINT :
            {
              int y;
              char st[] = "Bienvenue sur Developpez.com" ;
              HDC hdc = GetDC(hwnd);
              SetBkMode(hdc, TRANSPARENT);
              for(y=10; y <= 200; y += 20)
                                          TextOut(hdc, 10, y, st , lstrlen(st));
              ReleaseDC(hwnd, hdc);
              return 0;
            }*/
 
        case WM_PAINT :
    {
         int y;
         char st[]="Bienvenue sur Developpez.com";
         PAINTSTRUCT ps;
         HDC hdc=BeginPaint(hwnd, &ps);
         SetBkMode(hdc, TRANSPARENT);
         for (y=10; y<=200; y+=20)
            TextOut(hdc, 10, y, st, lstrlen (st));
             EndPaint(hwnd, &ps);
             return (0);
       }     
        case WM_CREATE:
    return 0;
        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;
        default:
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
    }
}
Après avoir compiler avec Dev C++ j'ai 2 erreurs que je n'arrive pas à résoudre :
[Linker error] undefined reference to `SetBkMode@8'
[Linker error] undefined reference to `TextOutA@20'
ld returned 1 exit status
Voilà je vous remerci d'avance pour votre aide.
PS:Et bravo pour cette nouvelle interface graphique.