-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created empty shell Windowed application
refresh_file_explorer.exe
.
- Loading branch information
1 parent
fc092bf
commit f8f632a
Showing
3 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
find_package(rapidassist REQUIRED) | ||
|
||
add_executable(refresh_file_explorer WIN32 | ||
${SHELLANYTHING_EXPORT_HEADER} | ||
${SHELLANYTHING_VERSION_HEADER} | ||
${SHELLANYTHING_CONFIG_HEADER} | ||
main.cpp | ||
) | ||
|
||
# Force UNICODE for target | ||
target_compile_definitions(refresh_file_explorer PRIVATE -D_UNICODE -DUNICODE) | ||
|
||
# Force CMAKE_DEBUG_POSTFIX for executables | ||
set_target_properties(refresh_file_explorer PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) | ||
|
||
# Define include directories for the executable. | ||
target_include_directories(refresh_file_explorer | ||
PRIVATE | ||
${GTEST_INCLUDE_DIR} | ||
rapidassist | ||
${CMAKE_SOURCE_DIR}/src/shared | ||
) | ||
|
||
# Define linking dependencies. | ||
add_dependencies(refresh_file_explorer sa.shared) | ||
target_link_libraries(refresh_file_explorer | ||
PRIVATE | ||
sa.shared | ||
rapidassist | ||
) | ||
|
||
install(TARGETS refresh_file_explorer | ||
EXPORT shellanything-targets | ||
ARCHIVE DESTINATION ${SHELLANYTHING_INSTALL_LIB_DIR} | ||
LIBRARY DESTINATION ${SHELLANYTHING_INSTALL_LIB_DIR} | ||
RUNTIME DESTINATION ${SHELLANYTHING_INSTALL_BIN_DIR} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#include <windows.h> | ||
|
||
const TCHAR g_szClassName[] = L"myWindowClass"; | ||
|
||
// Step 4: the Window Procedure | ||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | ||
{ | ||
switch (msg) | ||
{ | ||
case WM_CLOSE: | ||
DestroyWindow(hwnd); | ||
break; | ||
case WM_DESTROY: | ||
PostQuitMessage(0); | ||
break; | ||
default: | ||
return DefWindowProc(hwnd, msg, wParam, lParam); | ||
} | ||
return 0; | ||
} | ||
|
||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, | ||
LPSTR lpCmdLine, int nCmdShow) | ||
{ | ||
WNDCLASSEX wc; | ||
HWND hwnd; | ||
MSG msg; | ||
|
||
//Step 1: Registering the Window Class | ||
wc.cbSize = sizeof(WNDCLASSEX); | ||
wc.style = 0; | ||
wc.lpfnWndProc = WndProc; | ||
wc.cbClsExtra = 0; | ||
wc.cbWndExtra = 0; | ||
wc.hInstance = hInstance; | ||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); | ||
wc.hCursor = LoadCursor(NULL, IDC_ARROW); | ||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); | ||
wc.lpszMenuName = NULL; | ||
wc.lpszClassName = g_szClassName; | ||
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); | ||
|
||
if (!RegisterClassEx(&wc)) | ||
{ | ||
MessageBox(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK); | ||
return 0; | ||
} | ||
|
||
// Step 2: Creating the Window | ||
hwnd = CreateWindowEx( | ||
WS_EX_CLIENTEDGE, | ||
g_szClassName, | ||
L"The title of my window", | ||
WS_OVERLAPPEDWINDOW, | ||
CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, | ||
NULL, NULL, hInstance, NULL); | ||
|
||
if (hwnd == NULL) | ||
{ | ||
MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK); | ||
return 0; | ||
} | ||
|
||
ShowWindow(hwnd, nCmdShow); | ||
UpdateWindow(hwnd); | ||
|
||
// Step 3: The Message Loop | ||
while (GetMessage(&msg, NULL, 0, 0) > 0) | ||
{ | ||
TranslateMessage(&msg); | ||
DispatchMessage(&msg); | ||
} | ||
return (int)msg.wParam; | ||
} |