Win32 API GetTopWindow() - how to call it

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 322
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Win32 API GetTopWindow() - how to call it

Postby Widgets » Thu May 17, 2018 9:43 pm

In my current app, I want to get the current top window in general, not the top window of my app.

When I tried to use the Win32 function GetTopWindow(), I get the wrong function returning wxWindow * instead of HWND, because wxApp also has a function with the exact same name and it takes precedence.
Running under Win 10 & MSVC 2015, wxWidgets 3.1
Environment: Win 10 64-bit & Ubuntu 16.04
MSVC Express 2010 & 2015
wxWidgets 3.1
Fight SPAM - report it with wxSR

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 252
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Win32 API GetTopWindow() - how to call it

Postby New Pagodi » Thu May 17, 2018 10:21 pm

You probably just need to use the scope operator. ie use ::GetTopWindow() to call the global function instead of class method with the same name.

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 322
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Win32 API GetTopWindow() - how to call it

Postby Widgets » Fri May 18, 2018 1:42 am

[edit]
After my first cut at my reply, I found the function wxWindow::GetHWND() and it looks like what I think I need, though that is still to be confirmed, but it got me further along the road.

Code: Select all

wxWindow *pWin = GetTopWindow();
HWND hWnd = pWin->GetHandle();

[/edit]
I'm, afraid, that does not do what I need. It compiles and runs, but I would need to transform the returned wxWindow * to HWND - two completely different things
Environment: Win 10 64-bit & Ubuntu 16.04
MSVC Express 2010 & 2015
wxWidgets 3.1
Fight SPAM - report it with wxSR


Return to “Platform Related Issues”

Who is online

Users browsing this forum: No registered users and 3 guests