User forums > Using Code::Blocks

Wxsmith / wxwdget app is not starting

(1/1)

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)


--- 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;
}

--- End code ---

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/)

Navigation

[0] Message Index

Go to full version