- fixed home folder. Set to desktop
- getNetworkAdapter() for generating initial FsTrack.kml (Zwischenstand) git-svn-id: http://moon:8086/svn/software/trunk/projects/FsTrack@174 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+56
-7
@@ -7,13 +7,12 @@
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
#include <Shlobj.h>
|
||||
//#include <Knownfolders.h>
|
||||
#include <shlobj.h>
|
||||
#include <iphlpapi.h>
|
||||
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
#include "MainComponent.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
class FsTrackApplication : public JUCEApplication
|
||||
{
|
||||
@@ -24,7 +23,53 @@ public:
|
||||
const String getApplicationName() override { return ProjectInfo::projectName; }
|
||||
const String getApplicationVersion() override { return ProjectInfo::versionString; }
|
||||
bool moreThanOneInstanceAllowed() override { return true; }
|
||||
static void getNetworkAdapters()
|
||||
{
|
||||
PIP_ADAPTER_INFO pAdapterInfo;
|
||||
pAdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(IP_ADAPTER_INFO));
|
||||
ULONG buflen = sizeof(IP_ADAPTER_INFO);
|
||||
|
||||
if(GetAdaptersInfo(pAdapterInfo, &buflen) == ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
free(pAdapterInfo);
|
||||
pAdapterInfo = (IP_ADAPTER_INFO *) malloc(buflen);
|
||||
}
|
||||
|
||||
if(GetAdaptersInfo(pAdapterInfo, &buflen) == NO_ERROR)
|
||||
{
|
||||
PIP_ADAPTER_INFO pAdapter = pAdapterInfo;
|
||||
while (pAdapter)
|
||||
{
|
||||
printf("\tAdapter Name: \t%s\n", pAdapter->AdapterName);
|
||||
printf("\tAdapter Desc: \t%s\n", pAdapter->Description);
|
||||
printf("\tAdapter Addr: \t%ld\n", pAdapter->Address);
|
||||
printf("\tIP Address: \t%s\n", pAdapter->IpAddressList.IpAddress.String);
|
||||
printf("\tIP Mask: \t%s\n", pAdapter->IpAddressList.IpMask.String);
|
||||
printf("\tGateway: \t%s\n", pAdapter->GatewayList.IpAddress.String);
|
||||
if(pAdapter->DhcpEnabled)
|
||||
{
|
||||
printf("\tDHCP Enabled: Yes\n");
|
||||
printf("\t\tDHCP Server: \t%s\n", pAdapter->DhcpServer.IpAddress.String);
|
||||
printf("\tLease Obtained: %ld\n", pAdapter->LeaseObtained);
|
||||
} else {
|
||||
printf("\tDHCP Enabled: No\n");
|
||||
}
|
||||
if(pAdapter->HaveWins)
|
||||
{
|
||||
printf("\tHave Wins: Yes\n");
|
||||
printf("\t\tPrimary Wins Server: \t%s\n", pAdapter->PrimaryWinsServer.IpAddress.String);
|
||||
printf("\t\tSecondary Wins Server: \t%s\n", pAdapter->SecondaryWinsServer.IpAddress.String);
|
||||
} else
|
||||
{
|
||||
printf("\tHave Wins: No\n");
|
||||
}
|
||||
pAdapter = pAdapter->Next;
|
||||
}
|
||||
} else
|
||||
{
|
||||
printf("Call to GetAdaptersInfo failed.\n");
|
||||
}
|
||||
}
|
||||
//==============================================================================
|
||||
void initialise (const String& commandLine) override
|
||||
{
|
||||
@@ -69,10 +114,14 @@ public:
|
||||
Colours::lightgrey,
|
||||
DocumentWindow::allButtons)
|
||||
{
|
||||
PWSTR path;
|
||||
// SHGetKnownFolderPath(FOLDERID_Profile, 0, NULL, &path);
|
||||
|
||||
static String pathStr("C:\\Users\\jens");
|
||||
FsTrackApplication::getNetworkAdapters();
|
||||
|
||||
char path[1024];
|
||||
if (!SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_DESKTOP, nullptr, 0, path)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
static String pathStr(path);
|
||||
setContentOwned (new MainComponent(pathStr), true);
|
||||
|
||||
centreWithSize (getWidth(), getHeight());
|
||||
|
||||
Reference in New Issue
Block a user