在pb中调用操作系统得api(操作系统提供的dll文件)
1、 在pb中调用操作系统得api(操作系统提供的dll文件)
This function draws an arc based on the coordinates the function
receives. There is no PowerBuilder equivalent.
FUNCTION boolean Arc(ulong hwnd, long r1, long r2, long r3, long r4, long
a1, long a2, long a3, long a4) LIBRARY "Gdi32.dll" Function ulong GetDC(ulong hwnd) library "user32.dll"
Boolean rtn
ulong l_handle, l_device
long lv[8]
l_handle = handle(w_main) // 'w_main' is the name of the sample window.
l_device = GetDC(l_handle)
lv[ ] = {10,40,300,220,0,0,180,0}
rtn = Arc(l_device, lv[1], lv[2], lv[3], lv[4], lv[5], lv[6], lv[7],
lv[8])
2、 区别
close(parent)
halt
3、 自定义函数及使用
(1) 公用函数的建立
File-,new -,pbobject -,function
(2) 建立函数内容
(3) 调用
Getsum(5,56)
(4) 自定义全局函数的主用
任何对象多可以调用自定义全局函数 (5) 自定义对象函数
只能在本队象中被调用
建立:(1)找到要建立函数的对象(双击)
(2)找到function list选项卡
(3)
getSun(int a,int b)
get(a1,b1)
(6)
4、 建立和使用结构体
(1) 全局的结构体
File-,new ,pb object-,structure, ok
(2) 给结构体赋值
因为要申明的结构体要在两个按钮中多可以使用,因此要申明一个结构体变量为
instace variable(实例变量)
在赋值按钮中写代码
stu.stuId=1
stu.stuName="张三"
stu.stuSex="男"
读值
messagebox("提示","你的名字是"+stu.stuName)
结构体经常用在:两个窗体之间进行传递数据的时候用到
在讲窗体的时候用到
(3) 建立和使用对象结构体
A 双击对象
B 菜单 ---insert---,structure
对象结构体只能在作为局部变量使用,不能作为实例变量
使用方法和全局结构体一样
5、