News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Wxsmith / wxwdget app is not starting

Started by jean-raphael, March 24, 2022, 03:03:46 PM

Previous topic - Next topic

jean-raphael

i have add these line in the *App.cpp beacuse if i understand well this is the "main" equivalent (i have to force a single instance and start threads)

but since i have add these line the project is stucs, even if i delete my lines nothing start

whent a paus a debug session it say :

In ntdll!DbgBreakPoint () (C:\WINDOWS\SYSTEM32\ntdll.dll)

( i have put //my added lines were i made changes)

/***************************************************************
* Name:      SimNetServApp.cpp
* Purpose:   Code for Application Class
* Author:     ()
* Created:   2022-03-24
* Copyright:  ()
* License:
**************************************************************/

#include "SimNetServApp.h"
    //my added lines
#include <windows.h>

//(*AppHeaders
#include "SimNetServMain.h"
#include <wx/image.h>
//*)

IMPLEMENT_APP(SimNetServApp);

bool SimNetServApp::OnInit()
{
    //(*AppInitialize
    bool wxsOK = true;
    wxInitAllImageHandlers();
    if ( wxsOK )
    {
    SimNetServFrame* Frame = new SimNetServFrame(0);
    Frame->Show();
    SetTopWindow(Frame);
    }
    //*)
    //my added lines
    CreateMutexA(0, FALSE, "Local\\$TSimUdpServApp$");
    if(GetLastError() == ERROR_ALREADY_EXISTS){
        //" an other instance of SimServer is running ...";
        return false;
    }

    return wxsOK;
}


Miguel Gimenez


  • The mutex is misplaced
  • You can use wxSingleInstanceChecker
  • This is not the place for programming questions, try the wxWidgets forum (https://forums.wxwidgets.org/)