POWERBUILDER常见问题汇总

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

数据管道


实现数据管道要完成以下几步: 1. 创建Pipeline类型的标准不可视用户对象p_pipe_meter 2. 在Pipeline中创建一数据管道(作为第5步的DataObject) 3. 创建一窗口(带一数据窗口控件PipeError和命令按钮〕 4. 在OPEN事件中创建一p_pipe_meter类型的iu_PipeLine实例变量 5. 设置iu_PipeLine的DataObject特性 6. 连接源数据库和目的数据库 7. 启动数据管道(按钮Clicked事件〕 8. 动态修改进度(数据管道的PipeMeter事件) 9. Cancel事件 10.管道修复 11.提示完成(PipeEnd事件〕 12.断开数据库,Destory用户对象。

string ls_Buffer=Space(255) IF Handle(GetApplication()) <> 0 THEN ////已编译 GetModuleFileNameA(Handle(GetApplication()),ls_Buffer,255) END IF

退出时候直接关闭系统

为方便用户,有时需要在应用程序中增加退出并关闭计算机的功能,其实只要几行代码即可实现。 首先声明API函数: Function long ExitWindowsEx (long uFlags , long dwReserved ) Library "user32" 然后在程序中调用: ExitWindowEx( 1, 0 ) 参数型及说明: uFlags Long,指定下述一个或多个标志(用OR运算符合并到一起) EWX_FORCE 强迫中止没有响应的进程 EWX_LOGOFF 中止进程,然后注销 EWX_SHUTDOWN 关掉系统电源(如果可能的话,ATX电源就可以) EWX_REBOOT 重新引导系统 EWX_SHUTDOWN 关闭系统 dwReserved Long,保留,设为零



数据管道





数据管道主要可以完成以下几个功能: 数据库之间数据的传送 修改表的结构,象主键标,是否可为NULL等 我们在Pipeline画板中创建一个管道对象时,必须说明以下这些参数: Source Connection 源数据库 Destination Connection 目的数据库 Data Source 源表 Table 目的表 Option 管道操 作 其中管道操作方式有: Create: 添加表(表不能存在〕 Replace: 删除再添加表(表可以存在 Refresh: 删除再插入行 Append: 插入行 Update: 更新/插入行 管道对象属性: RowsInError Long 管道中发现的错误的行数 RowsRead Long 管道已读取行数 RowsWritten Long 写入数据库的行数 DataObject String 管道对象名 Syntax String 建立管道对象的语法字符串 管道对象函数: Cancel Integer 中止管道执行 ClassName String 返回用户对象的名称 GetParent PowerObject 返回父对象的名称 PostEvent Boolean 在用户对象的消息队列末增加一个事件 Repair Integer 修正目的数据库 Start Integer 执行管道 TriggerEvent Integer 送一个事件到用户对象并执行事件脚本 TypeOf Object 返回用户对象的类型
将指定的窗口带至窗口列表顶部



在应用程序中有时我们需要用Bringwindowtotop将指定的窗口带至窗口列表 顶部。倘若它部分或全部隐藏于其他窗口下面,则将隐藏的部分完全显示出 来。但是在某些情况下这个函数并不能达到我们想要的效果,倘若某窗口并 非前台应用程序的一部分,那么一旦随同该窗口调用本函数,仍会将窗口带 至它自己那个应用程序的窗口列表顶部。但是,不会同时使那个应用成为前 台应用程序。这意味着在调用了本函数后,窗口仍会保持隐藏状态。那么如 何使应用成为前台应用呢?我们可以使用SetForegroundWindow函数。 例如: FUNCTION long FindWindowA( ulong Winhandle, string wintitle ) Library "user32" FUNCTION ulong SetForegroundWindow(ulong hwnd) LIBRARY "user32.dll" long ll_winhandle ll_winhandle=FindWindowA( 0, "test" ) if ll_winhandle >0 then SetForegroundWindow(ll_winhandle) end if
获得应用程序所在目录




利用API函数 GetModuleFileNameA 即可获得应用程序所在目录,但是该函数在 PB开 发环境中运行时 返回的是PB60.exe所在的目录,在编译后的可执行文件运行时才返回应用程序所在目 录。那么如何 得知程序是在开发环境中运行还是编译后的可执行文件呢?可以根据 Handle(getapplication())的 返回值来判断,等于 0 时程序运行在开发环境中,非 0 则是编译后的可执行文件。 Function uint GetModuleFileNameA(ulong hModule,ref string lpFilename,ulong nSize) Library "kernel32.dll"


Windows风格的About对话框

利用Api函数lAboutA可以显示一个与Windows操作系统风格一致的About对话框。

首先声明如下外部函数: function int ShellAboutA( ulong al_hWnd, string as_szApp, & string as_szOtherStuff, ulong hIcon ) library "shell32" Script如下: ShellAboutA( handle( parent ), "Window Title#more text", & "Still more text", 0 ) 其中: Window Title 窗口标题 more text Still more text 你自己的说明

限制应用程序只运行一次

1.声明外部函数如下: FUNCTION uLong ShowWindow( ulong winhandle, int wincommand ) Library "user32" FUNCTION uLong BringWindowToTop( ulong HWND ) Library "user32" FUNCTION long FindWindowA( ulong Winhandle, string wintitle ) Library "user32" 2. 创建一个窗口'w_test' . 将title 设置为"Test Window". 3. 在application的 Open 事件中加入如下代码: long ll_winhandle ll_winhandle = FindWindowA( 0, "Test Window" ) If ll_winhandle > 0 Then BringWindowToTop( ll_winhandle ) ShowWindow( ll_winhandle , 5 ) Return End If Open( w_test )
POWERBUILDER 常见问题汇总
POWERBUILDER数据类型转换表
MICROSOFT Bool Byte, Char Char* Colorref Double Dword Float Handle Hdc Hfile Hinstance Hwnd Int Long Lparam Lpbyte Lpcwstr Lpcvoid Lpdword Lpfiletime Lpint Lpstr,Lpcstr Lpvoid Lpword Mcierror Pbyte Short Structure Uint Void** Word Wparam PB(16Bit) Boolean Char Ref string Uint Double Uint N/A Uint Uint Uint Uint Uint Int Long Uint Ref Int Ref Blob Ref String Ref Uint Ref Time Ref Int Ref String Ref Structstruct_inst Ref Int Long Ref Int[#] Int Ref Struct struct_inst Uint SUBROUTINE Int Uint PB(32Bit) Boolean Char Ref String Ulong Double Ulong N/A Ulong Ulong Ulong Ulong Ulong Int Long Ulong Ref Long Ref Blob (Unicode use ToUnicode()) Ref String Ref Ulong Ref Time Ref Long Ref String Ref Struct struct_inst Ref Ulong Long Ref Long[#] Int Ref Struct Struct_inst Uint SUBROUTINE Long Ulong
相关文档
最新文档