取消
显示结果 
搜索替代 
您的意思是: 

Closing Microsoft edge using LabVIEW program

已解决!
转到解答

I need a program that can close Microsoft Edge without terminating the task (Killing of task using command).

 

The program should gracefully close the application when run. If anyone has an idea on how to achieve this, please share. A hardcoded example would be appreciated.

 

I'm including a link from NI for closing applications, but it didn't work for me.

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YIRICA4&l=en-IN

0 项奖励
1 条消息(共 12 条)
2,624 次查看

Test your code work on another program (i.e. Calculator).  Edge is problematic.  Turns out Microsoft Edge has an invisible character in the name.  You'll need to use a different method to get a window handle. There is a function called EnumWindows that should return a list of handles.  I'm not sure how to set it up.

 

For reference on the invisible character:

https://stackoverflow.com/questions/34927143/find-microsoft-edge-using-findwindow-api

 

aputman
0 项奖励
2 条消息(共 12 条)
2,599 次查看
解答
接受人 Alwin_Capsys

Here is a link to a post about how to grab a list of windows and their associated handles. 

With Edge running, I ran it on my machine, and you can see the invisible character.

You'll just need to search the "Windows" array for 'Edge' and return the corresponding value from "Handles" array and feed this into the Send Message API call.

aputman_0-1721851153324.png

 

aputman
3 条消息(共 12 条)
2,593 次查看

With this, how the application can be built? If you don't mind, can you share the program which made using this? 

0 项奖励
4 条消息(共 12 条)
2,530 次查看

The code in the linked post is a snippet.  It can be dragged directly into a blank VI and the code will auto-populate. 

aputman
0 项奖励
5 条消息(共 12 条)
2,525 次查看

Hi,

Once i get its handle number, how to add that to SendMessage API. Is this the way to add (below attached snippet)? Sorry, I am not familiar with calling API's. Is it possible to integrate the full and send for closing Microsoft Edge?

下载全部
0 项奖励
6 条消息(共 12 条)
2,509 次查看

Sorry, I do not know how to do it either.  I could probably figure it out but that is your job.  😉

I'm only referencing the articles mentioned above and offering suggestions. 

 

I would search for 'Edge', not the blank character. 

Does the Application Index array return the proper values associated with Edge?

If so, use those values to index the Handles array and pass that to the SendMessage API call.  You're not using the actual handle but rather the index value into the array of handles. 

aputman
0 项奖励
7 条消息(共 12 条)
2,503 次查看

Yaa. Sorry. It was a mistake from my side. In curiosity I indexed like that. Later I connected properly, but the result was same.

Alwin_Capsys_0-1721924100793.png

 

0 项奖励
8 条消息(共 12 条)
2,499 次查看

There are four parameters on SendMessage.  You're missing the one with the actual message (16 in decimal format or 10 in hex) 

aputman
0 项奖励
9 条消息(共 12 条)
2,495 次查看

I have configured 4 parameters. But I am not getting a 4 node function API as like the picture they have shown. I don't know why it is.

Alwin_Capsys_0-1721925248709.png

 

0 项奖励
10 条消息(共 12 条)
2,484 次查看