/* entry point */
int WINAPI
-_tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument, int nFunsterStil)
+_tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument, INT nCmdShow)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
LoadString(hThisInstance, IDS_MINIATURETITLE, miniaturetitle, _countof(miniaturetitle));
/* load settings from registry */
- registrySettings.Load();
+ registrySettings.Load(nCmdShow);
showMiniature = registrySettings.ShowThumbnail;
imageModel.Crop(registrySettings.BMPWidth, registrySettings.BMPHeight);
/* create main window */
- RECT mainWindowPos = {0, 0, 544, 375}; // FIXME: use equivalent of CW_USEDEFAULT for position
+ RECT mainWindowPos = registrySettings.WindowPlacement.rcNormalPosition;
hwnd = mainWindow.Create(HWND_DESKTOP, mainWindowPos, strTitle, WS_OVERLAPPEDWINDOW);
RECT fullscreenWindowPos = {0, 0, 100, 100};
/* placing the size boxes around the image */
imageArea.SendMessage(WM_SIZE, 0, 0);
- /* by moving the window, the things in WM_SIZE are done */
- mainWindow.SetWindowPlacement(&(registrySettings.WindowPlacement));
-
/* Make the window visible on the screen */
- ShowWindow (hwnd, nFunsterStil);
+ ShowWindow(hwnd, registrySettings.WindowPlacement.showCmd);
/* inform the system, that the main window accepts dropped files */
DragAcceptFiles(hwnd, TRUE);
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) szFileName, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
}
-void RegistrySettings::LoadPresets()
+void RegistrySettings::LoadPresets(INT nCmdShow)
{
BMPHeight = GetSystemMetrics(SM_CYSCREEN) / 2;
BMPWidth = GetSystemMetrics(SM_CXSCREEN) / 2;
strFontName = lf.lfFaceName;
ZeroMemory(&WindowPlacement, sizeof(WindowPlacement));
+ RECT& rc = WindowPlacement.rcNormalPosition;
+ rc.left = rc.top = CW_USEDEFAULT;
+ rc.right = rc.left + 544;
+ rc.bottom = rc.top + 375;
+ WindowPlacement.showCmd = nCmdShow;
}
-void RegistrySettings::Load()
+void RegistrySettings::Load(INT nCmdShow)
{
- LoadPresets();
+ LoadPresets(nCmdShow);
CRegKey view;
if (view.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Paint\\View"), KEY_READ) == ERROR_SUCCESS)