|
SYS-CON.TV Webcasts
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Top Links You Must Click On
Techniques Implementing an Intellisense-like System Using PowerBuilder and the .NET Framework
Making PowerBuilder more productive
By: Tracogna Roberto
Jun. 29, 2005 10:00 AM
Pbintelli is an application that helps PowerBuilder developers write code faster and more accurately.
Overview There are a number of applications that run in background and detect user activity. PBintelli uses a keyboard hook to trap when the user presses a key. Naturally only the actions fired from the PowerBuilder code editor are significant; all others are ignored. The hook is automatically installed when the object is created, but you can stop and start the hook from listening using the appropriate buttons. A hook lets you insert a callback function that intercepts certain Windows messages and lets you respond with some action. The hook is written using C# language (you need a language that supports pointers to functions) and uses the Windows system function SetWindowsHookEx. When a key is pressed in PowerBuilder code editor the background application receives a notification with the key-code pressed and the Window handle that raised the event. The handle is important because it makes it possible to send messages to the code editor Window and obtain information such as the text displayed and the caret position. (See the article entitled "Custom Common Dialogs Using SetWindowsHookEx" from the April issue of PBDJ for more information on creating hooks). The program then parses the text in the script editor and calls a COM object that was written in PowerBuilder. The COM object uses the PowerBuilder Class Definition Object Library functions to analyse the text. To use these functions it's necessary to reference a library list. The COM object determines the library list to use by looking for the last workspace saved in the PB.INI file. The COM object is initialized with the library list every time the current target changes. For example, here's the C# code that PBintelli uses to find the signature of a user function:
PBintelli_90.COClass_PBintelli_90Class obj9; The Function_name is a string containing the name of the function and ls_signature is an output parameter of the string type that receives the signature. There's a wrapper class that manages the different versions of PowerBuilder (there's a different COM object for every supported version of PowerBuilder), if the version changes the class internally uses the correct COM object for that version. The information returned by the COM object is then exposed using an interface written in C#. Reader Feedback: Page 1 of 1
Enterprise Open Source Magazine Latest Stories . . .
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||