I got debug error when try to show simple widget subclass
inside dll
error
Debug Error
Debug Error
QWidget:Cannot create a QWidget when no GUI is being used
To copy to clipboard, switch view to plain text mode
How make GUI being used?
here simple test code.
void MyThread::run()
{
int notUse;
QString fileName
= qApp
->applicationDirPath
()+"/test.txt";
qDebug(fileName.toLocal8Bit());
//QFile file(fileName,coreApp);
//file.open(QIODevice::ReadWrite);
//file.write("Hello's world",sizeof("Hello's world"));
MyGui gui;
gui.show();
coreApp->exec();
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
MyThread *myThread = new MyThread;
myThread->start();
break;
}
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
QCoreApplication *coreApp ;
void MyThread::run()
{
int notUse;
coreApp = new QCoreApplication(notUse,0);
QString fileName = qApp->applicationDirPath()+"/test.txt";
qDebug(fileName.toLocal8Bit());
//QFile file(fileName,coreApp);
//file.open(QIODevice::ReadWrite);
//file.write("Hello's world",sizeof("Hello's world"));
MyGui gui;
gui.show();
coreApp->exec();
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
MyThread *myThread = new MyThread;
myThread->start();
break;
}
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
To copy to clipboard, switch view to plain text mode
Show gui at DLL_PROCESS_ATTACH
also got same debug message
Thank.
Bookmarks