?
Solved

LibraryImport() only works for datawindows?

Posted on 2003-02-25
8
Medium Priority
?
1,243 Views
Last Modified: 2013-12-26
Hi All,
I would like to use the LibraryExport and LibraryImport functions in a program to move objects from one PBL file to another, but Power Builder 6.5 help says that the LibraryImport function only works for datawindows.
Any ideas?
0
Comment
Question by:PBMister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 4

Expert Comment

by:Bhatti
ID: 8024154
Did you try with LibraryExport() to get the syntax and type of the object and then this syntax in LibraryImport().

OR you just read the Help. Please try it first with the LibraryExport() with type of object you want and then LibraryIMport().

Best regards

Bhatti
0
 
LVL 5

Expert Comment

by:buasuwan
ID: 8024803
Hi, PBMister.
  LibraryImport is for datawindow syntax. You need ORCA API(may be in PBORC60.DLL) to do import/export all PB objects.

more informations are here.
http://www.topwizprogramming.com/index.html

and you can download a free eval copy here.
http://www.topwizprogramming.com/index.html


0
 
LVL 5

Expert Comment

by:buasuwan
ID: 8024840
sorry for above links. you have to buy that dll before accessing all import/export functions.

please let me know if don't want to buy that program.
i will develop those API for you.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Accepted Solution

by:
buasuwan earned 700 total points
ID: 8027327
Ok, I found the solution in using ORCA API with PB.

you have to use PB6 DLL named 'PBORC60.DLL'(PB7->PBORC70.DLL,...)

here are External Functions to be used.

Function long SessionOpen () Library "PBORC60.DLL" Alias for "PBORCA_SessionOpen"
Subroutine SessionClose ( long hORCASession ) Library "PBORC60.DLL" Alias for "PBORCA_SessionClose"
Function int SessionSetLibraryList ( long hORCASession, ref string pLibNames[], int iNumberOfLibs) Library "PBORC60.DLL" Alias for "PBORCA_SessionSetLibraryList"
Function int SessionSetCurrentAppl ( long hORCASession, string lpszApplLibName, string lpszApplName ) Library "PBORC60.DLL" Alias for "PBORCA_SessionSetCurrentAppl"
Function int LibraryEntryExport ( long hORCASession, string lpszLibraryName, string lpszEntryName, long otEntryType, ref string lpszExportBuffer, long lExportBufferSize ) Library "PBORC60.DLL" Alias for "PBORCA_LibraryEntryExport"
Function int CompileEntryImport ( long hORCASession, string lpszLibraryName, string lpszEntryName, long otEntryType, string lpszComments, string lpszEntrySyntax, long lEntrySyntaxBuffSize, long pCompErrorProc, long pUserData ) Library "PBORC60.DLL" Alias for "PBORCA_CompileEntryImport"


and you need to know some constant to use with 2 functions
(CompileEntryImport, LibraryEntryExport)

for the parameter otEntryType, here values to use.

Constant long  PBORCA_APPLICATION = 0
Constant long  PBORCA_DATAWINDOW = 1      
Constant long  PBORCA_FUNCTION = 2      
Constant long  PBORCA_MENU = 3      
Constant long  PBORCA_QUERY = 4      
Constant long  PBORCA_STRUCTURE = 5      
Constant long  PBORCA_USEROBJECT = 6      
Constant long  PBORCA_WINDOW = 7
Constant long  PBORCA_PIPELINE = 8
Constant long  PBORCA_PROJECT = 9
Constant long  PBORCA_PROXYOBJECT = 10
Constant long  PBORCA_BINARY = 11


and error no to match error message after calling those functions.

Constant int PBORCA_OK             = 0 /* Operation successful */
Constant long PBORCA_INVALIDPARMS   = -1             /* Invalid parameter list */
Constant long PBORCA_DUPOPERATION   = -2             /* Duplicate operation */    
Constant long PBORCA_OBJNOTFOUND    = -3             /* Object not found */
Constant long PBORCA_BADLIBRARY     = -4             /* Bad library name */
Constant long PBORCA_LIBLISTNOTSET  = -5             /* Library list not set */
Constant long PBORCA_LIBNOTINLIST   = -6             /* Library not in lib list */
Constant long PBORCA_LIBIOERROR     = -7             /* Library I/O error */          
Constant long PBORCA_OBJEXISTS      = -8             /* Object exists */          
Constant long PBORCA_INVALIDNAME    = -9             /* Invalid name */          
Constant long PBORCA_BUFFERTOOSMALL = -10            /* Buffer size is too small */          
Constant long PBORCA_COMPERROR      = -11            /* Compile error */
Constant long PBORCA_LINKERROR      = -12            /* Link error */
Constant long PBORCA_CURRAPPLNOTSET = -13            /* Current appl not set */
Constant long PBORCA_OBJHASNOANCS   = -14            /* Object has no ancestors */          
Constant long PBORCA_OBJHASNOREFS   = -15            /* Object has no references */          
Constant long PBORCA_PBDCOUNTERROR  = -16            /* Invalid # of PBD's */          
Constant long PBORCA_PBDCREATERROR  = -17            /* PBD create error */
Constant long PBORCA_CHECKOUTERROR  = -18            /* check out/in error */



and now. here is the sample codes to import window to pbl.
(I already upload my full sample codes at
http://www.mycgiserver.com/~unoksoftgroup/tools/OrcaApi.zip
)

// uo_orcaapi6 is a user object
uo_orcaapi6      orca

long      ll_sid, ll_index

// 1. You need to open session before do anything, ll_sid is session handle
ll_sid = orca.SessionOpen()

string      ls_librarylist[]

// get all library that you have
for ll_index = 1 to dw_library.rowcount()
      ls_librarylist[ll_index] = dw_library.getitemString(ll_index, 1)
next

int      li_result

// 2. Set Library List that you have before Importion
li_result = orca.SessionSetLibraryList (ll_sid, ls_librarylist, upperbound(ls_librarylist))
if li_result = 0 then
      
      // 3. Set Current Application
      li_result = orca.SessionSetCurrentAppl (ll_sid, ls_librarylist[1], "a_orca_test" )
      if li_result = 0 then
            string      ls_syntax
            ls_syntax = mle_syntax.text
            
            string      ls_objectname
            ls_objectname = dw_list.getitemString(dw_list.getrow(), 1)
            
            // 4. Import your object to new PBL
            li_result = orca.CompileEntryImport (ll_sid, ls_librarylist[3], ls_objectname, orca.PBORCA_WINDOW , "comment - new object", ls_syntax, len(ls_syntax), 0, 0 )
      end if
end if
orca.SessionClose(ll_sid)

MessageBox("Result", orca.getErrorMessage(li_result))



0
 

Author Comment

by:PBMister
ID: 8030378
Buasuwan,
This is excellent!
Your example was very helpful, without it I would have had a hard time.  I am impressed.
I looked at your site.  You have certainly fulfilled your "Mission" today.  You made this Power Builder developer be very happy.
Thank you.

I have another question.
What does uNoKSoft mean?
The name sounds like "not ok soft"
but it seems pretty OK to me.
0
 
LVL 5

Expert Comment

by:buasuwan
ID: 8030817
Hi,
 I am afraid that many people outthere and you think 'uNokSoft' means. :)

uNokSoft = UN + OK + Software.


here is correction.

uNokSoft = u(my name, Y(u)thasak) + Nok(my partner's name) + Soft(common word)

so, I will have to post this information in my website,too.

Regards,
Yuthasak Buasuwan.

0
 

Author Comment

by:PBMister
ID: 8038788
Thank you for explaining, I understand now.

If you get tired of explaining that to people here is another idea: SwanSoft

Thanks again.
0
 
LVL 5

Expert Comment

by:buasuwan
ID: 8038945
Thank you, but I see someone use that name already. :)





0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question