Highlighted
Absent Member.
Absent Member.
1593 views

[archive] Windows Api ActiveX control

[Migrated content. Thread originally posted on 26 September 2003]

I've made an ActiveX control which includes some Windows API Functions (change cursors, check LAN connection, use Run-Format dialog boxes, eject cd's, get drive letters, windows-system-temp directories, computer and user names, total-free disk space and memory etc).

Control's name is "AdamApi", with a class named "Api".
I try to check if it is registered by using declaratives:

working-storage section.
77 API-HANDLE USAGE IS HANDLE OF AdamApi.

procedure division.
DECLARATIVES.
OBJECT-EXCEPTION SECTION.
USE AFTER EXCEPTION ON OBJECT.
CALL "C$SYSTEM" USING "regsvr32 -s \bin\AdamApi.ocx".
OBJ-DECL.
EXIT.
END DECLARATIVES.

Main-Logic.
CREATE @Api OF @AdamApi HANDLE IN API-HANDLE
DESTROY API-HANDLE
.....

The ActiveX control registered normally, but when I use it in my cobol program I get the message "Member not found". If I register it outside the program then it works fine!
If the problem is in the above code and not in my ActiveX, I'll upload it with a demo cobol program.
0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Windows Api ActiveX control

I would suggest that you use absolute paths with your system call to make sure you actually execute the app and it finds your bin directory. E.g.>

call "c$system" using "c:\winnt\system32\regsvr32 c:\bin\adamapi.ocx" CSYS-SHELL.

I am not sure, but I think regsvr32.exe does need to have the shell to execute properly, thus the CSYS-SHELL flag.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Windows Api ActiveX control

I notice that if I omit the "DESTROY API-HANDLE" it seems to work.
In addition, if I register the ActiveX anytime the form is loading it works. I think nothing of the above is right, so I'll use the registry to check if registration is needed.
I'll add more function in the future, if anyone use it and wants something more just ask for it.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Windows Api ActiveX control

The demo cobol program.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Windows Api ActiveX control

Are you able to add FileSearch function to the ActiveX control?

Receive a filename and return the full path and filename. Any help in this would be appreciated.

In ADrives is it possible to find which ones are removable dirves, which are local and which are neworked? I could see a use for regular backups to removable disks like Zip Disks.

SR
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Windows Api ActiveX control

Ok SR, I add a parameter in ADrives to return a particular type of drives (removable, network, cd-roms etc).
According to file search, I add the function, but it returns only the first full path of the file it finds. I want to make it return all paths, if the file exists in more than one directory and to use wildcards. It?s more complicated so it will be done the next days.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Windows Api ActiveX control

A new parameter added to Adrive to return a particular type of drives.

Two new functions:
Search file (search files under a root directory)
Directory tree (returns subdirectories under a root directory)

Six simple controls:
Drive ListBox
Directory ListBox
File ListBox
Slider
Progess Bar
Image

The zip file contains the activex and two demo cobol programs.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Windows Api ActiveX control

Thank you very much for the control.
:cool:
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.