You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
Hello guys,
I am trying to assign to electron's current main window if I open MessageBox.Show(wintarget, ....);
My code is EdgeTest.Startup.cs:
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace EdgeTest
{
public class Startup
{
public async Task Invoke(dynamic input)
{
var payload = (IDictionary<string, object>)input;
var winTarget = (IWin32Window)payload["winTarget"];
return await TargetWin(winTarget);
}
private async Task<object> TargetWin(IWin32Window ownedWin)
{
MessageBox.Show(
ownedWin,
"Hello it is an example message!",
"From NodeJS",
MessageBoxButtons.OK,
MessageBoxIcon.Information
);
return null;
}
}
}
And I add function link to open MessageBox while BrowserWindow of electron still opened.
Before I have created MessageBox without owner of current window. It works fine. But I wish MessageBox should "embed" to BrowserWindow of electron with edge.JS
<title>Hello World!</title>
Hello World!
We are using Node.js <script>document.write(process.versions.node)</script>,
Chromium <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
link text
<script>
const {spawn} = require('child_process');
const {app, BrowserWindow} = require('electron');
var edge = require('electron-edge');
function MyFunction(){
var messagebox = edge.func('EdgeTest.dll'); // My dll was compiled by VS 2017 Community
let win = new BrowserWindow(this); // I don't know if it is current window of electron application
var input = {winTarget : win};
messagebox(input, function (error, result) {
if (error) throw error;
console.log(result);
});
}
</script
<script>
// You can also require other files to run in this process
require('./renderer.js')
</script>
But it doesn't show messagebox because it doesn't recognize if it gets wrong or wrong owner of window?
How do I fix? Or Is it bugged? If you try without targetwin and Use "IWin32Window owner; and MessageBox.Show(owner, ....);
than "var messagebox = edge.func( "Javascript", .... ) than it works fine but problem with owner of current window. Sorry for bad English.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello guys,
I am trying to assign to electron's current main window if I open MessageBox.Show(wintarget, ....);
My code is EdgeTest.Startup.cs:
The text was updated successfully, but these errors were encountered: