11. december 2004 - 21:26Der er
8 kommentarer og 1 løsning
Problemmer med Only one instance
begin Application.Initialize; begin ProjectName := 'up2data.running'; // define the project-name mHandle := CreateMutex(nil, True, PChar(ProjectName)); if GetLastError = ERROR_ALREADY_EXISTS then begin showmessage('Application is already running.'); halt; // kill the second instance end; end; Application.CreateForm(TMainForm, MainForm); Application.CreateForm(TSplashForm, SplashForm); Application.CreateForm(Tup2dateForm, up2dateForm); Application.Run;
finalization if mHandle <> 0 then CloseHandle(mHandle); // free the mHandle
end.
Hvorfor siger den at den ikke kan finde en "end", hvor skal den end være ?
Prøv med: begin Application.Initialize; begin ProjectName := 'up2data.running'; // define the project-name mHandle := CreateMutex(nil, True, PChar(ProjectName)); if GetLastError = ERROR_ALREADY_EXISTS then begin showmessage('Application is already running.'); halt; // kill the second instance end; end; Application.CreateForm(TMainForm, MainForm); Application.CreateForm(TSplashForm, SplashForm); Application.CreateForm(Tup2dateForm, up2dateForm); Application.Run; end.
finalization if mHandle <> 0 then CloseHandle(mHandle); // free the mHandle
Du skal ikke være så nærtagen! Se'følig kan der ikke være kode efter end. Der skulle stå end;
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.