making another try with frontend. this time with nanogui

This commit is contained in:
jakani24
2024-03-14 22:00:54 +01:00
parent b4d42bfe32
commit 7ea487d0e1
69 changed files with 776 additions and 79 deletions

View File

@@ -0,0 +1,122 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:ui.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:choose_element.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:choose_element.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:client_frontend.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\id.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:id.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{644C9824-2298-46C6-9A62-7E080C98A0BB}|client_frontend.vcxproj|solutionrelative:ui.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 4,
"Children": [
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "choose_element.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.h",
"RelativeDocumentMoniker": "choose_element.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.h",
"RelativeToolTip": "choose_element.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAGAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T17:06:27.941Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "choose_element.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.cpp",
"RelativeDocumentMoniker": "choose_element.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\choose_element.cpp",
"RelativeToolTip": "choose_element.cpp",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABcAAABJAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T17:06:16.884Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "id.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\id.h",
"RelativeDocumentMoniker": "id.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\id.h",
"RelativeToolTip": "id.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAEAAAAQAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T16:31:43.692Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "ui.h",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.h",
"RelativeDocumentMoniker": "ui.h",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.h",
"RelativeToolTip": "ui.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAMAAAAQAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T16:28:38.361Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "ui.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.cpp",
"RelativeDocumentMoniker": "ui.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\ui.cpp",
"RelativeToolTip": "ui.cpp",
"ViewState": "AQIAACoAAAAAAAAAAAAwwC8AAAAwAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T16:28:29.863Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "client_frontend.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp",
"RelativeDocumentMoniker": "client_frontend.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend\\client_frontend.cpp",
"RelativeToolTip": "client_frontend.cpp",
"ViewState": "AQIAAHsAAAAAAAAAAAAAAJwAAAA3AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T16:22:29.931Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@@ -0,0 +1,33 @@
#include "choose_element.h"
#include <Windows.h>
#include <iostream>
#include <string>
std::wstring open_file(HWND hWnd)
{
OPENFILENAME ofn;
WCHAR szFile[MAX_PATH] = L"";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"All Files\0*.*\0"; // Filter for all files
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE)
{
// User selected a file, 'szFile' contains the selected file path
return std::wstring(szFile);
}
else
{
// User canceled the dialog
//MessageBox(hWnd, L"File selection canceled.", L"Canceled", MB_OK | MB_ICONEXCLAMATION);
return L"cancel";
}
}

View File

@@ -0,0 +1,6 @@
#pragma once
#include "id.h"
#include <Windows.h>
#include <string>
#include <iostream>
std::wstring open_file(HWND hWnd);

View File

@@ -1,19 +1,21 @@
// client_frontend.cpp : Definiert den Einstiegspunkt für die Anwendung. // client_frontend.cpp : Definiert den Einstiegspunkt für die Anwendung.
// //
#include <windows.h>
#include "framework.h" #include "framework.h"
#include "client_frontend.h" #include "client_frontend.h"
#define width 1000 #include "ui.h"
#define height 700 #include "id.h"
#include "choose_element.h"
#define MAX_LOADSTRING 100 #define MAX_LOADSTRING 100
// Globale Variablen: // Globale Variablen:
HINSTANCE hInst; // Aktuelle Instanz HINSTANCE hInst; // Aktuelle Instanz
WCHAR szTitle[MAX_LOADSTRING]; // Titelleistentext WCHAR szTitle[MAX_LOADSTRING]; // Titelleistentext
WCHAR szWindowClass[MAX_LOADSTRING]; // Der Klassenname des Hauptfensters. WCHAR szWindowClass[MAX_LOADSTRING]; // Der Klassenname des Hauptfensters.
// Vorwärtsdeklarationen der in diesem Codemodul enthaltenen Funktionen: // Vorwärtsdeklarationen der in diesem Codemodul enthaltenen Funktionen:
ATOM MyRegisterClass(HINSTANCE hInstance); ATOM frontend_class(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int); BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
@@ -31,7 +33,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
// Globale Zeichenfolgen initialisieren // Globale Zeichenfolgen initialisieren
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_CLIENTFRONTEND, szWindowClass, MAX_LOADSTRING); LoadStringW(hInstance, IDC_CLIENTFRONTEND, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance); frontend_class(hInstance);
// Anwendungsinitialisierung ausführen: // Anwendungsinitialisierung ausführen:
if (!InitInstance (hInstance, nCmdShow)) if (!InitInstance (hInstance, nCmdShow))
@@ -63,7 +65,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
// //
// ZWECK: Registriert die Fensterklasse. // ZWECK: Registriert die Fensterklasse.
// //
ATOM MyRegisterClass(HINSTANCE hInstance) ATOM frontend_class(HINSTANCE hInstance)
{ {
WNDCLASSEXW wcex; WNDCLASSEXW wcex;
@@ -99,7 +101,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
hInst = hInstance; // Instanzenhandle in der globalen Variablen speichern hInst = hInstance; // Instanzenhandle in der globalen Variablen speichern
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, width,height, nullptr, nullptr, hInstance, nullptr); CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
if (!hWnd) if (!hWnd)
{ {
@@ -121,69 +123,66 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
// WM_PAINT - Darstellen des Hauptfensters // WM_PAINT - Darstellen des Hauptfensters
// WM_DESTROY - Ausgeben einer Beendenmeldung und zurückkehren // WM_DESTROY - Ausgeben einer Beendenmeldung und zurückkehren
// //
//main loop //
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
int windowWidth=0;
int windowHeight=0;
RECT clientRect;
GetClientRect(hWnd, &clientRect);
windowWidth = clientRect.right - clientRect.left;
windowHeight = clientRect.bottom - clientRect.top;
switch (message) switch (message)
{ {
case WM_COMMAND: case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// Menüauswahl analysieren:
switch (wmId)
{ {
int wmId = LOWORD(wParam); case IDM_ABOUT:
// Menüauswahl analysieren: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
switch (wmId) break;
{ case IDM_EXIT:
case IDM_ABOUT: DestroyWindow(hWnd);
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break;
break; case ID_HOME_BUTTON: // Handle the home button click
case IDM_EXIT: //set page to 0
DestroyWindow(hWnd); ui_clear();
break; ui_display_page(0, windowWidth, windowHeight, hWnd);
default: break;
return DefWindowProc(hWnd, message, wParam, lParam); case ID_SCAN_FILE_BUTTON: // Handle the scan file button click
} //set page to 1
ui_clear();
ui_display_page(1, windowWidth, windowHeight, hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
} }
break; }
break;
case WM_PAINT: case WM_PAINT:
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps); HDC hdc = BeginPaint(hWnd, &ps);
// TODO: Zeichencode, der hdc verwendet, hier einfügen... // TODO: Zeichencode, der hdc verwendet, hier einfügen...
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
} }
break; break;
case WM_CREATE:
{
//ui_create();
ui_display_page(0, windowWidth, windowHeight, hWnd);
}
break;
case WM_DESTROY: case WM_DESTROY:
PostQuitMessage(0); PostQuitMessage(0);
break; break;
case WM_CREATE: case WM_SIZE:
{ //ui_resize();
HWND textbox_, learn_button_, make_button_, settings_button_; ui_clear();
//for this text we need to get some data from the backend ui_display_page(0, windowWidth, windowHeight, hWnd);
//e.g. rtp break;
//database status
//infected files
//etc
textbox_ = CreateWindow(L"EDIT",
L"Welcome to cyberhex\r\n\r\nPlease select an option:\r\n\r\n",
WS_VISIBLE | WS_CHILD | ES_READONLY | ES_MULTILINE,
10, 10, width - 30, height - 200,
hWnd, (HMENU)0, NULL, NULL);
learn_button_ = CreateWindow(L"BUTTON",
L"Learn a set of Voc",
WS_VISIBLE | WS_CHILD | WS_BORDER,
160, 550, 200, 30, //wo, xy // wie gross xy
hWnd, (HMENU)1, NULL, NULL);
make_button_ = CreateWindow(L"BUTTON",
L"Make a set of Voc",
WS_VISIBLE | WS_CHILD | WS_BORDER,
380, 550, 200, 30,
hWnd, (HMENU)2, NULL, NULL);
settings_button_ = CreateWindow(L"BUTTON",
L"Settings",
WS_VISIBLE | WS_CHILD | WS_BORDER,
600, 550, 200, 30,
hWnd, (HMENU)3, NULL, NULL);
break;
}
default: default:
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProc(hWnd, message, wParam, lParam);
} }

View File

@@ -1,9 +1,9 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188 VisualStudioVersion = 17.9.34701.34
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_frontend", "client_frontend.vcxproj", "{714B1F08-886A-4AB5-89D4-B9919264F524}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_frontend", "client_frontend.vcxproj", "{644C9824-2298-46C6-9A62-7E080C98A0BB}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -13,19 +13,19 @@ Global
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{714B1F08-886A-4AB5-89D4-B9919264F524}.Debug|x64.ActiveCfg = Debug|x64 {644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x64.ActiveCfg = Debug|x64
{714B1F08-886A-4AB5-89D4-B9919264F524}.Debug|x64.Build.0 = Debug|x64 {644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x64.Build.0 = Debug|x64
{714B1F08-886A-4AB5-89D4-B9919264F524}.Debug|x86.ActiveCfg = Debug|Win32 {644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x86.ActiveCfg = Debug|Win32
{714B1F08-886A-4AB5-89D4-B9919264F524}.Debug|x86.Build.0 = Debug|Win32 {644C9824-2298-46C6-9A62-7E080C98A0BB}.Debug|x86.Build.0 = Debug|Win32
{714B1F08-886A-4AB5-89D4-B9919264F524}.Release|x64.ActiveCfg = Release|x64 {644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x64.ActiveCfg = Release|x64
{714B1F08-886A-4AB5-89D4-B9919264F524}.Release|x64.Build.0 = Release|x64 {644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x64.Build.0 = Release|x64
{714B1F08-886A-4AB5-89D4-B9919264F524}.Release|x86.ActiveCfg = Release|Win32 {644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x86.ActiveCfg = Release|Win32
{714B1F08-886A-4AB5-89D4-B9919264F524}.Release|x86.Build.0 = Release|Win32 {644C9824-2298-46C6-9A62-7E080C98A0BB}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D94BC215-E973-42E4-A7F3-33EFCC3C89C9} SolutionGuid = {F67EF8DC-E0C4-4EE3-9BBA-D7BD7AC687A9}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@@ -21,7 +21,7 @@
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion> <VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<ProjectGuid>{714b1f08-886a-4ab5-89d4-b9919264f524}</ProjectGuid> <ProjectGuid>{644c9824-2298-46c6-9a62-7e080c98a0bb}</ProjectGuid>
<RootNamespace>clientfrontend</RootNamespace> <RootNamespace>clientfrontend</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
@@ -127,13 +127,18 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="choose_element.h" />
<ClInclude Include="client_frontend.h" /> <ClInclude Include="client_frontend.h" />
<ClInclude Include="framework.h" /> <ClInclude Include="framework.h" />
<ClInclude Include="id.h" />
<ClInclude Include="Resource.h" /> <ClInclude Include="Resource.h" />
<ClInclude Include="targetver.h" /> <ClInclude Include="targetver.h" />
<ClInclude Include="ui.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="choose_element.cpp" />
<ClCompile Include="client_frontend.cpp" /> <ClCompile Include="client_frontend.cpp" />
<ClCompile Include="ui.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="client_frontend.rc" /> <ResourceCompile Include="client_frontend.rc" />

View File

@@ -27,11 +27,26 @@
<ClInclude Include="client_frontend.h"> <ClInclude Include="client_frontend.h">
<Filter>Headerdateien</Filter> <Filter>Headerdateien</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="ui.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="id.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="choose_element.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="client_frontend.cpp"> <ClCompile Include="client_frontend.cpp">
<Filter>Quelldateien</Filter> <Filter>Quelldateien</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="ui.cpp">
<Filter>Headerdateien</Filter>
</ClCompile>
<ClCompile Include="choose_element.cpp">
<Filter>Headerdateien</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="client_frontend.rc"> <ResourceCompile Include="client_frontend.rc">

View File

@@ -1,2 +1,2 @@
 client_frontend.cpp  ui.cpp
client_frontend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\x64\Debug\client_frontend.exe client_frontend.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\x64\Debug\client_frontend.exe

View File

@@ -0,0 +1,3 @@
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\choose_element.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\choose_element.obj
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\client_frontend.obj
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\ui.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\ui.obj

View File

@@ -1,2 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.38.33130:TargetPlatformVersion=10.0.22621.0:VcpkgTriplet=x64-windows: PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0:VcpkgTriplet=x64-windows:
Debug|x64|C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\| Debug|x64|C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\|

View File

@@ -0,0 +1,2 @@
^C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CHOOSE_ELEMENT.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CLIENT_FRONTEND.OBJ|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\CLIENT_FRONTEND.RES|C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND\CLIENT_FRONTEND\X64\DEBUG\UI.OBJ
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend\x64\Debug\client_frontend.ilk

8
src/client_frontend/id.h Normal file
View File

@@ -0,0 +1,8 @@
#pragma once
#define ID_HOME_BUTTON 0
#define ID_STARTUP_BUTTON 1
#define ID_SCAN_FILE_BUTTON 2
#define ID_SCAN_FOLDER_BUTTON 3
#define ID_SETTINGS_BUTTON 4
#define ID_WELCOME_TEXT 1000

View File

@@ -0,0 +1,95 @@
#include "ui.h"
#include "id.h"
#include <windows.h>
#include "choose_element.h"
HWND hwnd_[100];
int num_hwnd = 0;
void draw_main_page(int window_width, int window_height, HWND hwnd);
void draw_scan_file_page(int window_width, int window_height, HWND hwnd);
void ui_display_page(int page_id,int window_width, int window_height, HWND hwnd) {
//create one button in middle of screen
//hwnd_[num_hwnd] = CreateWindowW(L"BUTTON", L"OK", WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,(window_width-50)/2,(window_height-15)/2, 100, 30, hwnd, (HMENU)ID_STARTUP_BUTTON, NULL, NULL);
//num_hwnd++;
switch (page_id) {
case 0: //main page
draw_main_page(window_width,window_height,hwnd);
break;
case 1: //scan file page
draw_scan_file_page(window_width, window_height, hwnd);
break;
}
}
void ui_clear() {
//clear all windows
for (int i = 0; i < num_hwnd; i++) {
if (hwnd_[i] != NULL) {
DestroyWindow(hwnd_[i]);
}
}
num_hwnd = 0;
}
void draw_main_page(int window_width, int window_height, HWND hwnd) {
//draw main page
hwnd_[num_hwnd] = CreateWindow(L"EDIT",
L"Welcome to cyberhex\r\n\r\nPlease select an option:\r\n\r\n",
WS_VISIBLE | WS_CHILD | ES_READONLY | ES_MULTILINE,
10, 10, window_width - 30, window_height - 200,
hwnd, (HMENU)0, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd]= CreateWindow(L"BUTTON",
L"Scan a file",
WS_VISIBLE | WS_CHILD | WS_BORDER,
(window_width)/4-100, window_height - 150, 200, 30,
hwnd, (HMENU)ID_SCAN_FILE_BUTTON, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd] = CreateWindow(L"BUTTON",
L"Scan a folder",
WS_VISIBLE | WS_CHILD | WS_BORDER,
(2* window_width) / 4-100, window_height - 150, 200, 30,
hwnd, (HMENU)ID_SCAN_FOLDER_BUTTON, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd] = CreateWindow(L"BUTTON",
L"Settings",
WS_VISIBLE | WS_CHILD | WS_BORDER,
(3* window_width) / 4-100, window_height - 150, 200, 30,
hwnd, (HMENU)ID_SETTINGS_BUTTON, NULL, NULL);
num_hwnd++;
}
void draw_scan_file_page(int window_width, int window_height, HWND hwnd) {
//draw scan file page
std::wstring message = L"File to scan: ";
std::wstring path=open_file(hwnd);
if (path == L"cancel") {
ui_clear();
ui_display_page(0, window_width, window_height, hwnd);
return;
}
message += path;
hwnd_[num_hwnd] = CreateWindow(L"EDIT",
message.c_str(),
WS_VISIBLE | WS_CHILD | ES_READONLY | ES_MULTILINE,
10, 10, window_width - 30, window_height - 200,
hwnd, (HMENU)0, NULL, NULL);
num_hwnd++;
hwnd_[num_hwnd] = CreateWindow(L"BUTTON",
L"Home",
WS_VISIBLE | WS_CHILD | WS_BORDER,
10, window_height - 50, 200, 30,
hwnd, (HMENU)ID_HOME_BUTTON, NULL, NULL);
num_hwnd++;
}
void update_scan_results(int window_width, int window_height, HWND hwnd,std::wstring& message) {
//draw scan results
//get value from the text field of draw_scan_file_page
//add to thetextfield the string message
}

4
src/client_frontend/ui.h Normal file
View File

@@ -0,0 +1,4 @@
#pragma once
#include <Windows.h>
void ui_display_page(int page_id, int window_width, int window_height, HWND hwnd);
void ui_clear();

View File

@@ -1 +0,0 @@
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\client_frontend.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\x64\Debug\client_frontend.obj

View File

@@ -0,0 +1,53 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|solutionrelative:main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{C434E5CA-752E-4D35-9986-BECF1CC34A98}|client_frontend_guilite.vcxproj|C:\\VCPKG\\VCPKG-2023.08.09\\INSTALLED\\X64-WINDOWS\\INCLUDE\\NANOGUI\\GLUTIL.H||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "glutil.h",
"DocumentMoniker": "C:\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h",
"RelativeDocumentMoniker": "..\\..\\..\\..\\..\\..\\..\\..\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h",
"ToolTip": "C:\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h",
"RelativeToolTip": "..\\..\\..\\..\\..\\..\\..\\..\\vcpkg\\vcpkg-2023.08.09\\installed\\x64-windows\\include\\nanogui\\glutil.h",
"ViewState": "AQIAANwAAAAAAAAAAAD4v/gAAAAKAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-14T20:21:24.734Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "main.cpp",
"DocumentMoniker": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp",
"RelativeDocumentMoniker": "main.cpp",
"ToolTip": "C:\\Users\\janis\\Documents\\Projekte_mit_c\\ma\\ma\\src\\client_frontend_guilite\\main.cpp",
"RelativeToolTip": "main.cpp",
"ViewState": "AQIAAA0AAAAAAAAAAAD4vxUAAAA5AAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-14T19:45:55.142Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@@ -0,0 +1 @@
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\main.cpp;C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\client_f.c434e5ca\x64\Debug\main.obj

View File

@@ -0,0 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0:VcpkgTriplet=x64-windows:
Debug|x64|C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\|

View File

@@ -0,0 +1,2 @@
^C:\USERS\JANIS\DOCUMENTS\PROJEKTE_MIT_C\MA\MA\SRC\CLIENT_FRONTEND_GUILITE\CLIENT_F.C434E5CA\X64\DEBUG\MAIN.OBJ
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\client_f.c434e5ca\x64\Debug\client_frontend_guilite.ilk

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\x64\Debug\client_frontend_guilite.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>

View File

@@ -0,0 +1,8 @@
 main.cpp
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": Makro-Neudefinition
(Quelldatei „main.cpp“ wird kompiliert)
C:\vcpkg\vcpkg-2023.08.09\installed\x64-windows\include\GLFW\glfw3.h(123,1):
Siehe vorherige Definition von "APIENTRY"
LINK : warning LNK4044: Nicht erkannte Option /lOpenGL; wird ignoriert.
client_frontend_guilite.vcxproj -> C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\x64\Debug\client_frontend_guilite.exe

View File

@@ -0,0 +1,2 @@
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\x64\Debug\glfw3.dll
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\client_f.c434e5ca\x64\Debug\client_f.58F0C424.Up2Date

View File

@@ -1 +1,2 @@
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend\x64\Debug\client_frontend.exe
C:\Users\janis\Documents\Projekte_mit_c\ma\ma\src\client_frontend_guilite\x64\Debug\glfw3.dll

View File

@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34701.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_frontend_guilite", "client_frontend_guilite.vcxproj", "{C434E5CA-752E-4D35-9986-BECF1CC34A98}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C434E5CA-752E-4D35-9986-BECF1CC34A98}.Debug|x64.ActiveCfg = Debug|x64
{C434E5CA-752E-4D35-9986-BECF1CC34A98}.Debug|x64.Build.0 = Debug|x64
{C434E5CA-752E-4D35-9986-BECF1CC34A98}.Debug|x86.ActiveCfg = Debug|Win32
{C434E5CA-752E-4D35-9986-BECF1CC34A98}.Debug|x86.Build.0 = Debug|Win32
{C434E5CA-752E-4D35-9986-BECF1CC34A98}.Release|x64.ActiveCfg = Release|x64
{C434E5CA-752E-4D35-9986-BECF1CC34A98}.Release|x64.Build.0 = Release|x64
{C434E5CA-752E-4D35-9986-BECF1CC34A98}.Release|x86.ActiveCfg = Release|Win32
{C434E5CA-752E-4D35-9986-BECF1CC34A98}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4C17868F-AC7A-4A40-8081-8BB25B004F6A}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{c434e5ca-752e-4d35-9986-becf1cc34a98}</ProjectGuid>
<RootNamespace>clientfrontendguilite</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(VCPKG_ROOT)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>$(CoreLibraryDependencies);%(AdditionalDependencies);-lOpenGL</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Quelldateien">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Headerdateien">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Ressourcendateien">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@@ -0,0 +1,123 @@
#include <nanogui/nanogui.h>
#include <thread>
#include <chrono>
#include <atomic>
#include <iostream>
#include <shlobj.h>
#include <windows.h>
#include <locale>
#include <codecvt>
// Function to simulate file scanning
void scan_file(nanogui::Screen* screen, const std::string& filePath) {
// Simulate file scanning by waiting for 10 seconds
std::this_thread::sleep_for(std::chrono::seconds(10));
// Display the scanned file path in the window
screen->add<nanogui::Label>("Scanned file: " + filePath);
// Refresh layout to ensure the new label is visible
screen->performLayout();
}
// Function to simulate folder scanning
void scan_folder(nanogui::Screen* screen, const std::string& folderPath) {
// Simulate folder scanning by waiting for 10 seconds
std::this_thread::sleep_for(std::chrono::seconds(10));
// Display the scanned folder path in the window
screen->add<nanogui::Label>("Scanned folder: " + folderPath);
// Refresh layout to ensure the new label is visible
screen->performLayout();
}
std::string getFolderPath() {
std::string selectedFolderPath;
// Initialize COM
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
// Display the folder picker dialog
BROWSEINFO browseInfo = { 0 };
TCHAR selectedPath[MAX_PATH];
browseInfo.hwndOwner = NULL; // Use the desktop window as the owner
browseInfo.pidlRoot = NULL; // Start from the desktop
browseInfo.pszDisplayName = selectedPath;
browseInfo.lpszTitle = TEXT("Select a folder");
browseInfo.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
LPITEMIDLIST pidlSelected = SHBrowseForFolder(&browseInfo);
if (pidlSelected != NULL) {
SHGetPathFromIDList(pidlSelected, selectedPath);
// Convert TCHAR array to std::string
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
selectedFolderPath = converter.to_bytes(selectedPath);
// Free the PIDL
IMalloc* pMalloc;
if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
pMalloc->Free(pidlSelected);
pMalloc->Release();
}
}
// Uninitialize COM
CoUninitialize();
return selectedFolderPath;
}
int main() {
// Initialize NanoGUI
nanogui::init();
// Create a NanoGUI screen
nanogui::Screen screen(nanogui::Vector2i(400, 300), "Antivirus");
// Create a layout for the buttons
nanogui::Widget* buttonWidget = new nanogui::Widget(&screen);
nanogui::BoxLayout* buttonLayout = new nanogui::BoxLayout(nanogui::Orientation::Vertical,
nanogui::Alignment::Middle,
5, 5);
buttonWidget->setLayout(buttonLayout);
// Create a button for scanning a file
nanogui::Button* scanFileButton = new nanogui::Button(buttonWidget, "Scan File");
scanFileButton->setFixedWidth(150);
scanFileButton->setCallback([&] {
// Open file dialog to select a file
std::string selectedFile = nanogui::file_dialog(
{ {"*", "All Files"} },
false
);
if (!selectedFile.empty()) {
// Call scan_file function in a separate thread
std::thread(scan_file, &screen, selectedFile).detach();
}
});
// Create a button for scanning a folder
nanogui::Button* scanFolderButton = new nanogui::Button(buttonWidget, "Scan Folder");
scanFolderButton->setFixedWidth(150);
scanFolderButton->setCallback([&] {
// Open file dialog to select a folder
std::string selectedFolder = getFolderPath();
if (!selectedFolder.empty()) {
// Call scan_folder function in a separate thread
std::thread(scan_folder, &screen, selectedFolder).detach();
}
});
// Set the layout for the main screen
nanogui::BoxLayout* layout = new nanogui::BoxLayout(nanogui::Orientation::Horizontal,
nanogui::Alignment::Middle,
10, 10);
screen.setLayout(layout);
// Draw NanoGUI
screen.performLayout();
screen.setVisible(true);
// Main event loop
nanogui::mainloop();
// Shutdown NanoGUI
nanogui::shutdown();
return 0;
}

View File

@@ -13,7 +13,7 @@ $perms = $_SESSION["perms"];
if(isset($_GET["page"])){ if(isset($_GET["page"])){
$page=$_GET["page"]; $page=$_GET["page"];
}else{ }else{
$page="welcome.php"; $page="welcome.php"; //this is actually the Dashboard
} }
?> ?>
@@ -67,7 +67,10 @@ if(isset($_GET["page"])){
echo('<li><a href="index.php?page=user_list.php">User List</a></li>'); echo('<li><a href="index.php?page=user_list.php">User List</a></li>');
?> ?>
</ul> </ul>
<p>Log</p> <?php
if($perms[2]=="1")
echo("<p>Log</p>");
?>
<ul> <ul>
<?php <?php
if($perms[2]=="1") if($perms[2]=="1")
@@ -76,7 +79,10 @@ if(isset($_GET["page"])){
echo('<li><a href="index.php?page=export_log.php">Export Log</a></li>'); echo('<li><a href="index.php?page=export_log.php">Export Log</a></li>');
?> ?>
</ul> </ul>
<p>Cyberhex settings</p> <?php
if($perms[4]=="1" or $perms[5]=="1" or $perms[6]=="1")
echo("<p>Cyberhex settings</p>");
?>
<ul> <ul>
<?php <?php
if($perms[4]=="1") if($perms[4]=="1")
@@ -87,7 +93,10 @@ if(isset($_GET["page"])){
echo('<li><a href="index.php?page=database_settings.php?show=update">Database Settings</a></li>'); echo('<li><a href="index.php?page=database_settings.php?show=update">Database Settings</a></li>');
?> ?>
</ul> </ul>
<p>Clients</p> <?php
if($perms[7]=="1" or $perms[8]=="1")
echo("<p>Clients</p>");
?>
<ul> <ul>
<!-- <li><a href="index.php?page=mass_add_clients.php">Mass Add CLients</a></li> --> <!-- <li><a href="index.php?page=mass_add_clients.php">Mass Add CLients</a></li> -->
<?php <?php