Unsolved Winapi application doesnt work help
-
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
-
This post is deleted! -
Hi,
Why all these
ifdefs
? Just create yourmain
method as usual in any Qt application. -
because i did the client like this way:
#include <QApplication>
#include <QTranslator>
#include "mainwindow.h"
#ifndef Q_WS_X11
#include <QtPlugin>
#endifint 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.
-
Why do you do that in your server ?
-
Sorry to ask but why do you use WINAPI at all? what library are you using for xmpp?
-
i am using qxmpp library this: https://github.com/qxmpp-project/qxmpp
-
i solved with #include <Windows.h> this library
-
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.