2010-06-04 06:25:07 +00:00
|
|
|
#include "stdafx.h"
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
int GetStoredWinPos( char * WinName, DWORD * X, DWORD * Y ) {
|
|
|
|
long lResult;
|
|
|
|
HKEY hKeyResults = 0;
|
|
|
|
char String[200];
|
|
|
|
|
2012-09-30 14:37:40 +00:00
|
|
|
sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",_Settings->LoadString(Setting_ApplicationName));
|
2008-09-18 03:15:49 +00:00
|
|
|
lResult = RegOpenKeyEx( HKEY_CURRENT_USER,String,0, KEY_ALL_ACCESS,&hKeyResults);
|
|
|
|
|
|
|
|
if (lResult == ERROR_SUCCESS) {
|
|
|
|
DWORD Type, Value, Bytes = 4;
|
|
|
|
|
|
|
|
sprintf(String,"%s Top",WinName);
|
|
|
|
lResult = RegQueryValueEx(hKeyResults,String,0,&Type,(LPBYTE)(&Value),&Bytes);
|
|
|
|
if (Type == REG_DWORD && lResult == ERROR_SUCCESS) {
|
|
|
|
*Y = Value;
|
|
|
|
} else {
|
|
|
|
RegCloseKey(hKeyResults);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(String,"%s Left",WinName);
|
|
|
|
lResult = RegQueryValueEx(hKeyResults,String,0,&Type,(LPBYTE)(&Value),&Bytes);
|
|
|
|
if (Type == REG_DWORD && lResult == ERROR_SUCCESS) {
|
|
|
|
*X = Value;
|
|
|
|
} else {
|
|
|
|
RegCloseKey(hKeyResults);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
RegCloseKey(hKeyResults);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void StoreCurrentWinPos ( char * WinName, HWND hWnd ) {
|
|
|
|
long lResult;
|
|
|
|
HKEY hKeyResults = 0;
|
|
|
|
DWORD Disposition = 0;
|
|
|
|
RECT WinRect;
|
|
|
|
char String[200];
|
|
|
|
|
|
|
|
GetWindowRect(hWnd, &WinRect );
|
2012-09-30 14:37:40 +00:00
|
|
|
sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",_Settings->LoadString(Setting_ApplicationName));
|
2008-09-18 03:15:49 +00:00
|
|
|
lResult = RegCreateKeyEx( HKEY_CURRENT_USER, String,0,"", REG_OPTION_NON_VOLATILE,
|
|
|
|
KEY_ALL_ACCESS,NULL, &hKeyResults,&Disposition);
|
|
|
|
if (lResult == ERROR_SUCCESS) {
|
|
|
|
sprintf(String,"%s Top",WinName);
|
|
|
|
RegSetValueEx(hKeyResults,String,0, REG_DWORD,(CONST BYTE *)(&WinRect.top),
|
|
|
|
sizeof(DWORD));
|
|
|
|
sprintf(String,"%s Left",WinName);
|
|
|
|
RegSetValueEx(hKeyResults,String,0, REG_DWORD,(CONST BYTE *)(&WinRect.left),
|
|
|
|
sizeof(DWORD));
|
|
|
|
}
|
|
|
|
RegCloseKey(hKeyResults);
|
|
|
|
}
|