External function for checking a process

External function for checking a process

Our Powerbuilder application launches an external program using the RUN command. We use the Timer Event to keep checkingif the process is running by using theKERNAL32 external function GetModuleHandleA.

However, this function isalways returning ZERO, thus our PB app thinksthe program just launched is NOT running.Can I use GetModuleHandleA for a 32-bit app onNT? Am I doing something wrong? What otherway is there for PowerBuilder to see ifanother process is still running?

Under 32-bit Windows, you cannot get a module handle for another process so the method you are using will not work.

A different solution that may solve your problem is to use the FindWindowA function, you can use the same Run command you have now and a similar loop but instead of looking for the Module Handle you can look for the window title.

When you run your process note down the title bar of the window that gets created, then use the FindWindowA function to look for the window, when you can no longer find the window your process will be complete.

The definition for FindWindowA is as follows:

HWND FindWindow( LPCTSTR lpClassName, // pointer to class name LPCTSTR lpWindowName // pointer to window name ); 

If the HWND returned is zero then the window was not found. HWND is a long, LPCTSTR is a string passed by reference. Remember to add the A after the function definition to use the ASCII version of the function. The function is part of the user32.dll package.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes