none
Pinvoke Move/Set Microsoft Edge

    Question

  • Hi,

    In Windows 10 I can use Movewindow on other applications windows and folders with success, however, I have had no luck with moving/resizing an Edge browser. I also tried Setwindow, but again had no joy.

    Has anyone had any success with this? Or could someone offer a reason why I can't get it to work.

    Thanks

    Friday, March 11, 2016 7:27 PM

Answers

  • Have you tried to determine the HWND value (i.e. Window Handle) of Edge for Desktop application using the “Spy++” tool (included in Visual Studio)? In the tree displayed by Spy++, select the top-level Edge window, which is child of Desktop. Then execute a code like this: ‘MoveWindow( new IntPtr( 0x00001234 ), 10, 10, 500, 300, true )’, where 1234 was determined by Spy++.


    • Edited by Viorel_MVP Saturday, March 12, 2016 9:32 AM
    • Marked as answer by Malc63 Wednesday, March 16, 2016 10:54 AM
    Saturday, March 12, 2016 9:31 AM
  • FWIW I tried to use MoveWindow on my machine to move the Edge window and it worked just fine. Have you checked the return from MoveWindow? Does it return true or false?
    • Marked as answer by Malc63 Wednesday, March 16, 2016 10:54 AM
    Monday, March 14, 2016 11:39 AM
  • Looks like the official forum discussion is over here.

    https://stackoverflow.com/questions/tagged/microsoft-edge

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    Monday, March 14, 2016 12:48 PM
    Moderator

All replies

  • This is unlikely to have anything to with .NET/CLR. The most likely cause is that Edge is a Store/UWP app and MoveWindow has no effect on its window for technical or security reasons.
    Friday, March 11, 2016 7:56 PM
  • Hi Mike,

    I'd hoped there was some other known way of approaching this that I hadn't tried.

    I'll try it on some other Store/UWP apps, as I hadn't thought it could be because it wasn't a standard win32 application. I imagine that's probably going to be the reason and it's given me something else to look at.

    Thanks

    M  


    • Edited by Malc63 Friday, March 11, 2016 8:48 PM
    Friday, March 11, 2016 8:32 PM
  • Have you tried to determine the HWND value (i.e. Window Handle) of Edge for Desktop application using the “Spy++” tool (included in Visual Studio)? In the tree displayed by Spy++, select the top-level Edge window, which is child of Desktop. Then execute a code like this: ‘MoveWindow( new IntPtr( 0x00001234 ), 10, 10, 500, 300, true )’, where 1234 was determined by Spy++.


    • Edited by Viorel_MVP Saturday, March 12, 2016 9:32 AM
    • Marked as answer by Malc63 Wednesday, March 16, 2016 10:54 AM
    Saturday, March 12, 2016 9:31 AM
  • Hi Malc,

    Thank you for visiting the MSDN forum. I’m afraid that it is not the correct forum about this issue, since this forum is to discuss with .NET/CLR.I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum. Thanks for your understanding.

    Best regards,

    Kristin



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 14, 2016 6:38 AM
  • I know the post has been moved, but just to say thanks for replying.

    I'd never used Spy++ before, thanks for alerting me to it.

    Unfortunately, that didn't help. I seem to be getting the correct handle, but for some reason the windows will not move.

    M

    Monday, March 14, 2016 9:25 AM
  • FWIW I tried to use MoveWindow on my machine to move the Edge window and it worked just fine. Have you checked the return from MoveWindow? Does it return true or false?
    • Marked as answer by Malc63 Wednesday, March 16, 2016 10:54 AM
    Monday, March 14, 2016 11:39 AM
  • Looks like the official forum discussion is over here.

    https://stackoverflow.com/questions/tagged/microsoft-edge

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    Monday, March 14, 2016 12:48 PM
    Moderator
  • Thanks Mike,

    Once you said you got it working I knew I was doing something wrong... I've got it sorted now.

    M

     

    Wednesday, March 16, 2016 8:48 AM
  • Thanks Dave.
    Wednesday, March 16, 2016 8:49 AM