Send hifi command line url to other instance

This commit is contained in:
David Rowe 2015-02-05 17:17:31 -08:00
parent ab758648c7
commit 9e34b36839
2 changed files with 16 additions and 0 deletions

View file

@ -166,6 +166,13 @@ public:
if (message->message == WM_SHOWWINDOW) {
Application::getInstance()->getWindow()->showNormal();
}
if (message->message == WM_COPYDATA) {
COPYDATASTRUCT* pcds = (COPYDATASTRUCT*)(message->lParam);
QUrl url = QUrl((const char*)(pcds->lpData));
if (url.isValid() && url.scheme() == HIFI_URL_SCHEME) {
DependencyManager::get<AddressManager>()->handleLookupString(url.toString());
}
}
}
return false;
}

View file

@ -15,6 +15,7 @@
#include <SharedUtil.h>
#include "AddressManager.h"
#include "Application.h"
#ifdef Q_OS_WIN
@ -48,6 +49,14 @@ int main(int argc, const char * argv[]) {
if (otherInstance) {
ShowWindow(otherInstance, SW_RESTORE);
SetForegroundWindow(otherInstance);
QUrl url = QUrl(argv[1]);
if (url.isValid() && url.scheme() == HIFI_URL_SCHEME) {
COPYDATASTRUCT cds;
cds.cbData = strlen(argv[1]) + 1;
cds.lpData = (PVOID)argv[1];
SendMessage(otherInstance, WM_COPYDATA, 0, (LPARAM)&cds);
}
}
return 0;
}