Creating Folders in an Application

Creating Folders in an Application

Question:
How do I get my application, developed in PowerBuilder 6.0, to manipulate folders in Windows Explorer? I want it to be able to create folders.

Answer:
PowerBuilder does not have a built-in function to create folders or directories. To achieve this you must use a Windows API call.

The API call in question is CreateDirectoryA. This function requires a structure. In your object, define the following structure:

 type os_securityattributes from structureunsignedlong      ul_lengthstring      ch_descriptionboolean      b_inheritend type

In your object define the following local external function:

 Function boolean CreateDirectoryA (ref string directoryname, &ref os_securityattributes secattr) library "KERNEL32.DLL"

Create a function that accepts the name of the folder you want to create as a string argument called “as_DirectoryName”. Add the following code to that function:

 os_securityattributes   lstr_Securitylstr_Security.ul_Length = 7SetNull(lstr_Security.ch_description)   //use default securitylstr_Security.b_Inherit = FalseIf CreateDirectoryA(as_DirectoryName, lstr_Security) Then   Return 1Else   Return -1End If

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

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing