Skip to content

Commit

Permalink
You can browse for files in TilandisGUI, initial work on TilandisLTD …
Browse files Browse the repository at this point in the history
…and TilandisUWP
  • Loading branch information
Nicholas O'Connor committed Mar 2, 2016
1 parent 8e959cf commit a92d734
Show file tree
Hide file tree
Showing 27 changed files with 769 additions and 10 deletions.
38 changes: 38 additions & 0 deletions Tilandis.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,68 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tilandis", "Tilandis\Tiland
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TilandisGUI", "TilandisGUI\TilandisGUI.vcxproj", "{70FF911F-A735-4190-B33F-6359F4CC84F4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TilandisUWP", "TilandisUWP\TilandisUWP.vcxproj", "{46C8D76E-E90A-4C60-8254-4D2618E82AF3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TilandisLTD", "TilandisLTD\TilandisLTD.vcxproj", "{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{59649EC5-2A97-4BA9-AD93-B7BDBE665F71}.Debug|ARM.ActiveCfg = Debug|Win32
{59649EC5-2A97-4BA9-AD93-B7BDBE665F71}.Debug|x64.ActiveCfg = Debug|x64
{59649EC5-2A97-4BA9-AD93-B7BDBE665F71}.Debug|x64.Build.0 = Debug|x64
{59649EC5-2A97-4BA9-AD93-B7BDBE665F71}.Debug|x86.ActiveCfg = Debug|Win32
{59649EC5-2A97-4BA9-AD93-B7BDBE665F71}.Debug|x86.Build.0 = Debug|Win32
{59649EC5-2A97-4BA9-AD93-B7BDBE665F71}.Release|ARM.ActiveCfg = Release|Win32
{59649EC5-2A97-4BA9-AD93-B7BDBE665F71}.Release|x64.ActiveCfg = Release|x64
{59649EC5-2A97-4BA9-AD93-B7BDBE665F71}.Release|x64.Build.0 = Release|x64
{59649EC5-2A97-4BA9-AD93-B7BDBE665F71}.Release|x86.ActiveCfg = Release|Win32
{59649EC5-2A97-4BA9-AD93-B7BDBE665F71}.Release|x86.Build.0 = Release|Win32
{70FF911F-A735-4190-B33F-6359F4CC84F4}.Debug|ARM.ActiveCfg = Debug|Win32
{70FF911F-A735-4190-B33F-6359F4CC84F4}.Debug|x64.ActiveCfg = Debug|x64
{70FF911F-A735-4190-B33F-6359F4CC84F4}.Debug|x64.Build.0 = Debug|x64
{70FF911F-A735-4190-B33F-6359F4CC84F4}.Debug|x86.ActiveCfg = Debug|Win32
{70FF911F-A735-4190-B33F-6359F4CC84F4}.Debug|x86.Build.0 = Debug|Win32
{70FF911F-A735-4190-B33F-6359F4CC84F4}.Release|ARM.ActiveCfg = Release|Win32
{70FF911F-A735-4190-B33F-6359F4CC84F4}.Release|x64.ActiveCfg = Release|x64
{70FF911F-A735-4190-B33F-6359F4CC84F4}.Release|x64.Build.0 = Release|x64
{70FF911F-A735-4190-B33F-6359F4CC84F4}.Release|x86.ActiveCfg = Release|Win32
{70FF911F-A735-4190-B33F-6359F4CC84F4}.Release|x86.Build.0 = Release|Win32
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Debug|ARM.ActiveCfg = Debug|ARM
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Debug|ARM.Build.0 = Debug|ARM
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Debug|ARM.Deploy.0 = Debug|ARM
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Debug|x64.ActiveCfg = Debug|x64
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Debug|x64.Build.0 = Debug|x64
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Debug|x64.Deploy.0 = Debug|x64
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Debug|x86.ActiveCfg = Debug|Win32
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Debug|x86.Build.0 = Debug|Win32
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Debug|x86.Deploy.0 = Debug|Win32
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Release|ARM.ActiveCfg = Release|ARM
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Release|ARM.Build.0 = Release|ARM
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Release|ARM.Deploy.0 = Release|ARM
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Release|x64.ActiveCfg = Release|x64
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Release|x64.Build.0 = Release|x64
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Release|x64.Deploy.0 = Release|x64
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Release|x86.ActiveCfg = Release|Win32
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Release|x86.Build.0 = Release|Win32
{46C8D76E-E90A-4C60-8254-4D2618E82AF3}.Release|x86.Deploy.0 = Release|Win32
{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}.Debug|ARM.ActiveCfg = Debug|Win32
{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}.Debug|x64.ActiveCfg = Debug|x64
{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}.Debug|x64.Build.0 = Debug|x64
{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}.Debug|x86.ActiveCfg = Debug|Win32
{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}.Debug|x86.Build.0 = Debug|Win32
{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}.Release|ARM.ActiveCfg = Release|Win32
{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}.Release|x64.ActiveCfg = Release|x64
{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}.Release|x64.Build.0 = Release|x64
{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}.Release|x86.ActiveCfg = Release|Win32
{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 3 additions & 3 deletions Tilandis/Tilandis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ int CALLBACK wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR, int nShow) {
if (Tilandis::AddToRegistry) {
bool result = Tilandis::RegisterProtocol();
if (!result) {
MessageBox(NULL, L"Failed to register Tilandis with specified protocol (hint: this function needs administrator rights)", L"Tilandis", 0);
MessageBox(NULL, L"Failed to register Tilandis with specified protocol (hint: this function needs administrator rights)", L"Tilandis", MB_ICONERROR);
return 1;
}
else {
MessageBox(NULL, L"Tilandis has \"successfully\" registered itself with the specified protocol.\r\nBe aware that though no error is reported, many failure cases aren't currently detected. You'll have to double-check the registry yourself.", L"Tilandis", 0);
MessageBox(NULL, L"Tilandis has \"successfully\" registered itself with the specified protocol.\r\nBe aware that though no error is reported, many failure cases aren't currently detected. If it still doesn't work, you'll have to double-check the registry yourself.", L"Tilandis", 0);
return 0;
}
}
Expand Down Expand Up @@ -133,6 +133,6 @@ bool Tilandis::RegisterProtocol() {
std::wstring regstring = regstringstream.str();
const wchar_t* regbytes = regstring.c_str();
result = RegSetValueEx(subregistry, NULL, 0, REG_SZ, (LPBYTE) regbytes, 65535);
if (!result) { return false; }
if (result != ERROR_SUCCESS) { return false; }
return true;
}
Binary file modified TilandisGUI/TilandisGUI.rc
Binary file not shown.
31 changes: 28 additions & 3 deletions TilandisGUI/TilandisGUIDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ BEGIN_MESSAGE_MAP(CTilandisGUIDlg, CDialogEx)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_REGISTERPROTOCOL, &CTilandisGUIDlg::OnBnClickedRegisterprotocol)
ON_BN_CLICKED(IDC_CHECK1, &CTilandisGUIDlg::OnBnClickedCheck1)
ON_BN_CLICKED(IDC_PATHBROWSE, &CTilandisGUIDlg::OnBnClickedPathbrowse)
END_MESSAGE_MAP()


Expand Down Expand Up @@ -169,7 +169,32 @@ void CTilandisGUIDlg::OnBnClickedRegisterprotocol()
}


void CTilandisGUIDlg::OnBnClickedCheck1()
void CTilandisGUIDlg::OnBnClickedPathbrowse()
{
// TODO: Add your control notification handler code here
IFileDialog *openbox = NULL;
COMDLG_FILTERSPEC filters[] = {
{L"Executable files", L"*.exe"},
{L"All files (yes, this works!)", L"*.*"}
};
HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&openbox));

if (!SUCCEEDED(hr)) {
MessageBox(L"Failed to create a file dialog.", L"Tilandis GUI");
return;
}

openbox->SetFileTypes(2, filters);
openbox->SetTitle(L"Program (or file) to launch");

hr = openbox->Show(m_hWnd);
if (SUCCEEDED(hr)) {
CComPtr<IShellItem> pItem;
if (!SUCCEEDED(openbox->GetResult(&pItem))) {
return;
}
LPOLESTR dispname = NULL;
pItem->GetDisplayName(SIGDN_FILESYSPATH, &dispname); // *dispname == "C:\Some\Path\File.name"

SetDlgItemText(IDC_PATHBOX, (LPWSTR)dispname);
}
}
8 changes: 4 additions & 4 deletions TilandisGUI/TilandisGUIDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class CTilandisGUIDlg : public CDialogEx
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedRegisterprotocol();
protected:

// Button: "Register Tilandis"
CButton BTN_RegisterProtocol;

public:
afx_msg void OnBnClickedCheck1();
afx_msg void OnBnClickedPathbrowse();
afx_msg void OnBnClickedRegisterprotocol();
};
Binary file modified TilandisGUI/resource.h
Binary file not shown.
118 changes: 118 additions & 0 deletions TilandisLTD/TilandisLTD.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" 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">
<ProjectGuid>{EBE4D2E7-191E-4F7C-BC25-08A3C3384572}</ProjectGuid>
<RootNamespace>TilandisLTD</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</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" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="tilandisltd.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
22 changes: 22 additions & 0 deletions TilandisLTD/TilandisLTD.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -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="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<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="tilandisltd.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
37 changes: 37 additions & 0 deletions TilandisLTD/tilandisltd.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <WinSock2.h>
#include <WS2tcpip.h>

int wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int nShow) {
// initalize sockets
WSADATA wsa;
WSAStartup(MAKEWORD(2, 2), &wsa);

SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);

struct sockaddr_in sai_server;
sai_server.sin_family = AF_INET;
sai_server.sin_port = htons(57175);
sai_server.sin_addr.s_addr = htonl(INADDR_LOOPBACK);

if (bind(sock, (struct sockaddr *) sai_server, sizeof(sai_server))
< 0) {
MessageBox(NULL, L"bind fail", L"bind fail", MB_ICONERROR);
return 1;
}

char buffer[512];

struct sockaddr_in sai_from;
int i_fromlen;

while (true) {
int recvlen = recvfrom(sock, buffer, 512, 0, (struct sockaddr*) &sai_from, &i_fromlen);
if (recvlen < 0) {
MessageBox(NULL, L"recvfrom fail", L"recvfrom fail", MB_ICONERROR);
return 1;
}
else if (recvlen > 0) {

}
}
}
8 changes: 8 additions & 0 deletions TilandisUWP/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application
x:Class="TilandisUWP.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TilandisUWP"
RequestedTheme="Light">

</Application>
Loading

0 comments on commit a92d734

Please sign in to comment.