IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Discussion :

Erreur de compilation API windows


Sujet :

Windows

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    7
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2007
    Messages : 7
    Points : 6
    Points
    6
    Par défaut Erreur de compilation API windows
    Bonjour je suis en train de faire l'interface graphique de mon petit programme et a la compilation il y a plusieur erreur que je ne parvient pas a resoudre...
    Voici mon code j'ai mis en gras rouge la ligne ou le compilateur m'indique l'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
    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
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
     
    #include <windows.h>
    #include <stdio.h>
    #include <shlobj.h>
    #include "constantes.h"
     
    HINSTANCE instance;
     
    #define ID_PUSHBUTTON_1 110
    #define ID_PUSHBUTTON_2 111
    #define ID_PUSHBUTTON_3 112
    #define ID_CHECKBOX_1 113
    #define ID_CHECKBOX_2 114
    #define ID_CHECKBOX_3 115
    #define ID_CHECKBOX_4 116
    #define ID_RADIOBUTTON_11 117
    #define ID_RADIOBUTTON_12 118
    #define ID_RADIOBUTTON_13 119
    #define ID_RADIOBUTTON_21 120
    #define ID_RADIOBUTTON_22 121
    #define ID_RADIOBUTTON_23 122
    #define ID_STATIC_1 123
    #define IDC_BTN_BROWSE 500
     
     
     
    VOID RemplieFenetrePrincipale(HWND fenetrePrincipale)
     
    {
     
     
     
    HWND hCtl=CreateWindow(
    "STATIC",
    "Choisissez le fichier d'origine... puis le dossier de destination du fichier convertit",
    WS_CHILD|WS_VISIBLE|SS_CENTER|SS_NOTIFY,
    0,205,
    700,60,
    fenetrePrincipale,
    (HMENU)ID_STATIC_1,
    instance,
    NULL);
     
    hCtl=CreateWindow(
    "STATIC",
    "",
    WS_CHILD|WS_VISIBLE|SS_BITMAP,
    120,60,
    0,0,
    fenetrePrincipale,
    NULL,
    instance,
    NULL);
    HANDLE hImage=LoadImage(NULL,MAKEINTRESOURCE(OBM_CHECK),IMAGE_BITMAP,0,0,LR_SHARED);
    SendMessage(hCtl,STM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)hImage);
     
     
    // Premier groupe: le push button
    HWND hGroup=CreateWindow(
    "BUTTON",
    "",
    WS_CHILD|WS_VISIBLE|BS_GROUPBOX,
    0,0,
    1,1,
    fenetrePrincipale,
    NULL,
    instance,
    NULL);
    {
    HWND hControle;
    // On le remplit avec un premier push button tout bête
    hControle=CreateWindow(
    "BUTTON",
    "",
    WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
    10+10,10+20,
    1,1,
    fenetrePrincipale,
    (HMENU)ID_PUSHBUTTON_1,
    instance,
    NULL);
    // un second avec quelques flags : plat et plusieurs lignes
    hControle=CreateWindow(
    "BUTTON",
    "Convertir",
    WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_FLAT|BS_MULTILINE,
    290,490,
    100,40,
    fenetrePrincipale,
    (HMENU)ID_PUSHBUTTON_2,
    instance,
    NULL);
    // et un troisième un peu plus exotique, c'est aussi le bouton par défaut de la fenêtre
    // on lui met aussi une image alignée à gauche
    hControle=CreateWindow(
    "BUTTON",
    "Quitter",
    WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|BS_ICON|BS_LEFT,
    410,490,
    100,40,
    fenetrePrincipale,
    (HMENU)ID_PUSHBUTTON_3,
    instance,
    NULL);
     
    HANDLE hIcon=LoadIcon(NULL,IDI_ERROR);
    SendMessage(hControle,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcon);
    }
    // Deuxième groupe: les check box
    hGroup=CreateWindow(
    "BUTTON",
    "Paramètres Supplementaires",
    WS_CHILD|WS_VISIBLE|BS_GROUPBOX,
    260,370,
    500,100,
    fenetrePrincipale,
    NULL,
    instance,
    NULL);
    {
    HWND hControle;
    // une check box automatique deux états
    hControle=CreateWindow(
    "BUTTON",
    "Le fichier de destination est sur un disque amovible",
    WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX,
    260+10,370+30,
    400,20,
    fenetrePrincipale,
    (HMENU)ID_CHECKBOX_1,
    instance,
    NULL);
     
    // le même mais non automatique :)
    hControle=CreateWindow(
    "BUTTON",
    "Supprimer le fichier d'origine",
    WS_CHILD|WS_VISIBLE|BS_3STATE,
    260+10,370+60,
    400,20,
    fenetrePrincipale,
    (HMENU)ID_CHECKBOX_4,
    instance,
    NULL);
    }
    // troisième groupe : les radio button
    hGroup=CreateWindow(
    "BUTTON",
    "Mode de conversion",
    WS_CHILD|WS_VISIBLE|BS_GROUPBOX,
    10,320,
    240,150,
    fenetrePrincipale,
    NULL,
    instance,
    NULL);
    {
    HWND hControle;
    // trois radio button
    hControle=CreateWindow(
    "BUTTON",
    "MP3",
    WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|WS_GROUP,
    10+10,320+30,
    100,20,
    fenetrePrincipale,
    (HMENU)ID_RADIOBUTTON_11,
    instance,
    NULL);
    hControle=CreateWindow(
    "BUTTON",
    "OGG",
    WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|WS_GROUP,
    10+10,320+60,
    100,20,
    fenetrePrincipale,
    (HMENU)ID_RADIOBUTTON_12,
    instance,
    NULL);
    hControle=CreateWindow(
    "BUTTON",
    "OGG",
    WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|WS_GROUP,
    10+10,320+90,
    100,20,
    fenetrePrincipale,
    (HMENU)ID_RADIOBUTTON_13,
    instance,
    NULL);
     
    // trois autres, mais qui forment un autre groupe
    hControle=CreateWindow(
    "BUTTON",
    "WMA",
    WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|WS_GROUP,
    130+10,320+30,
    100,20,
    fenetrePrincipale,
    (HMENU)ID_RADIOBUTTON_21,
    instance,
    NULL);
    hControle=CreateWindow(
    "BUTTON",
    "MP3",
    WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|WS_GROUP,
    130+10,320+60,
    100,20,
    fenetrePrincipale,
    (HMENU)ID_RADIOBUTTON_22,
    instance,
    NULL);
    hControle=CreateWindow(
    "BUTTON",
    "OGG",
    WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|WS_GROUP,
    130+10,320+90,
    100,20,
    fenetrePrincipale,
    (HMENU)ID_RADIOBUTTON_23,
    instance,
    NULL);
     
    }
     
    }
     
    VOID AfficheActionCheckBox(int index,HWND hCtl,HWND fenetrePrincipale)
    {
    // test si la check box est cochée, non cochée ou inderterminée.
    LRESULT lRes=SendMessage(hCtl,BM_GETCHECK,0,0);
    CHAR lpMessage[128];
     
    sprintf(lpMessage,"Paramétre modifier avec succès",index,
    lRes==BST_CHECKED?"cochée":
    lRes==BST_UNCHECKED?"décochée":"inderterminée");
     
    MessageBox(fenetrePrincipale,lpMessage,"Succès",
    MB_ICONINFORMATION|MB_OK);
    }
     
    VOID DemandeActionCheckBox4(HWND hCtl,HWND fenetrePrincipale)
    {
    // test si la check box est cochée, non cochée ou inderterminée.
    LRESULT lRes=SendMessage(hCtl,BM_GETCHECK,0,0);
    PCHAR lpProchainEtat;
    UINT iProchainEtat;
    UINT iChoix;
    CHAR lpMessage[128];
     
    if(lRes==BST_CHECKED)
    {
    lpProchainEtat="inderterminée";
    iProchainEtat=BST_INDETERMINATE;
    }
    else if(lRes==BST_INDETERMINATE)
    {
    lpProchainEtat="décochée";
    iProchainEtat=BST_UNCHECKED;
    }
    else
    {
    lpProchainEtat="cochée";
    iProchainEtat=BST_CHECKED;
    }
     
    sprintf(lpMessage,"Etes vous sur de vouloir supprimmer le fichier d'origine ?",lpProchainEtat);
     
    iChoix=MessageBox(fenetrePrincipale,lpMessage,"",MB_YESNO);
    if(iChoix==IDYES)
    SendMessage(hCtl,BM_SETCHECK,(WPARAM)iProchainEtat,0);
    }
     
    VOID NotificationControle(HWND fenetrePrincipale,UINT message, WPARAM wParam, LPARAM lParam)
    {
    UINT iId=LOWORD(wParam);
    HWND hCtl=(HWND)lParam;
     
    switch(iId)
    {
    case ID_PUSHBUTTON_1:
    MessageBox(fenetrePrincipale,"Vous avez appuyé sur le premier bouton","",MB_OK);
    break;
    case ID_PUSHBUTTON_2:
    MessageBox(fenetrePrincipale,"Initiation du processus de conversion","",MB_OK);
    break;
    case ID_PUSHBUTTON_3:
    MessageBox(fenetrePrincipale,"Voulez-vous vraiment quitter","",MB_OK);
    break;
    case ID_CHECKBOX_1:
    case ID_CHECKBOX_2:
    case ID_CHECKBOX_3:
    AfficheActionCheckBox(iId-ID_CHECKBOX_1,hCtl,fenetrePrincipale);
    break;
    case ID_CHECKBOX_4:
    DemandeActionCheckBox4(hCtl,fenetrePrincipale);
    break;
    }
    }
     
    LRESULT CALLBACK procedureFenetrePrincipale(HWND fenetrePrincipale, UINT message, WPARAM wParam, LPARAM lParam)
    {
    static HWND boutons[2] = {NULL};
     
    switch (message)
    {
    case WM_CREATE:
    RemplieFenetrePrincipale(fenetrePrincipale);
    return 0;
    case WM_COMMAND:
    NotificationControle(fenetrePrincipale,message,wParam,lParam);
    return 0;
    case WM_DESTROY:
    PostQuitMessage(0);
    return 0;
    default:
    return DefWindowProc(fenetrePrincipale,message,wParam,lParam);
    }
    }
     
     
    HWND hWndMain,hWndBtn;
    char Result[MAX_PATH];
     
    int FolderBrowse()
    {
    BROWSEINFO bi;
        ITEMIDLIST *il;
    char Buffer[MAX_PATH];
     
    bi.hwndOwner=hWndMain;
    bi.pidlRoot=NULL;
    bi.pszDisplayName=&Buffer[0];
    bi.lpszTitle="Select a folder...";
    bi.ulFlags=0;
    bi.lpfn=NULL;
     
        if ((il=SHBrowseForFolder(&bi))==NULL) return 0;
        return SHGetPathFromIDList(il,&Result[0]);
    }
    LRESULT WINAPI WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
    {
    PAINTSTRUCT ps;
        HDC hdc;
    switch( msg )
    {
    case WM_COMMAND:
    {
    switch(LOWORD(wParam))
    {
    case IDC_BTN_BROWSE:
                        if(FolderBrowse())
         MessageBox(hWndMain,&Result[0],"Returned path",MB_ICONINFORMATION);
    break;
    }
    } break;
    case WM_DESTROY:
    PostQuitMessage( 0 );
    return 0;
    case WM_PAINT:
    hdc=BeginPaint(hWnd,&ps);
    EndPaint(hWnd,&ps);
    return 1;
    }
     
    return DefWindowProc( hWnd, msg, wParam, lParam );
    }
     
    INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
    {
    WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_HREDRAW | CS_VREDRAW, WndProc, 0L, 0L,
    hInst, NULL, LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_BTNFACE+1), NULL,
    "MY_CLASS", NULL };
    RegisterClassEx( &wc );
     
    hWndMain = CreateWindow( "MY_CLASS", "SHBrowseForFolder",
    WS_OVERLAPPED | WS_SYSMENU, 50, 50, 250,100,
    NULL, NULL, hInst, NULL );
    ShowWindow( hWndMain, nCmdShow );
    UpdateWindow( hWndMain );
     
    hWndBtn = CreateWindow("BUTTON","Browse ...",WS_CHILD|WS_VISIBLE,10,10,100,25,hWndMain,(HMENU)IDC_BTN_BROWSE,hInst,NULL);
     
    MSG msg;
    while( GetMessage( &msg, NULL, 0, 0 ) )
    {
    TranslateMessage( &msg );
    DispatchMessage( &msg );
    }
        return 0;
    }
    {
    HWND fenetrePrincipale;
    MSG message;
    WNDCLASS classeFenetre;
     
    instance = cetteInstance;
     
    classeFenetre.style = 0;
    classeFenetre.lpfnWndProc = procedureFenetrePrincipale;
    classeFenetre.cbClsExtra = 0;
    classeFenetre.cbWndExtra = 0;
    classeFenetre.hInstance = NULL;
    classeFenetre.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    classeFenetre.hCursor = LoadCursor(NULL, IDC_ARROW);
    classeFenetre.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
    classeFenetre.lpszMenuName = NULL;
    classeFenetre.lpszClassName = "classeF";
     
    // On prévoit quand même le cas où ça échoue
    if(!RegisterClass(&classeFenetre))
    return FALSE;
     
    fenetrePrincipale=CreateWindow(
    "classeF",
    "MP4 Heart Convert 1.0 ::: Interface de conversion",
    WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT,CW_USEDEFAULT,
    800,600,
    NULL,
    NULL,
    cetteInstance,
    NULL);
     
    if (!fenetrePrincipale)
    return FALSE;
     
    ShowWindow(fenetrePrincipale,modeDAffichage);
    UpdateWindow(fenetrePrincipale);
     
     
    while(GetMessage(&message,NULL,0,0))
    {
    TranslateMessage(&message);
    DispatchMessage(&message);
    }
     
    return message.wParam;
    }
     
     
     
    /*====================== Scrute tous les sous-dossiers à partir de "Dossier" ====================*/
    void ScruterSousDossiers(char * Dossier)
    {
        HANDLE hRecherche;
        WIN32_FIND_DATA WFD;
        char * Nom = WFD.cFileName;
        char DossFiltre[1024], DossRech[1024];
    //-----//
        strcpy(DossFiltre, Dossier);
        strcat(DossFiltre, "*.*");
        hRecherche = FindFirstFile(DossFiltre, &WFD);
        if(hRecherche == INVALID_HANDLE_VALUE)
        {
            FindClose(hRecherche);
            return;
        }
        do
        {
            if((WFD.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)
            {
                if(!(Nom[0] == '.' && !Nom[1]) && !(Nom[0] == '.' && Nom[1] == '.' && !Nom[2]))
                {
                    strcpy(DossRech, Dossier);
                    strcat(DossRech, Nom);
                    strcat(DossRech, "\\");
     
                    // PLACER LE CODE DE TRAITEMENT ICI, POUR LE DOSSIER "DossRech".
     
                    ScruterSousDossiers(DossRech);
                }
            }
        }
        while(FindNextFile(hRecherche,&WFD));
        FindClose(hRecherche);
    }
    Voici les erreurs de compilations
    main.cpp:390: error: expected unqualified-id before '{' token
    main.cpp:390: error: expected `,' or `;' before '{' token

    Je precise la ligne 390
    Merci d'avance et bonne soirée


  2. #2
    Expert éminent sénior
    Avatar de Mat.M
    Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2006
    Messages
    8 361
    Détails du profil
    Informations personnelles :
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Novembre 2006
    Messages : 8 361
    Points : 20 381
    Points
    20 381
    Par défaut
    et dans "constantes.h" est-ce qu'il ya bien les ; les points virgules ? Vérifier les h

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    7
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2007
    Messages : 7
    Points : 6
    Points
    6
    Par défaut
    Non c'est pas ca merci quand même j'ai trouver tout seul la solution

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Compilation API Windows
    Par JagV12 dans le forum Windows
    Réponses: 4
    Dernier message: 16/03/2008, 11h47
  2. API windows erreur a la compilation du projet
    Par JoneZy dans le forum Windows
    Réponses: 3
    Dernier message: 25/12/2006, 23h38
  3. Réponses: 13
    Dernier message: 14/10/2005, 11h01
  4. [Debutant][API Windows] Erreur sur SelectObject
    Par coolmaxou dans le forum Windows
    Réponses: 2
    Dernier message: 13/07/2005, 08h06
  5. Api mysql avec Devc++, erreur de compilation
    Par Viiince dans le forum Autres éditeurs
    Réponses: 5
    Dernier message: 15/06/2004, 17h19

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo