/////////////////////////////////////////////////////////////////////////////
// CMyClassDlg Nachrichten-Handler
BOOL CMyClassDlg::OnInitDialog()
{
/////////////////////////////////////
/// START -> prevent double start of app
/////////////////////////////////////
char *p_appName = "KeinDoppelstart";
DWORD dwError;
// Kennung erstellen
CreateMutex(NULL, true, p_appName);
// Fehlermeldung prüfen
dwError = GetLastError();
if (ERROR_ALREADY_EXISTS == dwError)
{
// print message
MessageBox("An instance already running! Application will be terminated.", "Title", MB_ICONERROR);
// close application
OnOK();
}
/////////////////////////////////////
/// END -> prevent double start of app
/////////////////////////////////////
// start dialog
CDialog::OnInitDialog();
// Hinzufügen des Menübefehls "Info..." zum Systemmenü.
// IDM_ABOUTBOX muss sich im Bereich der Systembefehle befinden.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Symbol für dieses Dialogfeld festlegen. Wird automatisch erledigt
// wenn das Hauptfenster der Anwendung kein Dialogfeld ist
SetIcon(m_hIcon, TRUE); // Großes Symbol verwenden
SetIcon(m_hIcon, FALSE); // Kleines Symbol verwenden
// read content of ini file
ReadIniFile();
/************************************************/
/* create the network sockets */
/************************************************/
// set parents for sockets
TCPIPSocketConnect.SetParent( this );
TCPIPSocketListen.SetParent( this );
/////////////////////////////////////
// establish handle for hotkeys (shortcuts)
/////////////////////////////////////
m_hAccel = ::LoadAccelerators( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDR_ACCELERATOR ) );
return TRUE; // Geben Sie TRUE zurück, außer ein Steuerelement soll den Fokus erhalten
}