Jump to content

[SOLVED] get win handle from pid using wmi?


dragan
 Share

Recommended Posts

I'm not very familiar with AutoIt and the wmi thing, but one thing I do know and like to stress is the reliability of using windows services and other preinstalled applicatons, as in if lots of people are going to use it, sometimes it fails under certain conditions, just like InetRead() in the case that a user uninstalled IE, I've had headaches with that :P

If you'd like, take my advice and use the windows API to do these things like what you just said :)

It's not nessasary to use wmi for something you should be using windows oem dlls to do.

Link to comment
Share on other sites

Also, if I'm right, WMI is intended for things like scripting languages that do not support things like calling dll functions the way autoit and other languages can, so I personally think it's better to stay away from it entirely unless developing an appliation that will do network things, like using UPnP to foward a port to your app to act as a server.

Link to comment
Share on other sites

I second FlutterShy,

WMI isn't the best tool to do what you want. Search the forum for Pid and handle and you will some ready made solutions.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thank you for your replies.

Little intro to my project:

I'm making a server for my PC (Autoit based) that will communicate with my Android device (I'm also making android client), and I would like to get a list of all processes and PIDs and win handles sent to my Android device, however, I discovered that listing these things using WinGetProcess and using GetWindowThreadProcessId from user32.dll will result in failure if I have one online game running in the background. So its not usable all the time. Game is protected by GameGuard - maybe that's the problem, however those functions work fine without this game running.

The idea is to click the listed process or PID in Android device (sent by autoit server) and to set that PID's window as the active one, but I can't do that if the functions above gives me failure, that's why I'm asking about WMI.

Link to comment
Share on other sites

Glad you could solve your problem :D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...