当前位置:网站首页>Pb extended DLL development (super chapter) (VII)
Pb extended DLL development (super chapter) (VII)
2022-07-04 18:44:00 【lxbin2003】
PB An extension of DLL Development ( Super )( 7、 ... and )
(PB The first open development technology in history )
Object instantiation and destruction
Suppose there is PB This is the code :
uo_json js
js = create uo_json
DLL The code that implements the same function in is :
OB_INST_ID obInstID = NULL;
if (rt_create_obinst(obThis, (LPTSTR)_T(“uo_json”), &obInstID) == 1)
{
// Instantiation successful
}
If you want to return the instance to PB
OB_DATA obReturn = {0};
OB_CLASS_HNDL hndl = ob_get_obinst_class_hndl(obThis, obInstID);
OB_CLASS_ID classID = hndl.class_id ; // Get its type
ob_set_data_obinst(&obReturn, obInstID, classID, OB_INSTVAR_FIELD);
if(obInstID == NULL)
ob_set_info_nullval(obReturn .info, TRUE); // If the creation fails , It's a null value , To put NULL Mark , In this way PB In the use isnull() or isvalid() When judging, it will be false
ot_set_return_val(obThis, &obReturn); // Return object instance
Other functions that can instantiate objects are :
ob_create_obinst
ot_create_obinst_with_name
ot_create_obinst_at_lval
ob_create_object
ob_create_object_using
Yes ot_ The beginning and ob_ Initial function ,ot_ The beginning should be runtime Class function , Than ob_ The beginning should be more advanced , It is recommended to use ot_ Initial function .
After an object instance , Return to PB Environmental Science , You can explicitly destroy js, If you don't write destroy Code ,PB It will also automatically Destroy it .
DLL It can be destroyed by itself
ob_destroy_obinst(obThis,obInstID);
it is to be noted that , PB The code doesn't know you DLL Inside has been destroyed , Will continue to destroy , Cause program crash . therefore , You don't usually need to call ob_destroy_obinst This destruction function .
I'm thinking : This destruction leads to a crash , It should be related to the reference count . Only if its reference count is 0 when , Will really destroy . There's a function rtDataCopy Its last parameter indicates whether to increase the reference count . If it is an incoming parameter , We can use rtDataCopy Copy one for your own use , You can use it up ob_destroy_obinst, It won't break down . unfortunately , I can't find where to add this reference count directly . If you know something, please tell me , I can fill this hole .(*(DWORD*)((DWORD)obInstID + 24)) ++; It can increase the count 1, But I dare not use , Still have SDK Functions are more secure to use .
The above is about invisible objects and instantiation and destruction . As for visualization objects , Still PB Drag and drop with the mouse in the design environment ,DLL It is very complicated to implement , I haven't mastered , Not here .
If you are right about system library Interested in relevant development methods , Accessible QQ Group 624409252 Download from the special directory in the sharing DEMO.
边栏推荐
- 一直以为做报表只能用EXCEL和PPT,直到我看到了这套模板(附模板)
- 2022年DCMM认证全国各地补贴政策汇总
- 【2022年江西省研究生数学建模】水汽过饱和的核化除霾 思路分析及代码实现
- With the stock price plummeting and the market value shrinking, Naixue launched a virtual stock, which was deeply in dispute
- 李迟2022年6月工作生活总结
- ByteDance dev better technology salon was successfully held, and we joined hands with Huatai to share our experience in improving the efficiency of web research and development
- The controversial line of energy replenishment: will fast charging lead to reunification?
- [cloud native] what is the "grid" of service grid?
- ISO27001 certification process and 2022 subsidy policy summary
- 6.26CF模拟赛B:数组缩减题解
猜你喜欢

爬虫初级学习

Unity 制作旋转门 推拉门 柜门 抽屉 点击自动开门效果 开关门自动播放音效 (附带编辑器扩展代码)

被忽视的问题:测试环境配置管理

Mysql5.7 installation tutorial graphic explanation

People in the workplace with a miserable expression

Tutorial on the use of Huawei cloud modelarts (with detailed illustrations)

力扣刷题日记/day7/2022.6.29

删除二叉搜索树中的节点附图详解

Nature microbiology | viral genomes in six deep-sea sediments that can infect Archaea asgardii

Load test practice of pingcode performance test
随机推荐
Detailed explanation of the maturity classification of ITSS operation and maintenance capability | one article clarifies the ITSS certificate
78 year old professor Huake impacts the IPO, and Fengnian capital is expected to reap dozens of times the return
LD_ LIBRARY_ Path environment variable setting
Summary of subsidy policies across the country for dcmm certification in 2022
Numpy 的仿制 2
Open source PostgreSQL extension age for graph database was announced as the top-level project of Apache Software Foundation
Li Kou brush question diary /day5/2022.6.27
力扣刷题日记/day4/6.26
项目通用环境使用说明
学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”
How is the entered query SQL statement executed?
力扣刷题日记/day3/2022.6.25
People in the workplace with a miserable expression
VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
【209】go语言的学习思想
用于图数据库的开源 PostgreSQL 扩展 AGE被宣布为 Apache 软件基金会顶级项目
TCP waves twice, have you seen it? What about four handshakes?
You should know something about ci/cd
I always thought that excel and PPT could only be used for making statements until I saw this set of templates (attached)
How to open an account is safe,