Multiple instances fix

This commit is contained in:
pagefault
2001-05-28 00:33:31 +00:00
parent 7e485903d5
commit 8f08627dc9
2 changed files with 15 additions and 13 deletions

View File

@@ -193,6 +193,7 @@ BOOL InputDeAcquire(void)
extern "C" {
unsigned char keyboardhit=0;
void initwinvideo();
void DosExit();
extern BYTE StereoSound;
extern DWORD SoundQuality;
extern BYTE ExclusiveSound;
@@ -200,6 +201,7 @@ extern BYTE HighPriority;
extern BYTE AlwaysOnTop;
extern BYTE SaveMainWindowPos;
extern BYTE AlternateTimer;
extern BYTE AllowMultipleInst;
extern signed short int MainWindowX;
extern signed short int MainWindowY;
extern int CurKeyPos;
@@ -462,6 +464,18 @@ LRESULT CALLBACK Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
int RegisterWinClass(void)
{
if (AllowMultipleInst == 0)
{
HWND hFindWindow;
hFindWindow = FindWindow("ZSNESWIN", NULL);
if (hFindWindow != NULL)
{
SetForegroundWindow(hFindWindow);
DosExit();
}
}
WNDCLASS wcl;
wcl.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW | CS_NOCLOSE ;

View File

@@ -38,7 +38,7 @@ extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable,
romtype, scanlines, showallext, smallscreenon, soundon,
spcon, vsyncon, DisplayS, fname, filefound, SnowOn,
NetChatFirst,NetServer,NetNewNick,
NetFilename,GUINetTextk2,NetQuitAfter,UDPConfig,AllowMultipleInst;
NetFilename,GUINetTextk2,NetQuitAfter,UDPConfig;
void ccmdline(void);
@@ -81,18 +81,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdSh
hInst=hInstance;
if (AllowMultipleInst == 0)
{
HWND hFindWindow;
hFindWindow = FindWindow("ZSNESWIN", NULL);
if (hFindWindow != NULL)
{
SetForegroundWindow(hFindWindow);
DosExit();
}
}
// Commandline: /ABCDE <nickname> <fname> <IP Addy>
// nickname = user nickname
// fname = filename w/ full path (if L) or path name (if C)