Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Winapi application doesnt work help
Forum Updated to NodeBB v4.3 + New Features

Winapi application doesnt work help

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • RIVOPICOR Offline
    RIVOPICOR Offline
    RIVOPICO
    wrote on last edited by RIVOPICO
    #1

    Hi i am trying to do one application with xmpp but i have some questions about this code, doesnt work for me:

    #include <QApplication>
    #include "mainwindow.h"
    #ifndef Q_WS_X11
    #include <QtPlugin>
    #endif

    #ifdef _MSC_VER
    int WINAPI WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
    {
    int argc = 0;
    char *argv[1];
    #else
    int main(int argc, char *argv[])
    {
    #endif
    QApplication a(argc, argv);
    MainWindow w;
    return a.exec();
    }

    I am trying to do simple winapi application but not Works. thanks in advance any suggestion is good received

    1 Reply Last reply
    0
    • RIVOPICOR Offline
      RIVOPICOR Offline
      RIVOPICO
      wrote on last edited by RIVOPICO
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Why all these ifdefs ? Just create your main method as usual in any Qt application.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • RIVOPICOR Offline
          RIVOPICOR Offline
          RIVOPICO
          wrote on last edited by RIVOPICO
          #4

          because i did the client like this way:

          #include <QApplication>
          #include <QTranslator>
          #include "mainwindow.h"
          #ifndef Q_WS_X11
          #include <QtPlugin>
          #endif

          int main(int argc, char *argv[])
          {
          QApplication a(argc, argv);
          MainWindow w;
          QString locale = QLocale::system().name();
          QTranslator translator;
          translator.load(QString("cliente_") + locale);
          a.installTranslator(&translator);
          w.show();

          return a.exec();
          

          }

          And in server i use this code:
          #include <QApplication>
          #include "mainwindow.h"
          #ifndef Q_WS_X11
          #include <QtPlugin>
          #endif

          #ifdef _MSC_VER
          int WINAPI WinMain(HINSTANCE hInstance,
          HINSTANCE hPrevInstance,
          LPSTR lpCmdLine,
          int nCmdShow)
          {
          int argc = 0;
          char *argv[1];
          #else
          int main(int argc, char *argv[])
          {
          #endif
          QApplication a(argc, argv);
          MainWindow w;
          return a.exec();
          }

          It's only for that. The problem is only in the server.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Why do you do that in your server ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              Sorry to ask but why do you use WINAPI at all? what library are you using for xmpp?

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply
              0
              • RIVOPICOR Offline
                RIVOPICOR Offline
                RIVOPICO
                wrote on last edited by
                #7

                i am using qxmpp library this: https://github.com/qxmpp-project/qxmpp

                1 Reply Last reply
                0
                • RIVOPICOR Offline
                  RIVOPICOR Offline
                  RIVOPICO
                  wrote on last edited by
                  #8

                  i solved with #include <Windows.h> this library

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    You still haven't answered the main question: why are you using WinMain for your server ? That's not needed at all, Qt handles that for you.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved