How to access the WindowInteropHelper in the System.Windows.Forms.Form

Jul 19 2021 4:11 PM

Hi all,

I have created the access token in the windows c# application. Like the below code,

result = await app.AcquireTokenInteractive(scopes)
                  .WithAccount(firstAccount)
                   .WithParentActivityOrWindow(new WindowInteropHelper(this).Handle) 
                  .WithPrompt(Prompt.SelectAccount)
                  .ExecuteAsync();

In this, the WindowInteropHelper got error because it contains the "System.Windows.window" as parameter. Is there any option to set this WindowInteropHelper in the "System.Windows.Forms.Form" page?

Thanks.


Answers (2)