Create a PB window

zhaozj2021-02-16  43

The pop-up position of the window can be roughly set in the position page of the window attribute. However, you don't know how much the client's screen resolution (800 × 600 is still 1024 × 786), it is better to add the following code to the OPEN event:

GetENVIRONMENT (ENV) // Get client environment information

Dy = (Pixelstounits (Env.ScreenHeight, Ypixelstounits!) - this.height) / 2

DX = (Pixelstounits (Env.Screenwidth, Xpixelstounits!) - this.width) / 2

THIS.MOVE (DX, DY)

// ENV is Environment type, DX, DY is long type 3. Use the ActiveX control

VB can directly reference the ActiveX control, and PB can only be referenced by "control nested" methods. This approach requires the OLE container. The following is an animation control as an example to illustrate the reference process and conventions.

When the form is designed, select OLE. In the "Insert Object" dialog box pop-up, select all registered ActiveX controls in the system under Control Type, select "Microsoft Animation Control". References to the properties and methods of the ActiveX control must follow the "OLE control. Object. Property (or method)" rule. The following code will play a video clip by calling the properties and methods of the Animation control:

OLE-1.Object.AutOPlay = TRUE

/ / Set to automatically play OLE 1.Object.Open ("C: / Program Files / Joint / Firework.avi") / / Open an AVI file

If your PB program uses an ActiveX control, it is best to publish the corresponding OCX file with your program and register in the installer because the client does not necessarily register the corresponding control. The registration method is to use Regsvr32. If installshield is used to make an installer, you can also put all the OCX files to be registered in a File Group, and then set it "Self-Registered" to Yes to move registration.

4. Manipulate LOB

Large Objects usually refer to large text and large binary objects, and almost every database supports it. They can be processed with UpdateBlob and SelectBlob statements in PB.

(1) Write large object data to the database with UpdateBlob

When writing management software, the employee's photo (BMP file) and work experience (Doc files) are required to save them in the database, rather than saving their text mpno = '9925'; // Write the image data into the database

IF SQLCA.SQLNROWS> 0 THEN COMMIT;

END IF

Note that FileRead can only read 32K at a time. If the file is more than 32K, it is more read multiple times; UpdateBlob performs successfully or not to determine with SQLCODE or SQLDBCode, and if it is more than 0 to be determined by SQLnROWS.

(2) Read the large object data from the database from the database with selectblob

To view photos or work experiences of our employees, you should read the relevant information from the database. The main code is as follows:

BLOB PIC / / Define the PIC as a Binary Large Object

SelectBlob Photo Into: Pic from Emp Where Empno = '9925'; // Reads image data to the variable Pic

P_1.setPicture (PIC) // Display Images with Image Controls

5. Compile skill

(1) It is not necessary to compile PBL into machine code DLL, ie "Machine Code". That means you have to wait for half an hour. Compiled into a false code PBD. (2) Package the ICO, BMP and other files used in the program to the target code. The method is: Create a resource file extension-called PBR with Notepad, and each line is a file name with full path to tell the compiler to find the resources.

(3) PB

The application must run independently,

Sybase / shared

Several shared libraries are released with your program, they are:

Pbvm60.dll

,

PBODB60.DLL

,

PBDWE60.DLL

. Background

MS SQL Server

Have to bring it on

PBMSS60.DLL

If used

Sybase SQL Anywhere

To bring

Pbo7360.dll

If used

Informix v7.x

To bring

Pbin760.dll

.

转载请注明原文地址:https://www.9cbs.com/read-26080.html

New Post(0)