Commit 1d46871c authored by Peter Zhigalov's avatar Peter Zhigalov

Добавил "New Window" в проект с WinAPI, исправил build-скрипты под Windows

parent a1fbe5b2
@echo off @echo off
set V_PROJECT=fem_draw_qt set V_PROJECT=fem_draw_qt
set QTDIR=C:\Qt\qt4.4.3-mingw342-static set QTDIR=C:\Qt\4.4.3\mingw342_32_static
set MINGWDIR=C:\Qt\MinGW-3.4.2 set MINGWDIR=C:\Qt\Tools\mingw342_32
set V_BUILDDIR=build_win_qt4.4.3_mingw342 set V_BUILDDIR=build_win_qt4.4.3_mingw342
set PATH=%QTDIR%\bin;%MINGWDIR%\bin;%MINGWDIR%\libexec\gcc\mingw32\3.4.2;%WINDIR%;%WINDIR%\System32 set PATH=%QTDIR%\bin;%MINGWDIR%\bin;%MINGWDIR%\libexec\gcc\mingw32\3.4.2;%WINDIR%;%WINDIR%\System32
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
set V_PROJECT=fem_draw_qt set V_PROJECT=fem_draw_qt
set V_ARCH=x86 set V_ARCH=x86
set V_VCVARS="C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat" set V_VCVARS="C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat"
set V_QTDIR=C:\Qt\qt4.4.3-msvc2005-x86-static set V_QTDIR=C:\Qt\4.4.3\msvc2005_static
set V_JOM=C:\Qt\jom.exe set V_JOM=C:\Qt\Tools\QtCreator\bin\jom.exe
set V_BUILDDIR=build_win_qt4.4.3_msvc2005 set V_BUILDDIR=build_win_qt4.4.3_msvc2005
call %V_VCVARS% %V_ARCH% call %V_VCVARS% %V_ARCH%
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
set V_PROJECT=fem_draw_qt set V_PROJECT=fem_draw_qt
set V_ARCH=x64 set V_ARCH=x64
set V_VCVARS="C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat" set V_VCVARS="C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat"
set V_QTDIR=C:\Qt\qt4.4.3-msvc2005-x64-static set V_QTDIR=C:\Qt\4.4.3\msvc2005_64_static
set V_JOM=C:\Qt\jom.exe set V_JOM=C:\Qt\Tools\QtCreator\bin\jom.exe
set V_BUILDDIR=build_win_qt4.4.3_msvc2005_x64 set V_BUILDDIR=build_win_qt4.4.3_msvc2005_x64
call %V_VCVARS% %V_ARCH% call %V_VCVARS% %V_ARCH%
......
@echo off @echo off
set V_PROJECT=fem_draw_winapi set V_PROJECT=fem_draw_winapi
set MINGWDIR=C:\Qt\MinGW-3.4.2 set MINGWDIR=C:\Qt\Tools\mingw342_32
set V_BUILDDIR=build_winapi_mingw342 set V_BUILDDIR=build_winapi_mingw342
set MINGW-CXX=g++ set MINGW-CXX=g++
set MINGW-WINDRES=windres set MINGW-WINDRES=windres
......
@echo off @echo off
set V_PROJECT=fem_draw_winapi set V_PROJECT=fem_draw_winapi
set MINGWDIR=C:\Qt\MinGW-3.4.2 set MINGWDIR=C:\Qt\Tools\mingw342_32
set V_BUILDDIR=build_winapi_mingw342_ansi set V_BUILDDIR=build_winapi_mingw342_ansi
set MINGW-CXX=g++ set MINGW-CXX=g++
set MINGW-WINDRES=windres set MINGW-WINDRES=windres
......
...@@ -467,6 +467,34 @@ finish: ...@@ -467,6 +467,34 @@ finish:
ReleaseDC(pdraw->hwnd, hdc1); ReleaseDC(pdraw->hwnd, hdc1);
} }
// Событие при нажатии кнопки New Window
void on_actionNew_Window_triggered()
{
TCHAR szFileName[MAX_PATH];
if(GetModuleFileName(NULL, szFileName, MAX_PATH))
{
STARTUPINFO info;
memset(&info, 0, sizeof(info));
info.cb = sizeof(info);
PROCESS_INFORMATION processInfo;
if(CreateProcess(szFileName, TEXT(""), NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo))
{
CloseHandle(processInfo.hProcess);
CloseHandle(processInfo.hThread);
}
else
{
MessageBox(hwnd, TEXT("Error: Error while creating new process!"), TEXT("Error"), MB_OK | MB_ICONERROR);
return;
}
}
else
{
MessageBox(hwnd, TEXT("Error: Unable to get current module file name!"), TEXT("Error"), MB_OK | MB_ICONERROR);
return;
}
}
// Событие при нажатии кнопки Exit // Событие при нажатии кнопки Exit
void on_actionExit_triggered() void on_actionExit_triggered()
{ {
...@@ -1316,6 +1344,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) ...@@ -1316,6 +1344,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
case CONTROL_MENU_SAVE: // Событие при сохранении case CONTROL_MENU_SAVE: // Событие при сохранении
on_actionSave_Image_File_triggered(); on_actionSave_Image_File_triggered();
break; break;
case CONTROL_MENU_NEW_WINDOW: // Событие при нажатии кнопки New Window
on_actionNew_Window_triggered();
break;
case CONTROL_MENU_EXIT: // Событие при нажатии кнопки Exit case CONTROL_MENU_EXIT: // Событие при нажатии кнопки Exit
on_actionExit_triggered(); on_actionExit_triggered();
break; break;
...@@ -1970,6 +2001,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow ...@@ -1970,6 +2001,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow
AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_COPY, TEXT("Copy Image to Clipboard\tCtrl+C")); AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_COPY, TEXT("Copy Image to Clipboard\tCtrl+C"));
AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_SAVE, TEXT("Save Image...\tCtrl+S")); AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_SAVE, TEXT("Save Image...\tCtrl+S"));
AppendMenu(menu::hFileMenu, MF_SEPARATOR, (UINT_PTR)NULL, TEXT("")); AppendMenu(menu::hFileMenu, MF_SEPARATOR, (UINT_PTR)NULL, TEXT(""));
AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_NEW_WINDOW, TEXT("New Window"));
AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_EXIT, TEXT("Exit\tCtrl+Q")); AppendMenu(menu::hFileMenu, MF_STRING, CONTROL_MENU_EXIT, TEXT("Exit\tCtrl+Q"));
menu::hInterpMenu = CreatePopupMenu(); menu::hInterpMenu = CreatePopupMenu();
AppendMenu(menu::hMenu, MF_STRING | MF_POPUP, (UINT_PTR)menu::hInterpMenu, TEXT("Interpolation")); AppendMenu(menu::hMenu, MF_STRING | MF_POPUP, (UINT_PTR)menu::hInterpMenu, TEXT("Interpolation"));
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
#define CONTROL_MENU_TRANSPARENT 10021 #define CONTROL_MENU_TRANSPARENT 10021
#define CONTROL_MENU_COPY 10022 #define CONTROL_MENU_COPY 10022
#define CONTROL_MENU_SAVE 10023 #define CONTROL_MENU_SAVE 10023
#define CONTROL_MENU_EXIT 10024 #define CONTROL_MENU_NEW_WINDOW 10024
#define CONTROL_MENU_EXIT 10025
#define CONTROL_MENU_INCREASE_INTERPOLATION 10030 #define CONTROL_MENU_INCREASE_INTERPOLATION 10030
#define CONTROL_MENU_DECREASE_INTERPOLATION 10031 #define CONTROL_MENU_DECREASE_INTERPOLATION 10031
#define CONTROL_MENU_ISOLINES_SHOW 10040 #define CONTROL_MENU_ISOLINES_SHOW 10040
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment