wfreerdp: add parent window handle parameter

This commit is contained in:
Marc-André Moreau 2013-03-19 13:17:30 -04:00
parent 1123adcadf
commit 21a107015a
3 changed files with 13 additions and 9 deletions

View File

@ -49,7 +49,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
wf_global_init();
wfi = wf_new(hInstance, __argc, __argv);
wfi = wf_new(hInstance, NULL, __argc, __argv);
status = wf_start(wfi);

View File

@ -307,7 +307,7 @@ BOOL wf_post_connect(freerdp* instance)
wfInfo* wfi;
rdpCache* cache;
wfContext* context;
WCHAR win_title[64];
WCHAR lpWindowName[64];
rdpSettings* settings;
settings = instance->settings;
@ -354,20 +354,22 @@ BOOL wf_post_connect(freerdp* instance)
}
if (settings->NSCodec)
{
wfi->nsc_context = nsc_context_new();
}
}
if (settings->WindowTitle != NULL)
_snwprintf(win_title, ARRAYSIZE(win_title), L"%S", settings->WindowTitle);
_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"%S", settings->WindowTitle);
else if (settings->ServerPort == 3389)
_snwprintf(win_title, ARRAYSIZE(win_title), L"FreeRDP: %S", settings->ServerHostname);
_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S", settings->ServerHostname);
else
_snwprintf(win_title, ARRAYSIZE(win_title), L"FreeRDP: %S:%d", settings->ServerHostname, settings->ServerPort);
_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S:%d", settings->ServerHostname, settings->ServerPort);
if (!wfi->hwnd)
{
wfi->hwnd = CreateWindowEx((DWORD) NULL, wfi->wndClassName, win_title,
0, 0, 0, 0, 0, NULL, NULL, wfi->hInstance, NULL);
wfi->hwnd = CreateWindowEx((DWORD) NULL, wfi->wndClassName, lpWindowName,
0, 0, 0, 0, 0, wfi->hWndParent, NULL, wfi->hInstance, NULL);
SetWindowLongPtr(wfi->hwnd, GWLP_USERDATA, (LONG_PTR) wfi);
}
@ -710,7 +712,7 @@ int wf_global_uninit()
return 0;
}
wfInfo* wf_new(HINSTANCE hInstance, int argc, char** argv)
wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv)
{
wfInfo* wfi;
freerdp* instance;
@ -736,6 +738,7 @@ wfInfo* wf_new(HINSTANCE hInstance, int argc, char** argv)
instance->context->argc = argc;
instance->context->argv = argv;
wfi->hWndParent = hWndParent;
wfi->hInstance = hInstance;
wfi->cursor = LoadCursor(NULL, IDC_ARROW);
wfi->icon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1));

View File

@ -80,6 +80,7 @@ struct wf_info
HANDLE keyboardThread;
HICON icon;
HWND hWndParent;
HINSTANCE hInstance;
WNDCLASSEX wndClass;
LPCTSTR wndClassName;
@ -112,7 +113,7 @@ FREERDP_API int wf_global_uninit();
FREERDP_API int wf_start(wfInfo* wfi);
FREERDP_API int wf_stop(wfInfo* wfi);
FREERDP_API wfInfo* wf_new(HINSTANCE hInstance, int argc, char** argv);
FREERDP_API wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv);
FREERDP_API int wf_free(wfInfo* wfi);
#endif