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

Qt Discussion :

Handle & QT


Sujet :

Qt

  1. #1
    Membre confirmé
    Homme Profil pro
    Etudiant administrateur systèmes et réseaux
    Inscrit en
    Octobre 2007
    Messages
    731
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Etudiant administrateur systèmes et réseaux

    Informations forums :
    Inscription : Octobre 2007
    Messages : 731
    Points : 467
    Points
    467
    Par défaut Handle & QT
    Bonjour,

    J'ai un soucis avec QT et les handles, la fonction FindWindows ne marche pas, il y a un problème de convertion.

    Il me dit exactement : cannot convert "const char*" to "const WCHAR*" pour l'argument de la fonction FindWindows.

    En même temps je n'ai qu'à pas utiliser des fonctions de l'api32 dans QT mais je ne sais pas faire autrement pour faire de la simulation de touches ciblées & je ne connais pas d'équivalent pour postmessage et FindWindows dans QT.

    Y'a t-il un moyen de palier ce problème ?

    Merci d'avance

    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
    // BIBLIOTHEQUES ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    #include <QtGui>
    #include <windows.h>
    #include "AUTOLOG.h"
     
    // CONSTANTES //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
     
     
    // PROTOTYPES //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void InitDisplay( QPushButton *Start, QPushButton *Stop, QPushButton *Download, QLabel *PrintAuthor, QLabel *PrintVersion, QLabel *PrintTitle, QLabel *PrintID, QLabel *PrintPW, QLabel *PrintRepeat, QLabel *PrintTimer, QString QID, QString QPW, QString QRepeat, QString QTimer, int X, int Y);
    void Write(char *Flux, int Size);
    void ENTER( HWND TargetedHandle);
    void WAIT();
    void TAB();
     
     
     
    // CLASSE FENETRE //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    MaFenetre::MaFenetre() : QWidget()
    {
     
        /* On fixe définitivement la taille de la fenêtre */
        int X=300;
        int Y=150;
        setFixedSize(X, Y);
     
        char ID[999], PW[999], Repeat[999], Timer [999];
     
     
        /* On récupère ces informations dans le .ini */
        GetPrivateProfileStringA("Settings",     "ID", "", ID    , 999, ".//autorun.ini");
        GetPrivateProfileStringA("Settings",     "PW", "", PW    , 999, ".//autorun.ini");
        GetPrivateProfileStringA("Settings", "REPEAT", "", Repeat, 999, ".//autorun.ini");
        GetPrivateProfileStringA("Settings",  "TIMER", "", Timer , 999, ".//autorun.ini");
     
        /* Convertion en QString des ID & PW */
        QString QID     = QString(ID);
        QString QPW     = QString(PW);
        QString QRepeat = QString(Repeat);
        QString QTimer  = QString(Timer);
     
    	/* Création des objets */
    	PrintTitle      = new QLabel     (         this);
        PrintID         = new QLabel     (         this);
        PrintPW         = new QLabel     (         this);
        PrintRepeat     = new QLabel     (         this);
        PrintTimer      = new QLabel     (         this);
        PrintAuthor     = new QLabel     (         this);
        PrintVersion    = new QLabel     (         this);
        Start           = new QPushButton("Start"   , this);
        Stop            = new QPushButton("Quitter" , this);
        Download        = new QPushButton("Download", this);
        Picture         = new QPixmap    ("image.jpg"  );
        Frame           = new QLabel     (this         );
     
            /* Initialisation de l'affichage */
        InitDisplay( Start, Stop, Download, PrintAuthor, PrintVersion, PrintTitle, PrintID, PrintPW, PrintRepeat, PrintTimer, QID, QPW, QRepeat, QTimer, X, Y);
        Frame -> setPixmap( *Picture );
     
        /* Signaux */
    	QObject::connect(Start    , SIGNAL(clicked()) , this, SLOT( LogProcedure() ));
    	QObject::connect(Stop     , SIGNAL(clicked()) , qApp, SLOT( quit() ));
    	QObject::connect(Download , SIGNAL(clicked()) , this, SLOT( DownloadProcedure() ));
    }
     
     
    // FONCTIONS ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    void InitDisplay( QPushButton *Start, QPushButton *Stop, QPushButton *Download, QLabel *PrintAuthor, QLabel *PrintVersion, QLabel *PrintTitle, QLabel *PrintID, QLabel *PrintPW, QLabel *PrintRepeat, QLabel *PrintTimer, QString QID, QString QPW, QString QRepeat, QString QTimer, int X, int Y)
    {
     
        int ButtonWidth         = 60;
        int ButtonHeight        = 20;
        int Space               = 20;
        int xStart              = (X-(3*ButtonWidth+2*Space))/2;
        int xDownload           = xStart     + ButtonWidth + Space;
        int xStop               = xDownload  + ButtonWidth + Space; 
        int yButton             = 0.85*Y;
     
        PrintTitle   -> setText("<strong><font color=\"red\">-------------AUTO LOGGER-------------</font></strong>"             );
        PrintID      -> setText("<strong><small>ID</small></strong> : " + QID             );
        PrintPW      -> setText("<strong><small>PW</small></strong> : " + QPW             );
        PrintRepeat  -> setText("<strong><small>REPEAT</small></strong> : " + QRepeat     );
        PrintTimer   -> setText("<strong><small>TIMER</small></strong> : " + QTimer +" ms");
        PrintAuthor  -> setText("<small>® DARKWALL_37</small>");
        PrintVersion -> setText("<small>V1.04</small>");
        PrintTitle   -> move( (X - PrintTitle    -> minimumSizeHint().width())/2, 0.175*Y );
        PrintID      -> move( (X - PrintID       -> minimumSizeHint().width())/2, 0.30*Y );
        PrintPW      -> move( (X - PrintPW       -> minimumSizeHint().width())/2, 0.40*Y );
        PrintRepeat  -> move( (X - PrintRepeat   -> minimumSizeHint().width())/2, 0.50*Y );
        PrintTimer   -> move( (X - PrintTimer    -> minimumSizeHint().width())/2, 0.60*Y );
        PrintAuthor  -> move( 0.01*X, 0.01*Y );
        PrintVersion -> move( X - (PrintVersion -> minimumSizeHint().width() + 0.01*X), 0.01*Y );
        Start        -> setGeometry( xStart   , yButton , ButtonWidth,  ButtonHeight ); 
        Stop         -> setGeometry( xStop    , yButton , ButtonWidth,  ButtonHeight );
        Download     -> setGeometry( xDownload, yButton , ButtonWidth,  ButtonHeight );  
    }
     
     
    void MaFenetre::DownloadProcedure()
    {
         system("start iexplore http://www.megaupload.com/?f=BMBSOTON | start iexplore http://www.sro-lottery.com ");
    }
     
    void MaFenetre::LogProcedure()
    {
     
        char ID[999], PW[999], Repeat[999]; 
     
        GetPrivateProfileStringA("Settings",     "ID", "", ID    , 999, ".//autorun.ini");
        GetPrivateProfileStringA("Settings",     "PW", "", PW    , 999, ".//autorun.ini");
        GetPrivateProfileStringA("Settings", "REPEAT", "", Repeat, 999, ".//autorun.ini");
     
        /* Taille de ID & PW */
        int IDSize=strlen(ID);
        int PWSize=strlen(PW);
     
        WAIT();
     
        HWND Handle = FindWindow("Notepad",NULL);
     
        Write(ID, IDSize);
        TAB();
        Write(PW, PWSize);
     
        int LoopNumbers = atoi(Repeat);
        int control     = 0           ;
     
        if (Handle)
           { 
                   while ( control != LoopNumbers )
                         {
     
                               ENTER(Handle);
                               control++;      
                         }
           }    
    }
     
     
    void Write(char *Flux, int Size)
    {
     
     
                           int i=0;          
                           for ( i=0 ; i<Size ; i++ )        
                               {               
                                       char CurrentLetter = Flux[i];                                                                                                                        
     
                                      // Chiffre
     
                                            if ( '0' == CurrentLetter )
                                               {
                                                   keybd_event(0x60,0,0,0);
                                                   _sleep(40);
                                               }
     
                                       else if ( '1' == CurrentLetter )
                                               {
                                                   keybd_event(0x61,0,0,0);
                                                   _sleep(40);
                                               }
     
                                       else if ( '2' == CurrentLetter )
                                               {
                                                   keybd_event(0x62,0,0,0);
                                                   _sleep(40);
                                               }
     
                                       else if ( '3' == CurrentLetter )
                                               {
                                                   keybd_event(0x63,0,0,0);
                                                   _sleep(40);
                                               }                                   
     
                                       else if ( '4' == CurrentLetter )
                                               {
                                                   keybd_event(0x64,0,0,0);
                                                   _sleep(40);
                                               }
     
                                       else if ( '5' == CurrentLetter )
                                               {
                                                   keybd_event(0x65,0,0,0);
                                                   _sleep(40);
                                               }
     
                                       else if ( '6' == CurrentLetter )
                                               {
                                                   keybd_event(0x66,0,0,0);
                                                   _sleep(40);
                                               }
     
                                       else if ( '7' == CurrentLetter )
                                               {
                                                   keybd_event(0x67,0,0,0);
                                                   _sleep(40);
                                               }                                  
     
                                       else if ( '8' == CurrentLetter)
                                               {
                                                   keybd_event(0x68,0,0,0);
                                                   _sleep(40);
                                               }
     
                                       else if ( '9' == CurrentLetter )
                                               {
                                                   keybd_event(0x69,0,0,0);
                                                   _sleep(40);
                                               }
     
     
                                       // Caractères spéciaux
     
                                       else if ( '@' == CurrentLetter )
                                               {
                                                   keybd_event(VK_MENU,0,0,0);
                                                   keybd_event(VK_CONTROL,0,0,0);
                                                   keybd_event(0x30,0,0,0);
                                                   keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);
                                                   keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP,0);
                                                   keybd_event(0x30,0,KEYEVENTF_KEYUP,0);
                                                   _sleep(50);
     
                                               }
     
                                       else if ( '.' == CurrentLetter )
                                               {
     
                                                   keybd_event(VK_SHIFT,0,0,0);
                                                   keybd_event(0xBE,0,0,0);
                                                   keybd_event(VK_SHIFT,0,KEYEVENTF_KEYUP,0);
                                                   keybd_event(0xBE,0,KEYEVENTF_KEYUP,0);
                                                   _sleep(40);
                                               }
     
                                     // Caractères usels
     
                                       else    {
                                                  keybd_event(VkKeyScan(Flux[i]),0,0,0);
                                                  _sleep(40);
                                               }
                                     }
     
    }
     
     
    void WAIT()
    {
         _sleep(5000);
    }
     
     
    void TAB()
    {
         keybd_event(VK_TAB,0,0,0); 
         _sleep(500);
         keybd_event(VK_TAB,0,KEYEVENTF_KEYUP,0);                           
         _sleep(500);       
    }
     
    void ENTER(HWND TargetedHandle)
    {
        SendMessage(TargetedHandle,WM_CHAR,VK_RETURN,0);
        _sleep(500);                            
    }
    UNE REPONSE UTILE : &|| UN PROBLEME RESOLU :

  2. #2
    Rédacteur

    Inscrit en
    Novembre 2006
    Messages
    1 272
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 272
    Points : 1 672
    Points
    1 672
    Par défaut
    Utilise FindWindowA(). Tu as juste un problème de conversion de jeux de caractere.
    Vous voulez participer aux Tutoriels, FAQ ou Traductions et faire partie de l'équipe Qt de Developpez.
    N'hésitez pas à me contacter par MP.

  3. #3
    Membre confirmé
    Homme Profil pro
    Etudiant administrateur systèmes et réseaux
    Inscrit en
    Octobre 2007
    Messages
    731
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Etudiant administrateur systèmes et réseaux

    Informations forums :
    Inscription : Octobre 2007
    Messages : 731
    Points : 467
    Points
    467
    Par défaut
    Merci, ce problème est réglé mais il sort une autre erreur

    In fonction winmain : qtmain_win.cpp line 136 : undifined reference to qmain( int , char** )

    L'erreur n'est pas directement dans mon fichier alors je ne vois pas comment régler ce problème.

    Merci pour la réponse ultra rapide.
    UNE REPONSE UTILE : &|| UN PROBLEME RESOLU :

  4. #4
    Rédacteur

    Inscrit en
    Novembre 2006
    Messages
    1 272
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 272
    Points : 1 672
    Points
    1 672
    Par défaut
    Tu as crée quoi comme type de projet dans Visual Studio ?
    Vous voulez participer aux Tutoriels, FAQ ou Traductions et faire partie de l'équipe Qt de Developpez.
    N'hésitez pas à me contacter par MP.

  5. #5
    Membre confirmé
    Homme Profil pro
    Etudiant administrateur systèmes et réseaux
    Inscrit en
    Octobre 2007
    Messages
    731
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Etudiant administrateur systèmes et réseaux

    Informations forums :
    Inscription : Octobre 2007
    Messages : 731
    Points : 467
    Points
    467
    Par défaut
    Non je code avec dev c++.
    UNE REPONSE UTILE : &|| UN PROBLEME RESOLU :

  6. #6
    Rédacteur

    Inscrit en
    Novembre 2006
    Messages
    1 272
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 272
    Points : 1 672
    Points
    1 672
    Par défaut
    Je suis désolé mais je n'utilise pas Dev C++ et comme ça j'ai pas trop d'idée sur ton problème.
    Vous voulez participer aux Tutoriels, FAQ ou Traductions et faire partie de l'équipe Qt de Developpez.
    N'hésitez pas à me contacter par MP.

  7. #7
    Membre confirmé
    Homme Profil pro
    Etudiant administrateur systèmes et réseaux
    Inscrit en
    Octobre 2007
    Messages
    731
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Etudiant administrateur systèmes et réseaux

    Informations forums :
    Inscription : Octobre 2007
    Messages : 731
    Points : 467
    Points
    467
    Par défaut
    Moi non plus. Si jamais j'utilisais visual, y'a une solution ?
    UNE REPONSE UTILE : &|| UN PROBLEME RESOLU :

  8. #8
    Rédacteur

    Inscrit en
    Novembre 2006
    Messages
    1 272
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 272
    Points : 1 672
    Points
    1 672
    Par défaut
    Comme ça je sais pas trop. Je n'ai jamais eu ce type de problème avec VS et je connais pas trop mal cette IDE. Après peut être que ton problème n'a rien a voir avec la configuration du projet ce n'est qu'une supposition.
    Vous voulez participer aux Tutoriels, FAQ ou Traductions et faire partie de l'équipe Qt de Developpez.
    N'hésitez pas à me contacter par MP.

  9. #9
    Membre confirmé
    Homme Profil pro
    Etudiant administrateur systèmes et réseaux
    Inscrit en
    Octobre 2007
    Messages
    731
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Etudiant administrateur systèmes et réseaux

    Informations forums :
    Inscription : Octobre 2007
    Messages : 731
    Points : 467
    Points
    467
    Par défaut
    J'en ai marre d'avoir des erreurs de *****



    Si ça peut aider...
    UNE REPONSE UTILE : &|| UN PROBLEME RESOLU :

  10. #10
    Membre confirmé
    Homme Profil pro
    Etudiant administrateur systèmes et réseaux
    Inscrit en
    Octobre 2007
    Messages
    731
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Etudiant administrateur systèmes et réseaux

    Informations forums :
    Inscription : Octobre 2007
    Messages : 731
    Points : 467
    Points
    467
    Par défaut
    J'ai tout supp, j'ai refais qmake -project/qmake/make et ça à compilé...

    Merci
    UNE REPONSE UTILE : &|| UN PROBLEME RESOLU :

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

Discussions similaires

  1. Manipulation des handle contexte
    Par rockbiker dans le forum DirectX
    Réponses: 1
    Dernier message: 09/05/2003, 19h51
  2. Question sur les handles et les couleurs...
    Par MrDuChnok dans le forum C++Builder
    Réponses: 7
    Dernier message: 29/10/2002, 09h45
  3. pb de récup de handle à partir d'une dll
    Par yokito dans le forum Langage
    Réponses: 2
    Dernier message: 20/08/2002, 13h29
  4. pb de handle en C
    Par deedje dans le forum C
    Réponses: 3
    Dernier message: 21/06/2002, 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