I need to set the foreground window in UWP
In VB I used:
Declare Auto Function FindWindow Lib "USER32.DLL" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Declare Auto Function SetForegroundWindow Lib "USER32.DLL" (ByVal hWnd As IntPtr) As Boolean
SetForegroundWindow(FindWindow("xyz", "abc"))
How can I do it in UWP?
When I used then in UWP it compiles but it does not run, it says:
Severity Code Description Project File Line Suppression State
Warning MCG : warning MCG0007: Unresolved P/Invoke method 'USER32.DLL!FindWindow' for method 'System.IntPtr CaUW.MainPage.FindWindow(System.String, System.String)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs. CameraUW