Author Topic: Wxsmith / wxwdget app is not starting  (Read 1888 times)

Offline jean-raphael

  • Single posting newcomer
  • *
  • Posts: 4
Wxsmith / wxwdget app is not starting
« on: March 24, 2022, 03:03:46 pm »
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)

Code
/***************************************************************
 * 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;
}

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Wxsmith / wxwdget app is not starting
« Reply #1 on: March 24, 2022, 03:46:37 pm »
  • The mutex is misplaced
  • You can use wxSingleInstanceChecker
  • This is not the place for programming questions, try the wxWidgets forum (https://forums.wxwidgets.org/)