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 :

projet calcul bpf


Sujet :

Windows

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Invité
    Invité(e)
    Par défaut projet calcul bpf
    bonjour,

    voilà mon projet est on va dire quasi fini (à 2 ou 3 détails) grâce à vous (je n'ai pas fait grand chose) : c'est un calculateur de bpf en fonction de la résolution (utile pour le DVD-rip) :

    voici l'exe : http://www.megaupload.com/?d=LLINA3DQ

    et voici le code source complet (certes critiquable) :
    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
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    #include <windows.h>
    #include <stdio.h>
    #include <commctrl.h>
    #include <tchar.h>
    
    #define ID_PUSHBUTTON_1     110
    #define ID_PUSHBUTTON_2     111
    #define ID_PUSHBUTTON_3     112
    #define ID_PUSHBUTTON_4     113
    #define ID_PUSHBUTTON_5     114
    #define ID_CHECKBOX_1       115
    #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_EDITBOX_1        1200
    #define ID_EDITBOX_2        1201
    #define ID_EDITBOX_3        1202
    #define ID_EDITBOX_4        1203
    #define ID_EDITBOX_5        1204
    // #define ID_UPDOWN           2000
    #define ID_STATIC_1         500
    #define ID_STATIC_2         501
    #define ID_STATIC_3         502
    #define ID_STATIC_4         503
    
    //variables globales
    HINSTANCE instance;
    HWND hEdit;
    HWND hGroup;
    HWND hControle;
    HWND hupdown;
    HWND hCtl;
    UINT bitrate;
    double fps;
    int width, height, lpnmud,
    
    /* 1er tableau déclaré stockant les valeurs de height en 16:9 mod 16
    	le tableau contient 45 éléments => indice i variant de 0 à 44 */
    tableau1_mod16[] = {400,384,384,368,352,352,336,336,320,320,304,304,288,288,272,256,
    					256,240,240,224,224,208,208,192,192,176,160,160,144,144,128,128,
    					112,112,96,80,80,64,64,48,48,32,32,16,16},
    
    /* 2ème tableau déclaré stockant les valeurs de height en 16:9 mod 1
    	le tableau contient 692 éléments => indice i variant de 0 à 691 */
    tableau2_mod1[] =  {395,394,394,393,393,392,392,391,390,390,389,389,388,388,387,387,
    					386,386,385,384,384,383,383,382,382,381,381,380,380,379,378,378,
    					377,377,376,376,375,375,374,373,373,372,372,371,371,370,370,369,
    					369,368,367,367,366,366,365,365,364,364,363,363,362,361,361,360,
    					360,359,359,358,358,357,356,356,355,355,354,354,353,353,352,352,
    					351,350,350,349,349,348,348,347,347,346,346,345,344,344,343,343,
    					342,342,341,341,340,339,339,338,338,337,337,336,336,335,335,334,
    					333,333,332,332,331,331,330,330,329,329,328,327,327,326,326,325,
    					325,324,324,323,322,322,321,321,320,320,319,319,318,318,317,316,
    					316,315,315,314,314,313,313,312,312,311,310,310,309,309,308,308,
    					307,307,306,305,305,304,304,303,303,302,302,301,301,300,299,299,
    					298,298,297,297,296,296,295,295,294,293,293,292,292,291,291,290,
    					290,289,288,288,287,287,286,286,285,285,284,284,283,282,282,281,
    					281,280,280,279,279,278,278,277,276,276,275,275,274,274,273,273,
    					272,271,271,270,270,269,269,268,268,267,267,266,265,265,264,264,
    					263,263,262,262,261,261,260,259,259,258,258,257,257,256,256,255,
    					254,254,253,253,252,252,251,251,250,250,249,248,248,247,247,246,
    					246,245,245,244,244,243,242,242,241,241,240,240,239,239,238,237,
    					237,236,236,235,235,234,234,233,233,232,231,231,230,230,229,229,
    					228,228,227,227,226,225,225,224,224,223,223,222,222,221,220,220,
    					219,219,218,218,217,217,216,216,215,214,214,213,213,212,212,211,
    					211,210,210,209,208,208,207,207,206,206,205,205,204,203,203,202,
    					202,201,201,200,200,199,199,198,197,197,196,196,195,195,194,194,
    					193,193,192,191,191,190,190,189,189,188,188,187,186,186,185,185,
    					184,184,183,183,182,182,181,180,180,179,179,178,178,177,177,176,
    					176,175,174,174,173,173,172,172,171,171,170,169,169,168,168,167,
    					167,166,166,165,165,164,163,163,162,162,161,161,160,160,159,158,
    					158,157,157,156,156,155,155,154,154,153,152,152,151,151,150,150,
    					149,149,148,148,147,146,146,145,145,144,144,143,143,142,141,141,
    					140,140,139,139,138,138,137,137,136,135,135,134,134,133,133,132,
    					132,131,131,130,129,129,128,128,127,127,126,126,125,124,124,123,
    					123,122,122,121,121,120,120,119,118,118,117,117,116,116,115,115,
    					114,114,113,112,112,111,111,110,110,109,109,108,107,107,106,106,
    					105,105,104,104,103,103,102,101,101,100,100,
    					99,99,98,98,97,97,96,95,95,94,94,93,93,92,92,91,90,90,89,89,88,
    					88,87,87,86,86,85,84,84,83,83,82,82,81,81,80,80,79,78,78,77,77,
    					76,76,75,75,74,73,73,72,72,71,71,70,70,69,69,68,67,67,66,66,65,
    					65,64,64,63,63,62,61,61,60,60,59,59,58,58,57,56,56,55,55,54,54,
    					53,53,52,52,51,50,50,49,49,48,48,47,47,46,46,45,44,44,43,43,42,
    					42,41,41,40,39,39,38,38,37,37,36,36,35,35,34,33,33,32,32,31,31,
    					30,30,29,29,28,27,27,26,26,25,25,24,24,23,22,22,21,21,20,20,19,
    					19,18,18,17,16,16},
    
    /* 3ème tableau déclaré stockant les valeurs de height en 4:3 mod 16
    	le tableau contient 45 éléments => indice i variant de 0 à 44 */
    tableau3_mod16[] = {528,512,496,496,480,464,464,448,432,416,416,400,384,368,368,352,
    					336,320,320,304,288,288,272,256,240,240,224,208,192,192,176,160,
    					160,144,128,112,112,96,80,64,64,48,32,16,16},
    
    /* 4ème tableau déclaré stockant les valeurs de height en 4:3 mod 1
    	le tableau contient 697 éléments => indice i variant de 0 à 696 */
    tableau4_mod1[] =  {526,526,525,524,524,523,522,521,521,520,519,518,518,517,516,516,
    					515,514,513,513,512,511,510,510,509,508,507,507,506,505,505,504,
    					503,502,502,501,500,499,499,498,497,497,496,495,494,494,493,492,
    					491,491,490,489,488,487,486,486,485,484,483,483,482,481,480,480,
    					479,478,478,477,476,475,475,474,473,472,472,471,470,469,469,468,
    					467,467,466,465,464,464,463,462,461,461,460,459,458,458,457,456,
    					456,455,454,453,453,452,451,450,450,449,448,448,447,446,445,445,
    					444,443,442,442,441,440,439,439,438,437,437,436,435,434,434,433,
    					432,431,431,430,429,429,428,427,426,426,425,424,423,423,422,421,
    					420,420,419,418,418,417,416,415,415,414,413,412,412,411,410,410,
    					409,408,407,407,406,405,404,404,403,402,401,401,400,399,399,398,
    					397,396,396,395,394,393,393,392,391,390,390,389,388,388,387,386,
    					385,385,384,383,382,382,381,380,380,379,378,377,377,376,375,374,
    					374,373,372,371,371,370,369,369,368,367,366,366,365,364,363,363,
    					362,361,361,360,359,358,358,357,356,355,355,354,353,352,352,351,
    					350,350,349,348,347,347,346,345,344,344,343,342,341,340,339,339,
    					338,337,336,336,335,334,333,333,332,331,331,330,329,328,328,327,
    					326,325,325,324,323,322,322,321,320,320,319,318,317,317,316,315,
    					314,314,313,312,312,311,310,309,309,308,307,306,306,305,304,303,
    					303,302,301,301,300,299,298,298,297,296,295,295,294,293,292,292,
    					291,290,290,289,288,287,287,286,285,284,284,283,282,282,281,280,
    					279,279,278,277,276,276,275,274,273,273,272,271,271,270,269,268,
    					268,267,266,265,265,264,263,263,262,261,260,260,259,258,257,257,
    					256,255,254,254,253,252,252,251,250,249,249,248,247,246,246,245,
    					244,244,243,242,241,241,240,239,238,238,237,236,235,235,234,233,
    					233,232,231,230,230,229,228,227,227,226,225,224,224,223,222,222,
    					221,220,219,219,218,217,216,216,215,214,214,213,212,211,211,210,
    					209,208,208,207,206,205,205,204,203,203,202,201,200,200,199,198,
    					197,197,196,195,195,194,193,192,192,191,190,189,189,188,187,186,
    					186,185,184,184,183,182,181,181,180,179,178,178,177,176,176,175,
    					174,173,173,172,171,170,170,169,168,167,167,166,165,165,164,163,
    					162,162,161,160,159,159,158,157,156,156,155,154,154,153,152,151,
    					151,150,149,148,148,147,146,146,145,144,143,143,142,141,140,140,
    					139,138,137,137,136,135,135,134,133,132,132,131,130,129,129,128,
    					127,127,126,125,124,124,123,122,121,121,120,119,118,118,117,116,
    					116,115,114,113,113,112,111,110,110,109,108,107,107,106,105,105,
    					104,103,102,102,101,100,
    					99,99,98,97,97,96,95,94,94,93,92,91,91,90,89,88,88,87,86,86,85,
    					84,83,83,82,81,80,80,79,78,78,77,76,75,75,74,73,72,72,71,70,69,
    					69,68,67,67,66,65,64,64,63,62,61,61,60,59,58,58,57,56,56,55,54,
    					53,53,52,51,50,50,49,48,48,47,46,45,45,44,43,42,42,41,40,39,39,
    					38,37,37,36,35,34,34,33,32,31,31,30,29,29,28,27,26,26,25,24,23,
    					23,22,21,20,20,19,18,18,17,16},
    i;
    					
    TCHAR bufw[3], bufh[3];
    
    VOID RemplieFenetrePrincipale(HWND fenetrePrincipale)
    {	
    	UINT bool_3;
            // On le remplit avec un premier push button tout bête		
    		hControle=CreateWindow(
                "BUTTON",
                "Stock please",
                WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
                10+260,10+4,
                90,20,
                fenetrePrincipale,
                (HMENU)ID_PUSHBUTTON_1,
                instance,
                NULL);
    			
    		hControle=CreateWindow(
                "BUTTON",
                "ENTER",
                WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
                10+168,10+119,
                50,20,
                fenetrePrincipale,
                (HMENU)ID_PUSHBUTTON_2,
                instance,
                NULL);
    			
            // un second avec quelques flags : plat et plusieurs lignes
            hControle=CreateWindow(
                "BUTTON",
                "See you later",
                WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_FLAT|BS_MULTILINE,
                10,10+217,
                100,20,
                fenetrePrincipale,
                (HMENU)ID_PUSHBUTTON_5,
                instance,
                NULL);        	    
            
            // une check box automatique deux états
            hControle=CreateWindow(
                "BUTTON",
                "Resolution Mod 16",
                WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX|BS_FLAT,
                10+230,10+218,
                140,20,
                fenetrePrincipale,
                (HMENU)ID_CHECKBOX_1,
                instance,
                NULL);
    			
    		CheckDlgButton(      
    		fenetrePrincipale,
    		ID_CHECKBOX_1,
    		BST_CHECKED);
        
        // troisième groupe : les radio button
        hGroup=CreateWindow(
            "BUTTON",
            "Select FPS or enter one",
            WS_CHILD|WS_VISIBLE|BS_GROUPBOX,
            10,10+40,
            225,110,
            fenetrePrincipale,
            NULL,
            instance,
            NULL);
        {
            HWND hControle;
            // trois radio button
            hControle=CreateWindow(
                "BUTTON",
                "25 FPS (PAL)",
                WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|WS_GROUP|BS_FLAT,
                10+10,10+60,
                150,20,
                fenetrePrincipale,
                (HMENU)ID_RADIOBUTTON_11,
                instance,
                NULL);		
    
            hControle=CreateWindow(
                "BUTTON",
                "23.97 FPS (NTSC)",
                WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|BS_FLAT,
                10+10,10+90,
                150,20,
                fenetrePrincipale,
                (HMENU)ID_RADIOBUTTON_12,
                instance,
                NULL);
    
            hControle=CreateWindow(
                "BUTTON",
                "Other",
                WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|BS_FLAT,
                10+10,10+120,
                60,20,
                fenetrePrincipale,
                (HMENU)ID_RADIOBUTTON_13,
                instance,
                NULL);
    			
    	CheckDlgButton(      
    	fenetrePrincipale,
    	ID_RADIOBUTTON_11,
    	BST_CHECKED);
    	bool_3=IsDlgButtonChecked(fenetrePrincipale, ID_RADIOBUTTON_11);
    	if (bool_3 == 1)
    		fps=25;
        }
    	
    	hCtl=CreateWindow(
            "STATIC",
            "Enter average bitrate (kbits/s) :",
            WS_CHILD|WS_VISIBLE|SS_CENTER|SS_NOTIFY,
            10,10+5,
            200,20,
            fenetrePrincipale,
            (HMENU)ID_STATIC_1,
            instance,
            NULL);
    	
    	hCtl=CreateWindow(
            "STATIC",
            "+ click",
            WS_CHILD|WS_VISIBLE|SS_CENTER|SS_NOTIFY,
            10+118,10+121,
            50,20,
            fenetrePrincipale,
            (HMENU)ID_STATIC_2,
            instance,
            NULL);
    		
    	hCtl=CreateWindow(
            "STATIC",
            "BPF nearest 0.3 for Xvid",
            WS_CHILD|WS_VISIBLE|SS_CENTER|SS_NOTIFY,
            10,10+170,
            160,20,
            fenetrePrincipale,
            (HMENU)ID_STATIC_3,
            instance,
            NULL);
    		
    	hCtl=CreateWindow(
            "STATIC",
            "BPF is :",
            WS_CHILD|WS_VISIBLE|SS_CENTER|SS_NOTIFY,
            10+120,10+199,
            60,20,
            fenetrePrincipale,
            (HMENU)ID_STATIC_4,
            instance,
            NULL);	
    		
    	hEdit=CreateWindow( "EDIT",
                            "",
                             WS_VISIBLE|WS_CHILD|WS_BORDER|ES_CENTER|ES_NUMBER ,
                             10+205,10+3,50,20,fenetrePrincipale,(HMENU)ID_EDITBOX_1,instance,NULL);
    	
    	hEdit=CreateWindow( "EDIT",
                            "",
                             WS_VISIBLE|WS_CHILD|WS_BORDER|ES_CENTER ,
                             10+70,10+119,50,20,fenetrePrincipale,(HMENU)ID_EDITBOX_2,instance,NULL);
    	
    	width=720;	
    	_stprintf(bufw, TEXT("%d"), width);
    	hEdit=CreateWindow( "EDIT",
                            bufw,
                            WS_VISIBLE|WS_CHILD|WS_BORDER|ES_CENTER|ES_READONLY ,
                             10+248,10+172,40,20,fenetrePrincipale,(HMENU)ID_EDITBOX_3,instance,NULL);
    	
    	i=0;
    	height=tableau1_mod16[i];	
    	_stprintf(bufh, TEXT("%d"), height);
    	hEdit=CreateWindow( "EDIT",
                            bufh,
                            WS_VISIBLE|WS_CHILD|WS_BORDER|ES_CENTER|ES_READONLY ,
                             10+313,10+172,40,20,fenetrePrincipale,(HMENU)ID_EDITBOX_4,instance,NULL);
    						 
    	hEdit=CreateWindow( "EDIT",
                            "",
                            WS_VISIBLE|WS_CHILD|WS_BORDER|ES_CENTER|ES_READONLY ,
                             10+180,10+197,40,20,fenetrePrincipale,(HMENU)ID_EDITBOX_5,instance,NULL);
    		
    	hGroup=CreateWindow(
            "BUTTON",
            "Select input PAR",
            WS_CHILD|WS_VISIBLE|BS_GROUPBOX,
            10+249,10+40,
            125,110,
            fenetrePrincipale,
            NULL,
            instance,
            NULL);
        {
            HWND hControle;
            // trois radio button
            hControle=CreateWindow(
                "BUTTON",
                "16:9",
                WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|WS_GROUP|BS_FLAT,
                10+259,10+60,
                50,20,
                fenetrePrincipale,
                (HMENU)ID_RADIOBUTTON_21,
                instance,
                NULL);
    
            hControle=CreateWindow(
                "BUTTON",
                "4:3",
                WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|BS_FLAT,
                10+259,10+90,
                50,20,
                fenetrePrincipale,
                (HMENU)ID_RADIOBUTTON_22,
                instance,
                NULL);
    			
    	CheckDlgButton(      
    	fenetrePrincipale,
    	ID_RADIOBUTTON_21,
    	BST_CHECKED);
    	}
    	
    	hControle=CreateWindow(
                "BUTTON",
                "U",
                WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
                10+290,10+165,
                22,17,
                fenetrePrincipale,
                (HMENU)ID_PUSHBUTTON_3,
                instance,
                NULL);
    	
    	hControle=CreateWindow(
                "BUTTON",
                "D",
                WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
                10+290,10+182,
                22,17,
                fenetrePrincipale,
                (HMENU)ID_PUSHBUTTON_4,
                instance,
                NULL);	
    }
    
    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="décochée";
            iProchainEtat=BST_UNCHECKED;		
        }    
        else if (lRes==BST_UNCHECKED)
        {		
            lpProchainEtat="cochée";
            iProchainEtat=BST_CHECKED;	
        }    
            SendMessage(hCtl,BM_SETCHECK,(WPARAM)iProchainEtat,0);
    }
    
    VOID calculaffichresbpf(HWND fenetrePrincipale)
    {	
    	TCHAR bpfstr[5];
    	double bpf;
    	
    	bpf=(bitrate*1000)/(width*height*fps);
    	sprintf(bpfstr, "%.3f", bpf);
    	SetDlgItemText(fenetrePrincipale, ID_EDITBOX_5, bpfstr);
    }
    
    VOID NotificationControle(HWND fenetrePrincipale,UINT message, WPARAM wParam, LPARAM lParam)
    {    
        UINT iId=LOWORD(wParam), freefps, mon_booleen, bool_2, bool_4;
        HWND hCtl=(HWND)lParam;
    	CHAR lpMessage[128];
    	TCHAR buf[7], buflpnmud[3];	
    	
        switch(iId)
        {	
            case ID_PUSHBUTTON_1:		    
    		    bitrate=GetDlgItemInt(fenetrePrincipale, ID_EDITBOX_1, NULL, FALSE);
    			calculaffichresbpf(fenetrePrincipale);
    		    break;
    			
    		case ID_PUSHBUTTON_2:
    			mon_booleen=IsDlgButtonChecked(fenetrePrincipale, ID_RADIOBUTTON_13);
    		    if (mon_booleen == 1)
    			{			
                freefps=GetDlgItemText(fenetrePrincipale, ID_EDITBOX_2, buf, 7);
    			fps=strtod(buf, NULL);			
    			}
    			calculaffichresbpf(fenetrePrincipale);
                break;		
    		
    		case ID_PUSHBUTTON_3:			
    			bool_2=IsDlgButtonChecked(fenetrePrincipale, ID_CHECKBOX_1);
    			bool_4=IsDlgButtonChecked(fenetrePrincipale, ID_RADIOBUTTON_21);			
    			if (bool_4 == 1) // 16:9
    				{
    				if (bool_2 == 1) // 16:9 mod 16
    					{
    					if (width<720 && i>0)
    						{
    						width = width + 16;
    						i=i-1;
    						height=tableau1_mod16[i];
    						}
    					}				
    				else // 16:9 mod 1
    					{
    					if (width<720 && i>0)
    						{
    						width = width + 1;
    						i=i-1;
    						height=tableau2_mod1[i];
    						}
    					}
    				}
    			else // 4:3
    				{
    				if (bool_2 == 1) // 4:3 mod 16
    					{
    					if (width<720 && i>0)
    						{
    						width = width + 16;
    						i=i-1;
    						height=tableau3_mod16[i];
    						}
    					}				
    				else // 4:3 mod 1
    					{
    					if (width<720 && i>0)
    						{
    						width = width + 1;
    						i=i-1;
    						height=tableau4_mod1[i];
    						}
    					}
    				}							
    			sprintf(bufw, "%d", width);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_3, bufw);
    			sprintf(bufh, "%d", height);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_4, bufh);			
    			calculaffichresbpf(fenetrePrincipale);
    		    break;
    		
    		case ID_PUSHBUTTON_4:
    			bool_2=IsDlgButtonChecked(fenetrePrincipale, ID_CHECKBOX_1);			
    			bool_4=IsDlgButtonChecked(fenetrePrincipale, ID_RADIOBUTTON_21);			
    			if (bool_4 == 1) // 16:9
    				{
    				if (bool_2 == 1) // 16:9 mod 16
    					{
    					if (width>16 && i<44)
    						{
    						width = width - 16;
    						i=i+1;
    						height=tableau1_mod16[i];
    						}
    					}				
    				else // 16:9 mod 1
    					{
    					if (width>16 && i<691)
    						{
    						width = width - 1;
    						i=i+1;
    						height=tableau2_mod1[i];
    						}
    					}
    				}
    			else // 4:3
    				{
    				if (bool_2 == 1) // 4:3 mod 16
    					{
    					if (width>16 && i<44)
    						{
    						width = width - 16;
    						i=i+1;
    						height=tableau3_mod16[i];
    						}
    					}				
    				else // 4:3 mod 1
    					{
    					if (width>16 && i<696)
    						{
    						width = width - 1;
    						i=i+1;
    						height=tableau4_mod1[i];
    						}
    					}
    				}
    			sprintf(bufw, "%d", width);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_3, bufw);
    			sprintf(bufh, "%d", height);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_4, bufh);			
    			calculaffichresbpf(fenetrePrincipale);
    		    break;
    		
            case ID_PUSHBUTTON_5:
                DestroyWindow(fenetrePrincipale);
                break;
    			
    		case ID_RADIOBUTTON_11:		    						
    		    fps=25;
    			calculaffichresbpf(fenetrePrincipale);
    		    break;
    			
    		case ID_RADIOBUTTON_12:		    			
    		    fps=23.9765;
    			calculaffichresbpf(fenetrePrincipale);
    		    break;
    			
    		case ID_RADIOBUTTON_21:
    			width = 720;
    			sprintf(bufw, "%d", width);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_3, bufw);
    			i=0;
    			bool_2=IsDlgButtonChecked(fenetrePrincipale, ID_CHECKBOX_1);			
    			if (bool_2 == 1)			
    				height=tableau1_mod16[i];
    			else
    				height=tableau2_mod1[i];			
    			sprintf(bufh, "%d", height);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_4, bufh);
    			calculaffichresbpf(fenetrePrincipale);
    			break;
    			
    		case ID_RADIOBUTTON_22:
    			width = 720;
    			sprintf(bufw, "%d", width);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_3, bufw);
    			i=0;
    			bool_2=IsDlgButtonChecked(fenetrePrincipale, ID_CHECKBOX_1);				
    			if (bool_2 == 1)
    				height=tableau3_mod16[i];
    			else
    				height=tableau4_mod1[i];				
    			sprintf(bufh, "%d", height);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_4, bufh);
    			calculaffichresbpf(fenetrePrincipale);
    			break;
    			
    		case ID_CHECKBOX_1:
    			width = 720;
    			sprintf(bufw, "%d", width);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_3, bufw);
    			i=0;
    			bool_2=IsDlgButtonChecked(fenetrePrincipale, ID_CHECKBOX_1);
    			bool_4=IsDlgButtonChecked(fenetrePrincipale, ID_RADIOBUTTON_21);			
    			if (bool_4 == 1) // 16:9 
    				{
    				if (bool_2 == 1) // 16:9 mod 16			
    					height=tableau1_mod16[i];
    				else // 16:9 mod 1
    					height=tableau2_mod1[i];
    				}
    			else // 4:3
    				{
    				if (bool_2 == 1) // 4:3 mod 16
    					height=tableau3_mod16[i];
    				else // 4:3 mod 1
    					height=tableau4_mod1[i];
    				}
    			sprintf(bufh, "%d", height);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_4, bufh);
    			calculaffichresbpf(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);
        }
    }
    
    
    int WINAPI WinMain (HINSTANCE cetteInstance, HINSTANCE precedenteInstance,
                 LPSTR lignesDeCommande, int modeDAffichage)
    {
        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",
            "Boombaka calcula",
            WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX,
            CW_USEDEFAULT,CW_USEDEFAULT,
            400,300,
            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;
    }
    en vous remerciant beaucoup pour votre aide précieuse

  2. #2
    Invité
    Invité(e)
    Par défaut
    ça y est ça marche avec le updown control : merci médinoc

    voici le nouvel exe : http://www.megaupload.com/?d=MD5381SM

    en fait le UDM_SETBUDDYINT n'était pas nécessaire : il suffisait juste, dans le WM_NOTIFY, de rajouter ces lignes-là :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    sprintf(bufw, "%d", width);
    			SendDlgItemMessage(fenetrePrincipale,ID_EDITBOX_3,WM_SETTEXT,0,(LPARAM)bufw);
    			sprintf(bufh, "%d", height);
    			SendDlgItemMessage(fenetrePrincipale,ID_EDITBOX_4,WM_SETTEXT,0,(LPARAM)bufh);
    comme vous m'avez aidé à 90% pour le développement de ce freeware je vous laisse le source complet :
    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
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    #include <windows.h>
    #include <stdio.h>
    #include <commctrl.h>
    #include <tchar.h>
    
    #define ID_PUSHBUTTON_1     110
    #define ID_PUSHBUTTON_2     111
    #define ID_PUSHBUTTON_3     114
    #define ID_CHECKBOX         115
    #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_EDITBOX_1        1200
    #define ID_EDITBOX_2        1201
    #define ID_EDITBOX_3        1202
    #define ID_EDITBOX_4        1203
    #define ID_EDITBOX_5        1204
    #define ID_UPDOWN           2000
    #define ID_STATIC_1         500
    #define ID_STATIC_2         501
    #define ID_STATIC_3         502
    #define ID_STATIC_4         503
    
    //variables globales
    HINSTANCE instance;
    HWND hEdit;
    HWND hGroup;
    HWND hControle;
    HWND hupdown;
    HWND hCtl;
    UINT bitrate, bool_2, bool_4;
    double fps;
    int width, height, lpnmud,
    
    /* 1er tableau déclaré stockant les valeurs de height en 16:9 mod 16
    	le tableau contient 45 éléments => indice i variant de 0 à 44 */
    tableau1_mod16[] = {400,384,384,368,352,352,336,336,320,320,304,304,288,288,272,256,
    					256,240,240,224,224,208,208,192,192,176,160,160,144,144,128,128,
    					112,112,96,80,80,64,64,48,48,32,32,16,16},
    
    /* 2ème tableau déclaré stockant les valeurs de height en 16:9 mod 1
    	le tableau contient 692 éléments => indice i variant de 0 à 691 */
    tableau2_mod1[] =  {395,394,394,393,393,392,392,391,390,390,389,389,388,388,387,387,
    					386,386,385,384,384,383,383,382,382,381,381,380,380,379,378,378,
    					377,377,376,376,375,375,374,373,373,372,372,371,371,370,370,369,
    					369,368,367,367,366,366,365,365,364,364,363,363,362,361,361,360,
    					360,359,359,358,358,357,356,356,355,355,354,354,353,353,352,352,
    					351,350,350,349,349,348,348,347,347,346,346,345,344,344,343,343,
    					342,342,341,341,340,339,339,338,338,337,337,336,336,335,335,334,
    					333,333,332,332,331,331,330,330,329,329,328,327,327,326,326,325,
    					325,324,324,323,322,322,321,321,320,320,319,319,318,318,317,316,
    					316,315,315,314,314,313,313,312,312,311,310,310,309,309,308,308,
    					307,307,306,305,305,304,304,303,303,302,302,301,301,300,299,299,
    					298,298,297,297,296,296,295,295,294,293,293,292,292,291,291,290,
    					290,289,288,288,287,287,286,286,285,285,284,284,283,282,282,281,
    					281,280,280,279,279,278,278,277,276,276,275,275,274,274,273,273,
    					272,271,271,270,270,269,269,268,268,267,267,266,265,265,264,264,
    					263,263,262,262,261,261,260,259,259,258,258,257,257,256,256,255,
    					254,254,253,253,252,252,251,251,250,250,249,248,248,247,247,246,
    					246,245,245,244,244,243,242,242,241,241,240,240,239,239,238,237,
    					237,236,236,235,235,234,234,233,233,232,231,231,230,230,229,229,
    					228,228,227,227,226,225,225,224,224,223,223,222,222,221,220,220,
    					219,219,218,218,217,217,216,216,215,214,214,213,213,212,212,211,
    					211,210,210,209,208,208,207,207,206,206,205,205,204,203,203,202,
    					202,201,201,200,200,199,199,198,197,197,196,196,195,195,194,194,
    					193,193,192,191,191,190,190,189,189,188,188,187,186,186,185,185,
    					184,184,183,183,182,182,181,180,180,179,179,178,178,177,177,176,
    					176,175,174,174,173,173,172,172,171,171,170,169,169,168,168,167,
    					167,166,166,165,165,164,163,163,162,162,161,161,160,160,159,158,
    					158,157,157,156,156,155,155,154,154,153,152,152,151,151,150,150,
    					149,149,148,148,147,146,146,145,145,144,144,143,143,142,141,141,
    					140,140,139,139,138,138,137,137,136,135,135,134,134,133,133,132,
    					132,131,131,130,129,129,128,128,127,127,126,126,125,124,124,123,
    					123,122,122,121,121,120,120,119,118,118,117,117,116,116,115,115,
    					114,114,113,112,112,111,111,110,110,109,109,108,107,107,106,106,
    					105,105,104,104,103,103,102,101,101,100,100,
    					99,99,98,98,97,97,96,95,95,94,94,93,93,92,92,91,90,90,89,89,88,
    					88,87,87,86,86,85,84,84,83,83,82,82,81,81,80,80,79,78,78,77,77,
    					76,76,75,75,74,73,73,72,72,71,71,70,70,69,69,68,67,67,66,66,65,
    					65,64,64,63,63,62,61,61,60,60,59,59,58,58,57,56,56,55,55,54,54,
    					53,53,52,52,51,50,50,49,49,48,48,47,47,46,46,45,44,44,43,43,42,
    					42,41,41,40,39,39,38,38,37,37,36,36,35,35,34,33,33,32,32,31,31,
    					30,30,29,29,28,27,27,26,26,25,25,24,24,23,22,22,21,21,20,20,19,
    					19,18,18,17,16,16},
    
    /* 3ème tableau déclaré stockant les valeurs de height en 4:3 mod 16
    	le tableau contient 45 éléments => indice i variant de 0 à 44 */
    tableau3_mod16[] = {528,512,496,496,480,464,464,448,432,416,416,400,384,368,368,352,
    					336,320,320,304,288,288,272,256,240,240,224,208,192,192,176,160,
    					160,144,128,112,112,96,80,64,64,48,32,16,16},
    
    /* 4ème tableau déclaré stockant les valeurs de height en 4:3 mod 1
    	le tableau contient 697 éléments => indice i variant de 0 à 696 */
    tableau4_mod1[] =  {526,526,525,524,524,523,522,521,521,520,519,518,518,517,516,516,
    					515,514,513,513,512,511,510,510,509,508,507,507,506,505,505,504,
    					503,502,502,501,500,499,499,498,497,497,496,495,494,494,493,492,
    					491,491,490,489,488,487,486,486,485,484,483,483,482,481,480,480,
    					479,478,478,477,476,475,475,474,473,472,472,471,470,469,469,468,
    					467,467,466,465,464,464,463,462,461,461,460,459,458,458,457,456,
    					456,455,454,453,453,452,451,450,450,449,448,448,447,446,445,445,
    					444,443,442,442,441,440,439,439,438,437,437,436,435,434,434,433,
    					432,431,431,430,429,429,428,427,426,426,425,424,423,423,422,421,
    					420,420,419,418,418,417,416,415,415,414,413,412,412,411,410,410,
    					409,408,407,407,406,405,404,404,403,402,401,401,400,399,399,398,
    					397,396,396,395,394,393,393,392,391,390,390,389,388,388,387,386,
    					385,385,384,383,382,382,381,380,380,379,378,377,377,376,375,374,
    					374,373,372,371,371,370,369,369,368,367,366,366,365,364,363,363,
    					362,361,361,360,359,358,358,357,356,355,355,354,353,352,352,351,
    					350,350,349,348,347,347,346,345,344,344,343,342,341,340,339,339,
    					338,337,336,336,335,334,333,333,332,331,331,330,329,328,328,327,
    					326,325,325,324,323,322,322,321,320,320,319,318,317,317,316,315,
    					314,314,313,312,312,311,310,309,309,308,307,306,306,305,304,303,
    					303,302,301,301,300,299,298,298,297,296,295,295,294,293,292,292,
    					291,290,290,289,288,287,287,286,285,284,284,283,282,282,281,280,
    					279,279,278,277,276,276,275,274,273,273,272,271,271,270,269,268,
    					268,267,266,265,265,264,263,263,262,261,260,260,259,258,257,257,
    					256,255,254,254,253,252,252,251,250,249,249,248,247,246,246,245,
    					244,244,243,242,241,241,240,239,238,238,237,236,235,235,234,233,
    					233,232,231,230,230,229,228,227,227,226,225,224,224,223,222,222,
    					221,220,219,219,218,217,216,216,215,214,214,213,212,211,211,210,
    					209,208,208,207,206,205,205,204,203,203,202,201,200,200,199,198,
    					197,197,196,195,195,194,193,192,192,191,190,189,189,188,187,186,
    					186,185,184,184,183,182,181,181,180,179,178,178,177,176,176,175,
    					174,173,173,172,171,170,170,169,168,167,167,166,165,165,164,163,
    					162,162,161,160,159,159,158,157,156,156,155,154,154,153,152,151,
    					151,150,149,148,148,147,146,146,145,144,143,143,142,141,140,140,
    					139,138,137,137,136,135,135,134,133,132,132,131,130,129,129,128,
    					127,127,126,125,124,124,123,122,121,121,120,119,118,118,117,116,
    					116,115,114,113,113,112,111,110,110,109,108,107,107,106,105,105,
    					104,103,102,102,101,100,
    					99,99,98,97,97,96,95,94,94,93,92,91,91,90,89,88,88,87,86,86,85,
    					84,83,83,82,81,80,80,79,78,78,77,76,75,75,74,73,72,72,71,70,69,
    					69,68,67,67,66,65,64,64,63,62,61,61,60,59,58,58,57,56,56,55,54,
    					53,53,52,51,50,50,49,48,48,47,46,45,45,44,43,42,42,41,40,39,39,
    					38,37,37,36,35,34,34,33,32,31,31,30,29,29,28,27,26,26,25,24,23,
    					23,22,21,20,20,19,18,18,17,16},
    i;
    					
    TCHAR bufw[3], bufh[3];
    
    VOID RemplieFenetrePrincipale(HWND fenetrePrincipale)
    {	
    	UINT bool_3;
            // On le remplit avec un premier push button tout bête		
    		hControle=CreateWindow(
                "BUTTON",
                "Stock please",
                WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
                10+260,10+4,
                90,20,
                fenetrePrincipale,
                (HMENU)ID_PUSHBUTTON_1,
                instance,
                NULL);
    			
    		hControle=CreateWindow(
                "BUTTON",
                "ENTER",
                WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
                10+168,10+119,
                50,20,
                fenetrePrincipale,
                (HMENU)ID_PUSHBUTTON_2,
                instance,
                NULL);
    			
            // un second avec quelques flags : plat et plusieurs lignes
            hControle=CreateWindow(
                "BUTTON",
                "See you later",
                WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_FLAT|BS_MULTILINE,
                10,10+217,
                100,20,
                fenetrePrincipale,
                (HMENU)ID_PUSHBUTTON_3,
                instance,
                NULL);        	    
            
            // une check box automatique deux états
            hControle=CreateWindow(
                "BUTTON",
                "Resolution Mod 16",
                WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX|BS_FLAT,
                10+230,10+218,
                140,20,
                fenetrePrincipale,
                (HMENU)ID_CHECKBOX,
                instance,
                NULL);
    			
    		CheckDlgButton(      
    		fenetrePrincipale,
    		ID_CHECKBOX,
    		BST_CHECKED);
        
        // troisième groupe : les radio button
        hGroup=CreateWindow(
            "BUTTON",
            "Select FPS or enter one",
            WS_CHILD|WS_VISIBLE|BS_GROUPBOX,
            10,10+40,
            225,110,
            fenetrePrincipale,
            NULL,
            instance,
            NULL);
        {
            HWND hControle;
            // trois radio button
            hControle=CreateWindow(
                "BUTTON",
                "25 FPS (PAL)",
                WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|WS_GROUP|BS_FLAT,
                10+10,10+60,
                150,20,
                fenetrePrincipale,
                (HMENU)ID_RADIOBUTTON_11,
                instance,
                NULL);		
    
            hControle=CreateWindow(
                "BUTTON",
                "23.97 FPS (NTSC)",
                WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|BS_FLAT,
                10+10,10+90,
                150,20,
                fenetrePrincipale,
                (HMENU)ID_RADIOBUTTON_12,
                instance,
                NULL);
    
            hControle=CreateWindow(
                "BUTTON",
                "Other",
                WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|BS_FLAT,
                10+10,10+120,
                60,20,
                fenetrePrincipale,
                (HMENU)ID_RADIOBUTTON_13,
                instance,
                NULL);
    			
    	CheckDlgButton(      
    	fenetrePrincipale,
    	ID_RADIOBUTTON_11,
    	BST_CHECKED);
    	bool_3=IsDlgButtonChecked(fenetrePrincipale, ID_RADIOBUTTON_11);
    	if (bool_3 == 1)
    		fps=25;
        }
    	
    	hCtl=CreateWindow(
            "STATIC",
            "Enter average bitrate (kbits/s) :",
            WS_CHILD|WS_VISIBLE|SS_CENTER|SS_NOTIFY,
            10,10+5,
            200,20,
            fenetrePrincipale,
            (HMENU)ID_STATIC_1,
            instance,
            NULL);
    	
    	hCtl=CreateWindow(
            "STATIC",
            "+ click",
            WS_CHILD|WS_VISIBLE|SS_CENTER|SS_NOTIFY,
            10+118,10+121,
            50,20,
            fenetrePrincipale,
            (HMENU)ID_STATIC_2,
            instance,
            NULL);
    		
    	hCtl=CreateWindow(
            "STATIC",
            "BPF nearest 0.3 for Xvid",
            WS_CHILD|WS_VISIBLE|SS_CENTER|SS_NOTIFY,
            10,10+170,
            160,20,
            fenetrePrincipale,
            (HMENU)ID_STATIC_3,
            instance,
            NULL);
    		
    	hCtl=CreateWindow(
            "STATIC",
            "BPF is :",
            WS_CHILD|WS_VISIBLE|SS_CENTER|SS_NOTIFY,
            10+120,10+199,
            60,20,
            fenetrePrincipale,
            (HMENU)ID_STATIC_4,
            instance,
            NULL);	
    		
    	hEdit=CreateWindow( "EDIT",
                            "",
                             WS_VISIBLE|WS_CHILD|WS_BORDER|ES_CENTER|ES_NUMBER ,
                             10+205,10+3,50,20,fenetrePrincipale,(HMENU)ID_EDITBOX_1,instance,NULL);
    	
    	hEdit=CreateWindow( "EDIT",
                            "",
                             WS_VISIBLE|WS_CHILD|WS_BORDER|ES_CENTER ,
                             10+70,10+119,50,20,fenetrePrincipale,(HMENU)ID_EDITBOX_2,instance,NULL);
    	
    	width=720;	
    	_stprintf(bufw, TEXT("%d"), width);
    	hEdit=CreateWindow( "EDIT",
                            bufw,
                            WS_VISIBLE|WS_CHILD|WS_BORDER|ES_CENTER|ES_READONLY ,
                             10+248,10+172,40,20,fenetrePrincipale,(HMENU)ID_EDITBOX_3,instance,NULL);
    	
    	i=0;
    	height=tableau1_mod16[i];	
    	_stprintf(bufh, TEXT("%d"), height);
    	hEdit=CreateWindow( "EDIT",
                            bufh,
                            WS_VISIBLE|WS_CHILD|WS_BORDER|ES_CENTER|ES_READONLY ,
                             10+313,10+172,40,20,fenetrePrincipale,(HMENU)ID_EDITBOX_4,instance,NULL);
    						 
    	hEdit=CreateWindow( "EDIT",
                            "",
                            WS_VISIBLE|WS_CHILD|WS_BORDER|ES_CENTER|ES_READONLY ,
                             10+180,10+197,40,20,fenetrePrincipale,(HMENU)ID_EDITBOX_5,instance,NULL);
    		
    	hGroup=CreateWindow(
            "BUTTON",
            "Select input PAR",
            WS_CHILD|WS_VISIBLE|BS_GROUPBOX,
            10+249,10+40,
            125,110,
            fenetrePrincipale,
            NULL,
            instance,
            NULL);
        {
            HWND hControle;
            // trois radio button
            hControle=CreateWindow(
                "BUTTON",
                "16:9",
                WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|WS_GROUP|BS_FLAT,
                10+259,10+60,
                50,20,
                fenetrePrincipale,
                (HMENU)ID_RADIOBUTTON_21,
                instance,
                NULL);
    
            hControle=CreateWindow(
                "BUTTON",
                "4:3",
                WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON|BS_FLAT,
                10+259,10+90,
                50,20,
                fenetrePrincipale,
                (HMENU)ID_RADIOBUTTON_22,
                instance,
                NULL);
    			
    	CheckDlgButton(      
    	fenetrePrincipale,
    	ID_RADIOBUTTON_21,
    	BST_CHECKED);
    	}	
    			
    	hupdown=CreateWindowEx(      
        0,
        UPDOWN_CLASS,
        NULL,
        WS_CHILD|WS_VISIBLE,
        10+290,
        10+163,
        40,
        40,
        fenetrePrincipale,
        (HMENU)ID_UPDOWN,
        instance,
        NULL);	
    }
    
    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="décochée";
            iProchainEtat=BST_UNCHECKED;		
        }    
        else if (lRes==BST_UNCHECKED)
        {		
            lpProchainEtat="cochée";
            iProchainEtat=BST_CHECKED;	
        }    
            SendMessage(hCtl,BM_SETCHECK,(WPARAM)iProchainEtat,0);
    }
    
    VOID calculaffichresbpf(HWND fenetrePrincipale)
    {	
    	TCHAR bpfstr[5];
    	double bpf;
    	
    	bpf=(bitrate*1000)/(width*height*fps);
    	sprintf(bpfstr, "%.3f", bpf);
    	SetDlgItemText(fenetrePrincipale, ID_EDITBOX_5, bpfstr);
    }
    
    VOID NotificationControle(HWND fenetrePrincipale,UINT message, WPARAM wParam, LPARAM lParam)
    {    
        UINT iId=LOWORD(wParam), freefps, mon_booleen;
        HWND hCtl=(HWND)lParam;
    	CHAR lpMessage[128];
    	TCHAR buf[7], buflpnmud[3];	
    	
        switch(iId)
        {	
            case ID_PUSHBUTTON_1:		    
    		    bitrate=GetDlgItemInt(fenetrePrincipale, ID_EDITBOX_1, NULL, FALSE);
    			calculaffichresbpf(fenetrePrincipale);
    		    break;
    			
    		case ID_PUSHBUTTON_2:
    			mon_booleen=IsDlgButtonChecked(fenetrePrincipale, ID_RADIOBUTTON_13);
    		    if (mon_booleen == 1)
    			{			
                freefps=GetDlgItemText(fenetrePrincipale, ID_EDITBOX_2, buf, 7);
    			fps=strtod(buf, NULL);			
    			}
    			calculaffichresbpf(fenetrePrincipale);
                break;		
    		
            case ID_PUSHBUTTON_3:
                DestroyWindow(fenetrePrincipale);
                break;
    			
    		case ID_RADIOBUTTON_11:		    						
    		    fps=25;
    			calculaffichresbpf(fenetrePrincipale);
    		    break;
    			
    		case ID_RADIOBUTTON_12:		    			
    		    fps=23.9765;
    			calculaffichresbpf(fenetrePrincipale);
    		    break;
    			
    		case ID_RADIOBUTTON_21:
    			width = 720;
    			sprintf(bufw, "%d", width);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_3, bufw);
    			i=0;
    			bool_2=IsDlgButtonChecked(fenetrePrincipale, ID_CHECKBOX);			
    			if (bool_2 == 1)			
    				height=tableau1_mod16[i];
    			else
    				height=tableau2_mod1[i];			
    			sprintf(bufh, "%d", height);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_4, bufh);
    			calculaffichresbpf(fenetrePrincipale);
    			break;
    			
    		case ID_RADIOBUTTON_22:
    			width = 720;
    			sprintf(bufw, "%d", width);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_3, bufw);
    			i=0;
    			bool_2=IsDlgButtonChecked(fenetrePrincipale, ID_CHECKBOX);				
    			if (bool_2 == 1)
    				height=tableau3_mod16[i];
    			else
    				height=tableau4_mod1[i];				
    			sprintf(bufh, "%d", height);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_4, bufh);
    			calculaffichresbpf(fenetrePrincipale);
    			break;
    			
    		case ID_CHECKBOX:
    			width = 720;
    			sprintf(bufw, "%d", width);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_3, bufw);
    			i=0;
    			bool_2=IsDlgButtonChecked(fenetrePrincipale, ID_CHECKBOX);
    			bool_4=IsDlgButtonChecked(fenetrePrincipale, ID_RADIOBUTTON_21);			
    			if (bool_4 == 1) // 16:9 
    				{
    				if (bool_2 == 1) // 16:9 mod 16			
    					height=tableau1_mod16[i];
    				else // 16:9 mod 1
    					height=tableau2_mod1[i];
    				}
    			else // 4:3
    				{
    				if (bool_2 == 1) // 4:3 mod 16
    					height=tableau3_mod16[i];
    				else // 4:3 mod 1
    					height=tableau4_mod1[i];
    				}
    			sprintf(bufh, "%d", height);
    			SetDlgItemText(fenetrePrincipale, ID_EDITBOX_4, bufh);
    			calculaffichresbpf(fenetrePrincipale);
    			break;		
        }	
    }
    
    LRESULT CALLBACK procedureFenetrePrincipale(HWND fenetrePrincipale, UINT message, WPARAM wParam, LPARAM lParam)
    {
        static HWND boutons[2] = {NULL};		
    	CHAR lpMessage[128];
    	NMHDR *pnmhdr=(LPNMHDR)lParam;	
    	
        switch (message)
        {
            case WM_CREATE:
                RemplieFenetrePrincipale(fenetrePrincipale);			
                return 0;
            case WM_COMMAND:
                NotificationControle(fenetrePrincipale,message,wParam,lParam);			
    			return 0;
    		case WM_NOTIFY:			
    			if ((pnmhdr->hwndFrom)==hupdown)
    				{
    				if(pnmhdr->code==UDN_DELTAPOS)
    					{
    					NM_UPDOWN *pnmupdown=(LPNMUPDOWN)lParam;
    					if(pnmupdown->iDelta<0)
    						{						
    						bool_2=IsDlgButtonChecked(fenetrePrincipale, ID_CHECKBOX);
    						bool_4=IsDlgButtonChecked(fenetrePrincipale, ID_RADIOBUTTON_21);			
    						if (bool_4 == 1) // 16:9
    							{
    							if (bool_2 == 1) // 16:9 mod 16
    								{
    								if (width<720 && i>0)
    									{
    									width = width + 16;
    									i=i-1;
    									height=tableau1_mod16[i];
    									}
    								}				
    							else // 16:9 mod 1
    								{
    								if (width<720 && i>0)
    									{
    									width = width + 1;
    									i=i-1;
    									height=tableau2_mod1[i];
    									}
    								}
    							}
    						else // 4:3
    							{
    							if (bool_2 == 1) // 4:3 mod 16
    								{
    								if (width<720 && i>0)
    									{
    									width = width + 16;
    									i=i-1;
    									height=tableau3_mod16[i];
    									}
    								}				
    							else // 4:3 mod 1
    								{
    								if (width<720 && i>0)
    									{
    									width = width + 1;
    									i=i-1;
    									height=tableau4_mod1[i];
    									}
    								}
    							}
    						}					
    					else if(pnmupdown->iDelta>0)					
    						{						
    						bool_2=IsDlgButtonChecked(fenetrePrincipale, ID_CHECKBOX);			
    						bool_4=IsDlgButtonChecked(fenetrePrincipale, ID_RADIOBUTTON_21);			
    						if (bool_4 == 1) // 16:9
    							{
    							if (bool_2 == 1) // 16:9 mod 16
    								{
    								if (width>16 && i<44)
    									{
    									width = width - 16;
    									i=i+1;
    									height=tableau1_mod16[i];
    									}
    								}				
    							else // 16:9 mod 1
    								{
    								if (width>16 && i<691)
    									{
    									width = width - 1;
    									i=i+1;
    									height=tableau2_mod1[i];
    									}
    								}
    							}
    						else // 4:3
    							{
    							if (bool_2 == 1) // 4:3 mod 16
    								{
    								if (width>16 && i<44)
    									{
    									width = width - 16;
    									i=i+1;
    									height=tableau3_mod16[i];
    									}
    								}				
    							else // 4:3 mod 1
    								{
    								if (width>16 && i<696)
    									{
    									width = width - 1;
    									i=i+1;
    									height=tableau4_mod1[i];
    									}
    								}
    							}					
    						}					
    					}
    				}
    			calculaffichresbpf(fenetrePrincipale);
    			sprintf(bufw, "%d", width);
    			SendDlgItemMessage(fenetrePrincipale,ID_EDITBOX_3,WM_SETTEXT,0,(LPARAM)bufw);
    			sprintf(bufh, "%d", height);
    			SendDlgItemMessage(fenetrePrincipale,ID_EDITBOX_4,WM_SETTEXT,0,(LPARAM)bufh);
    			return 0;		
    		
            case WM_DESTROY:
                PostQuitMessage(0);
                return 0;
    	    default:
                return DefWindowProc(fenetrePrincipale,message,wParam,lParam);
        }
    }
    
    
    int WINAPI WinMain (HINSTANCE cetteInstance, HINSTANCE precedenteInstance,
                 LPSTR lignesDeCommande, int modeDAffichage)
    {
        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",
            "Boombaka calcula",
            WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX,
            CW_USEDEFAULT,CW_USEDEFAULT,
            400,300,
            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;
    }
    merci énormément pour votre aide, merci à vous Médinoc et aussi aux autre pour toutes vos idées.
    vraiment je suis content.

  3. #3
    Invité
    Invité(e)
    Par défaut
    bonjour,

    le programme semble fonctionner sur tous les windows : de windows 95 au dernier
    chose curieuse : pour win xp media center il faut activer le mode compatibilité windows 95 pour voir apparaître le contrôle updown
    Dernière modification par Invité ; 27/11/2009 à 11h02.

  4. #4
    Invité
    Invité(e)
    Par défaut
    bonjour

    je souhaite déduire le height (la hauteur) de la vidéo à partir du width et de l'aspect ratio (=AR)
    la formule est simple : height = width/AR

    le problème : le résultat donne bien évidemment un float... que je voudrais arrondir en entier

    comment faire ?

  5. #5
    Expert confirmé
    Avatar de Melem
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2006
    Messages
    3 656
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Janvier 2006
    Messages : 3 656
    Par défaut
    En castant une valeur réelle en entier, on obtient la partie entière du réel. Par exemple : int n = 4.9; place 4 dans n. Tu peux expliciter le cast si tu veux éviter les warnings : int n = (int)4.9;

    Avec :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    int height = (width / AR) + 0.5;
    Tu es donc sûr d'avoir dans height la valeur entière la plus proche de (width / AR).

  6. #6
    Invité
    Invité(e)
    Par défaut
    bonsoir,
    j'ai essayé avec le cint qui arrondi direct, mais ça ne fonctionne pas : quand je compile il met 'non-référencé'

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

Discussions similaires

  1. Quels sont les difficultés pour calculer le ROI dans un projet BI?
    Par dessinateurttuyen dans le forum Emploi
    Réponses: 2
    Dernier message: 17/07/2007, 17h18
  2. [Projet] gestion calcul + affichage
    Par poukill dans le forum C++
    Réponses: 10
    Dernier message: 11/05/2007, 01h54
  3. Calculer la volumétrie d'un projet ?
    Par n!co dans le forum Qualimétrie
    Réponses: 2
    Dernier message: 10/03/2007, 17h52
  4. Réponses: 1
    Dernier message: 11/12/2006, 13h45
  5. [MySQL] Fonctions calculs SQL/PHP pour projet football
    Par spamyx dans le forum PHP & Base de données
    Réponses: 4
    Dernier message: 25/04/2006, 17h16

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