From: Vincent M. <vin...@ne...> - 2001-10-15 15:12:57
|
Hello, I'm trying to create a dll for nt4.0 using wxwindows and cross-compiling. I've searched the archive and found some docs, but I can't solved the problem. I can't call any functions of the library wxwindows, I've reduced the code but a simple call like : iRet = wxMessageBox("Quit program?", "Confirm", wxYES_NO | wxCANCEL,NULL); hang my dll. Any hellp would be very apprecied. Here is the code #define DLLIMPORT __declspec (dllexport) #include "wx/wxprec.h" #include "wx/event.h" #include "wx/app.h" #include "wx/msw/private.h" #include <wx/wx.h> #include <wx/utils.h> #include <wx/image.h> class MyApp : public wxApp { public: virtual bool OnInit(); virtual bool Show(const wxString &); }; bool MyApp::OnInit() { wxFrame * frame = new wxFrame(NULL, -1, "A",wxPoint(150,50),wxSize(640,480)); frame->Show(TRUE); SetTopWindow(frame); return TRUE; } bool MyApp::Show(const wxString& text) { return TRUE; } wxApp* wxCreateApp() { return new MyApp; } MyApp& wxGetApp() { return *(MyApp *)wxTheApp; } wxAppInitializer wxTheAppInitializer( (wxAppInitializerFunction) wxCreateApp ); extern "C" int WINAPI DllEntryPoint(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) { wxWindow * topWindow; switch (fdwReason) { case DLL_PROCESS_ATTACH: wxhInstance = (HINSTANCE) hModule; wxApp::Initialize(); wxTheApp = (* wxApp::GetInitializerFunction()) (); wxTheApp->argc = 0; wxTheApp->argv = NULL; wxTheApp->OnInitGui(); wxTheApp->OnInit(); topWindow = wxTheApp->GetTopWindow(); break; case DLL_PROCESS_DETACH: default: break; } return TRUE; } DLLIMPORT int Fonction(char *parent, char *szUser, char *szDatjour) { int iRet = 0; wxBell(); // ok the system beep //If I comment the next code, I've no problem iRet = wxMessageBox("Quit program?", "Confirm", wxYES_NO | wxCANCEL,NULL);// this code hang the dll MessageBox(NULL, szUser,szDatjour,1); //ok I've a dailog box return iRet; } |