100% encontró este documento útil (1 voto)
2K vistas27 páginas

Power Builder

El documento describe cómo crear controles de lista en Power Builder para mostrar y transferir elementos entre listas. Se especifican objetos como ListBox y DropDownListBox y botones para agregar, borrar y transferir elementos entre las listas. El script resuelve transferir todos los elementos de una lista a otra mediante un ciclo for y seleccionar y eliminar elementos individuales.
Derechos de autor
© Attribution Non-Commercial (BY-NC)
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd
100% encontró este documento útil (1 voto)
2K vistas27 páginas

Power Builder

El documento describe cómo crear controles de lista en Power Builder para mostrar y transferir elementos entre listas. Se especifican objetos como ListBox y DropDownListBox y botones para agregar, borrar y transferir elementos entre las listas. El script resuelve transferir todos los elementos de una lista a otra mediante un ciclo for y seleccionar y eliminar elementos individuales.
Derechos de autor
© Attribution Non-Commercial (BY-NC)
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd

Power Builder

Power Builder

Exportar e Importar Datawindow Implemente la siguiente Base de datos Universidad

Script Open de la Ventana Dw_data.DataObject="Dw_Alumno" Dw_data.SetTransObject(Sqlca) Dw_data.Retrieve() Script Clicked Para Botn Cb_Exportar string ls_nombre,ls_archivo TRY if getfilesavename("Guardar Archivo",ls_archivo,ls_nombre,"xls","Archivo excel(*.xls),*.xls")= 1 then dw_data.saveas(ls_archivo,excel! ,True) MessageBox ("Mensaje","los datos exportados con exito") else MessageBox ("error","los datos no fueron exportados con exito") dw_data.saveas() end if //dw_data.saveas("[Link]",excel! ,false) //MessageBox ("error","datos exportados con exito") CATCH (runtimeerror msg) MessageBox ("error",[Link]) END TRY // Script Clicked Para Botn Cb_Importar string ls_nombre,ls_archivo TRY GetFileOpenName("Importar (*.CSV),*.CSV") dw_data.ImportFile(ls_archivo) CATCH (runtimeerror msg) MessageBox ("error",[Link]) END TRY //dw_1.ImportFile("[Link]")

de

Desarrollar la Siguiente aplicacin. Objeto Datawindow: Dw_Alumnos Tabla : Alumno Tipo: Grid Control Datawindow: Dw_data Command Button: Cb_Registrar Cb_Importar Cb_Exportar Cb_Guardar Cb_Eliminar

Script En el Evento open de la Aplicacin: // Profile Venta [Link] = "ODBC" [Link] = False [Link] = "Connectstring='DSN=UNiversidad" Connect using SQLCA; If [Link]=0 then open(W_Exportar) else Messagebox ("Error de Conexin",[Link]) Halt end if

archivo",ls_archivo,

ls_nombre,"CSV","Archivos

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Lic. Vladimir Cotaquispe Gutirrez.

Lic. Vladimir Cotaquispe Gutirrez.

Lic. Vladimir Cotaquispe Gutirrez.

Lic. Vladimir Cotaquispe Gutirrez.

Lic. Vladimir Cotaquispe Gutirrez.

Lic. Vladimir Cotaquispe Gutirrez.

Lic. Vladimir Cotaquispe Gutirrez.

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder

Ventas Northwind
Disee la siguiente interfase para realizar ventas con la base de datos Northwind. Al cargar no deber Mostrar Nada en los Datawindow. Al pulsar el los Botn nuevo

Cargaran Respectivos una

Datawindow Registrar Donde

para

Nueva

venta.

tendr que agregar el cliente, la fecha de venta, Luego se activara el botn agregar. Luego en el detalle agregar la cantidad y el producto, el precio deber mostrar automticamente En el detalle se agregar los productos seleccionados. Luego al registrar la venta tendr que almacenarse la boleta, la tabla respectiva y el detalle en la tabla respectiva. Ala vez se deber descontar del stock los productos vendidos.

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder

Power Builder

Formularios Maestro Detalle Objetos Datawindow: Name: Dw_categoria Tabla: Categories Control Datawindow: Name: Dw_producto Tabla : Products Control Datawindow: Dw_2

Declaracin de variables de Instancia

Dw_1

Script Clicked del Dw_1 try Script Open de la Ventana // Cargar Categorias dw_1.settransobject(sqlca) dw_1.retrieve() // Cargar Productos dw_2.settransobject(sqlca) dw_2.retrieve() //llamar el evento Clicked de dw_1 dw_1.triggerevent(clicked!) fila=dw_1.getitemNumber(GetClickedRow(),1) dw_2.setfilter("categoryid="+string(fila)) dw_2.filter() dw_2.setsort("productid asc") dw_2.sort() catch (runtimeerror ex) fila=1 dw_2.setfilter("categoryid="+ string(fila)) dw_2.filter() end try

Script Clicked Para Botn Nuevo long n n=dw_2.rowcount() +1 dw_2.insertrow(n)


Lic. Vladimir Cotaquispe Gutirrez. 1 E.P. DE INGENIERIA DE SISTEMA E INFORMATICA Lic. Vladimir Cotaquispe Gutirrez. 2 E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder

dw_2.scrolltorow(n) dw_2.setfocus() Script Clicked Para Botn Guardar Dw_2.modify([Link]=0) dw_2.setcolumn(5) dw_2.settext(string(fila)) dw_2.accepttext()

if dw_2.update()<>-1 then commit; messagebox("Msg","Datos Guardados Con exito") else rollback; messagebox("Msg","Datos no se Guardaron") end if Dw_2.modify([Link]=1)

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder

Utilizacin del Datawindow

Controles DataWindows (dw_1), como se observa : Objeto DataWindow Control (Caja de Herramientas) El Objeto DataWindow Control se selecciona del listado de objetos que se pueden insertar en una ventana, simplemente haga un clic sobre el siguiente icono. Luego haga un clic en la posicin de la ventana, donde desea poner el DataWindow Control.

Pasos [Link] la BD NORTHWIND en el motor de Base de dato SQL server, para este caso se hace uso del SQL server. Pasos 2.- Conecte la base de datos con Power Builder y configure los parmetros de inicializacin.

Paso [Link] DataWindow)

Disear el (File-New-

Se elige el estilo de Presentacin: (Elegir el Tipo Free)

Lic. Vladimir Cotaquispe Gutirrez.

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET

Power Builder

Modos de trabajo: (Seleccione QUICK Select) El modo de trabajo define como se trabajara con el Origen de Datos. Existen 5 tipos de modos de trabajo.

Al seleccionar Quick SELECT mostrara la siguiente pantalla:

Paso [Link]

Seleccione

la

Tabla

Luego Seleccione los campos de la Tabla como se muestra a continuacin: Luego pulse ok hasta finalizar el asistente.

Lic. Vladimir Cotaquispe Gutirrez.

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET

Power Builder

Edite las etiquetas como se muestra en la imagen.

Proceda a grabar el objeto DataWindow (almacene en la biblioteca creada y asignarle un comentario, (dw_productos) Paso 4.- Se agregar un Control Datawindow En la ventana.

Lic. Vladimir Cotaquispe Gutirrez.

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET

Power Builder

Paso 5.- Haga clic en la propiedad Dataobject de Control Datawindow Para enlazarlo con el objeto datawindow (dw_producto).

Paso 6.- Codificar en la ventana, evento open(), lo siguiente: //enlazar el control con el objeto transaction Dw_1.settransobject(sqlca) //recuperar los registros Dw_1.retrieve()

Lic. Vladimir Cotaquispe Gutirrez.

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET

Power Builder

Controles Avanzados en Datawindow Para agregar Controles en un Datawindows (Controles avanzados)

Paso 1.- Deber entrar a editar el Datawindows.


En la Vista de Diseo Deber seleccionar el Campo que desea modificar el tipo de control a Usar en el dataWindows.

Paso 2.-Luego Seleccionemos el campo Stock en el Datawindow

En la ventana de propiedades busque la ficha EDIT.

Paso 3.- En la Ficha Edit Busque la Propiedad StyleType y despliegue la Lista y seleccione Editmask, Luego en Mask determine la cantidad de caracteres que se ingresaran en el campo, active la Propiedad Spin control.

Lic. Vladimir Cotaquispe Gutirrez.

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET

Power Builder

Paso 4.-Luego Seleccionemos el campo Estado en el Datawindow Paso 5.- En la Ficha Edit Busque la Propiedad StyleType y despliegue la Lista y seleccione RadioButtons, Luego active la propiedad 3 D Look, Columns Across le asigna dos 2, luego en la propiedad Code Table asigna los siguientes valores.

Paso 6.- Para Poder Mostrar la categora de los productos y enlazarlo a al datawindos Producto habr que crear un datawindows tipo grid para la tabla Categories. Proceda a agregar un data Windows. Paso 7.- Se elige el estilo de Presentacin: (Elegir el Tipo Grid). Paso 8.- Seleccione la Tabla Categories Paso 9.- Luego Seleccione los campos de la Tabla como se muestra a continuacin: Paso 10.- Luego pulse ok hasta finalizar el asistente. Paso 11.- Proceda a grabar el objeto DataWindow (almacene en la biblioteca creada y asignarle un comentario, (dw_categoria)

Lic. Vladimir Cotaquispe Gutirrez.

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET

Power Builder

Luego el datawindows muestra la imagen.

quedara

como

Para Mejorar la presentacin del datawindows (dw_categoria), se tendr que eliminar las etiquetas de la cabecera y corres un poco el espacio de la cabecera hasta que quede como la figura, tambin el espacio de cdigo de la categora.

Paso 2.-Luego Seleccionemos el campo Categoria en el Datawindow(dw_producto) Paso 3.- En la Ficha Edit Busque la Propiedad StyleType y despliegue la Lista y seleccione DropdownDW, en la la propiedad Datawindow pulse el botn y seleccione el datawindows(dw_categoria).

Luego defina el Display Column (lo que mostrar al desplegar) en este caso es el Nombre de categora, luego el Data Column (loque almacenara al seleccionar) en este caso es el cdigo de categora. Para finalizar active la propiedad always Show Arrow(para mostrar siempre la flecha).

para que muestre la forma siguiente.

Lic. Vladimir Cotaquispe Gutirrez.

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET

Power Builder

Al concluir se mostrara como la imagen.

Agregue los botones respectivos en el pie de pgina guarde la aplicacin y esta lista para manipularla.

Lic. Vladimir Cotaquispe Gutirrez.

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET Controles de Lista Objeto Listbox: Name: Lb_producto Lb_venta Control DropdownListbox: Name: Ddlb_producto Control CommandButton: else

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET Messagebox("Error","Seleccione un Registro")

lb_venta.additem(lb_producto.selecteditem()) lb_producto.deleteitem(lb_producto.SELECTEDINDEX()) end if Script Clicked Para Botn Pasartodo integer i for i=1 to lb_producto.totalitems()

Name: Cb_agregar Cb_borrar Cb_borrartodo Cb_pasar Cb_regresar Cb_pasartodo Cb_regresartodo

lb_producto.selectitem(i) lb_venta.additem(lb_producto.selecteditem()) next lb_producto.reset() Script Clicked Para Botn Borrar if lb_producto.selectedindex()>0 then lb_producto.deleteitem(lb_producto.selectedindex()) elseif lb_venta.selectedindex()>0 then lb_venta.deleteitem(lb_venta.selectedindex()) elseif lb_producto.selectedindex()<0 or lb_venta.selectedindex()<0 then Messagebox("Error","Seleccione un Registro") end if Script Clicked Para Botn Borrartodo if lb_producto.selectedindex()=-1 and lb_venta.selectedindex()=-1 then Messagebox("Error","seleccione La lista a eliminar") Else

Ventana Sistema de Almacen Script Open de la Ventana ddlb_producto.additem("Fideos") ddlb_producto.additem("Arroz") ddlb_producto.additem("Aceite") ddlb_producto.additem("Harina") ddlb_producto.additem("Azucar") ddlb_producto.additem("Carne") Script Clicked Para Botn agregar lb_producto.additem(ddlb_producto.text) st_n.text=string(lb_producto.totalitems()) Script Clicked Para Botn Pasar if lb_producto.selectedindex()<0 then
Lic. Vladimir Cotaquispe Gutirrez. 1

Lic. Vladimir Cotaquispe Gutirrez.

INSTITUTO SUPERIOR TECNOLOGICO JHALEBET if lb_producto.selectedindex()>=1 then lb_producto.reset() end if if lb_venta.selectedindex()>=1 then lb_venta.Reset() end if end if

Lic. Vladimir Cotaquispe Gutirrez.

Power Builder

Power Builder ulong lParam BringWindowToTop Boolean ulong w_handle [Link]

Llamados A Las Apis De Windows Desde Power Builder Power Builder al igual que otros lenguajes de programacin, provee la capacidad de extender las posibilidades del lenguaje tomando funcionalidades que pertenecen al sistema operativo o controles de terceras partes. Este proceso es lo que se llama API (Application Programming Interface). Algunas personas incluyen DLLs que han realizado en C o C++, para usarlos en Power Builder. Pero los mas comunes llamados son los que se hacen a las API del sistema operativo, para que el programador acceda directamente a funciones que desde power builder tocara desarrollarlas, y el sistema operativo ya las tiene implementadas. Declaracin de funciones externas en PowerBuilder para llamadas a API's de 32bit Para declarar funciones externas en Power Builder se debe indicar el nombre de la funcin, as como los parmetros que recibe y los tipos de datos equivalentes de cada parmetro en Power Builder; adems de la librera DLL que contiene a la funcin a declarar.
FUNCTION <Tipo_Dato_Devuelto_Funcin> <Nombre_Funcin> (<Tipo_Acceso_Parmetro> <Tipo_Dato_Parmetro> <Parmetro>[,...]) LIBRARY <Librera DLL>

Chord

Boolean

Chord(ulong hwnd,long x1,long y1,long x2,long [Link] y2,long r1, long r2, long r3, long r4 REF str_ChooseColor lpcc REF str_choosefont c Ulong h ulong w_handle ulong w_handle Ref string cfrom, ref string cto, boolean flag

ChooseColorA

boolean

[Link]

ChooseFontA CloseHandle CloseHandle CloseWindow

boolean Boolean Boolean Boolean

[Link] [Link] [Link] [Link]

CopyFileA

Boolean

[Link]

Declaracin de funciones externas en PowerBuilders para llamadas a API's de 32bit Funcin Devuelve Librera Ver tambin

CopyMemory

Pb pointer, pb pointer

[Link]

RtlMoveMem ory

Parmetros que recibe Ref string filename, int mode Long hfile Ref string lsfile, long fnmode

CreateCompatibleDC [Link] CreateDirectoryA [Link] CreateMutexA

Ulong

Ulong hDC Ref string ls_newdir, ulong lnull Ulong security,boolean bowner, string lsname Ref string filename ulong hgdiobj ulong w_handle

[Link]

_access

Long

Boolean

[Link]

_lclose

long

Ulong

[Link]

_lopen

long

[Link] DeleteFileA Boolean boolean Boolean [Link] [Link] [Link] c:\windows\ [Link] [Link] Ellipse Boolean ulong hwnd,long x1,long [Link] y1,long x2,long y2 2

Arc

Boolean

ulong hwnd, long r1, long r2, long r3, long r4, [Link] long a1, long a2, long a3, long a4 long freq,long dur ulong hDC, long num, long num, long num, long num, ulong hDC, long num, long num, 1 [Link]

DeleteObject DestroyWindow

Beep

Boolean

DllRegisterServer

Long

BitBlt

Long

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder uint dwReserved, uint uReserved REF String lpszSrc, REF string lpszDest, long cchDest int exitcode nbuf Ulong bufferlen, ref string currentdir

Power Builder

ExitWindowsEx

boolean

[Link] GetCurrentDirectoryA ulong [Link] GetCurrentThread [Link] GetCursor Ulong Ulong

[Link]

ExpandEnvironmentSt Long ringsA

[Link] [Link] ref mousepos mousepos2 Ulong hwnd

FatalExit

FileTimeToLocalFileTi boolean me

Filetimetolocalfiletime(r ef str_filedatetime [Link] lpfiletime,ref str_filedatetime lplocalfiletime) Str_filedatetime lpt, ref [Link] str_systemtime sts

GetCursorPos

Boolean

[Link]

GetDC

Ulong

[Link]

FileTimeToSystemTim boolean e FindClose boolean

GetDiskFreeSpaceA Long handle Ref string filename, ref str_filedata filedata Long handle, ref str_filedata filedata [Link]

boolean

Ref string as_dir, ref long al_sectorspercluster, ref [Link] long al_bytespersector, ref long al_freeclusters, ref long al_totalclusters Ref string as_dir, ref str_ularge_long ast_userfreebytes, ref str_ularge_long ast_totalbytes, ref str_ularge_long ast_totalfreebytes

FindFirstFileA

Long

[Link]

FindNextFileA

Boolean

[Link]

GetDiskFreeSpaceExA boolean

[Link]

FindWindowA FreeLibrary FreeLibrary

Ulong

Ref string c, ref string t [Link] Ulong h ulong libhandle ulong hConnect, ref string lpszExisting, ref string lpszNew ulong hwnd [Link] [Link] GetFileTime boolean

FtpRenameFile

boolean

[Link]

Long hfile, ref str_filedatetime lpcreate, ref [Link] str_filedatetime lpaccess, ref str_filedatetime lpwrite Ref string lpfilename, ref ulong lpdwhandle, ulong dwlen, ref string lpdata Ref string lpfilename, ref ulong lpdwhandle

GetBkColor GetCapture

Ulong Ulong

[Link] GetFileVersionInfoA [Link] Boolean

[Link]

GetClassNameA

Long

ulong hwnd, ref string cname, int buf

[Link]

GetFileVersionInfoSiz Ulong eA GetKeyboardState Boolean

[Link]

GetComputerNameA

Boolean

GetComputerNameA(ref [Link] string cname,ref long

ref integer kbarray[256] [Link]

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder GetKeyState GetLastError GetMenu Integer Long ulong Ulong w Long al_vk [Link] [Link] GetThreadPriority [Link] GetUserDefaultLangID Integer GetMenuStringA long Ulong h, ulong i, ref [Link] string s, long m, ulong f Ref str_minmaxinfo d, long s, long l long string modname ulong hModule, ref string lpFilename, long nSize ulong hgdiobj, int cbBuffer, ref s_bitmap bm ulong hwnd ulong hwnd, long xpos, long ypos string lpszLongPath, REF string lpszShortPath, integer cchBuffer Ulong w, long p RtlMoveMem ory ref string uname, ref ulong slength [Link] Integer ulong hthread [Link] GetTextExtentPoint32 boolean A ( Ulong h, string s, long [Link] l, ref str_point st

Power Builder

GetUserNameA

boolean

[Link]

GetMinMaxInfo

[Link]

GetModuleHandleA

Kernel32dll

GetModuleFileNameA long

[Link] GetVolumeInformatio boolean nA [Link] GetObjectA

GetObjectBitmap

Ulong

GetParent

Ulong

[Link]

Ref string lprootpathname,ref string lpvolumenamebuffer,lon g nvolumenamesize,ref uint lpvolumeserialnumber[2 ], ref long [Link] lpmaximumcomponentle ngth, ref long lpfilesystemflags,ref string lpfilesystemnamebuffer, long nfilesystemnamesize ulong hwnd, uint fuRel ref string wdir, ulong buf ulong uFlags, long dwBytes ulong hMem ulong hMem Ref str_memorystatus lpbuffer [Link]

GetPixel

Ulong

[Link]

GetWindow

ulong

GetShortPathNameA

integer

[Link]

GetWindowsDirectory Ulong A

[Link]

GlobalAlloc GetSubMenu Ulong [Link] GlobalFree GetSystemMenu boolean ulong mhandle, boolean [Link] flag Integer indexnum ref systemtime systimeptr long nBufferLength, ref string lpBuffer [Link] GlobalMemoryStatus GetSystemTime [Link] GlobalUnlock GlobalLock

ulong

[Link]

ulong ulong

[Link] [Link]

GetSystemMetrics

Integer

[Link]

ulong

ulong hMem ulong hwnd,long wx, long wy

[Link]

GetTempPathA

long

[Link]

LineTo

boolean

[Link]

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder ulong hints, ref string lpszName, UINT uType, [Link] int cxDesired,int cyDesired,UINT fuLoad String modname [Link] RasEnumConnections long A hwnd, ref ulong hConn string p, string e, string [Link] n, ref str_rasdialdlg s ref str_RasConn lprasconn[], ref long lpcb, ref long i

Power Builder

LoadImageA

Ulong

RasDialDlgA

Boolean

LoadLibraryA

ulong

[Link]

MciSendStringA

long

string cmd, REF string [Link] rtn, long size, long wnd ulong hwnd, ref string text, ref string title, ulong style ulong dwflag,ulong dx,ulong dy,ulong cbutton,ulong dwextra Ref string fromfile, ref string tofile ulong hwnd,long wx, long wy,ref prepos prepos2 ulong whand,int wx,int wy,int ww,int wh,boolean wflag

MessageBoxA

long

[Link]

RasEnumEntriesA

long

RasEnumEntriesA(string r, string p, ref [Link] str_rasentryname e[], ref long lsize, ref long lentries ulong hConn, ref str_Rasstatus rs

Mouse_Event

[Link]

RasGetConnectStatus Ulong A

[Link]

MoveFileA

Boolean

[Link]

RasGetEntryDialPara msA

Long

ref string lpszPhonebook, ref [Link] str_RasDialParms rdp, ref boolean lbfPassword uint l, ref string s, long c [Link] ulong hConn [Link]

MoveToEx

Boolean

[Link] RasGetErrorStringA RasHangUpA [Link] Rectangle boolean ulong hwnd,long x1,long [Link] y1,long x2,long y2 Long Ulong

MoveWindow

boolean

Pie

boolean

ulong hwnd,long x1,long y1,long x2,long y2,long [Link] x3,long y3,long x4,long y4 hdc, ref struct poly poly2, int cnt ulong hwndle,UINT wmsg,ulong wParam,ulong lParam ref str_RasDialExtensions lstrExt, string phonebook, ref str_Rasdialparms rdp, long notifier, ulong 7

RegisterWindowMessa Ulong geA ReleaseCapture Boolean boolean

String lpsz

[Link]

[Link] Ulong h, ulong p, ulong f [Link] ulong hwndle,UINT wmsg,ulong wParam,ulong lParam ulong hDC, ulong hGDIObj Ulong a DeleteMenu

Polygon

Boolean

[Link] RemoveMenu

PostMessageA

Boolean

[Link]

SendMessageA

Long

[Link]

SelectObject [Link] SetCapture

ulong

[Link]

RasDialA

Ulong

Ulong

[Link]

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder SetComputerNameA Boolean ref string cname Ref string cdir int cx, int cy long objhandle boolean [Link] [Link] [Link] [Link]

Power Builder

SetCurrentDirectoryA Boolean SetCursorPos SetFocus SetKeyboardState Boolean

Ejemplo: En el script de una ventana la cual va utilizar la funcin de un DLL existente. Elegimos Declare y seguidamente elegimos Local External Functions. Luego

ref integer kbarray[256] [Link] Long d, str_minmaxinfo [Link] s, long l ulong hwnd, long xpos, long ypos, ulong pcol ulong hthread, int npriority RtlMoveMem ory

FUNCTION integer SQLAllocEnv(ref long henv) LIBRARY "[Link]"

SetMinMaxInfo

Usando API Aqu se ha puesto una serie de llamadas a API's de 32 bits. en general se ha puesto sin explicacin, puesto creo que no las necesitan. Estos ejemplos se obtuvieron de la pgina web: [Link] y se ha traducido al castellano. Ejemplo: Llamadas a API's del entorno de Windows

SetPixel

Ulong

[Link]

SetThreadPriority

Boolean

[Link]

SHBrowseForFolder

Long

Ref str_browseinfo lpbi [Link] Ulong pidl, ref string pszbuffer ulong hWind, int nCmdShow Long m

SHGetPathFromIDList Boolean

[Link]

//Nombre de Equipos
ShowWindow [Link]

function long GetComputerNameA(ref string equipo, ref ulong areatrabajo)library "[Link]" alias for "GetComputerNameA;Ansi" long ll_valor

Sleep sndPlaySoundA SwapMouseButton boolean Boolean

[Link]

String wavfile, uint flag [Link]

string ls_equipo , ls_usuario


boolean var [Link]

ulong lul_at1=20
VerQueryValueA Boolean Ref string lpblock, string [Link] lpsubblock, ref long lpbuffer, ref uint pulen [Link]

//nombre equipo ls_equipo=space(lul_at1)

waveOutGetNumDevs Ulong

ll_valor=GetComputerNameA(ls_equipo,lul_at1)
WinExec uint ref string filename, uint [Link] wstyle

st_1.text=ls_equipo

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Lic. Vladimir Cotaquispe Gutirrez.

10

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder

function long GetUserNameA(ref string usuario, ref ulong areatrabajo)library "[Link]" alias for "GetUserNameA;Ansi" // usuario ulong lul_at2=20 ls_usuario=space(lul_at2) ll_valor=GetUserNameA(ls_usuario,lul_at2) st_2.text=ls_usuario //buscador de fichero FUNCTION long SearchTreeForFile(String RootPath ,String InputPathName,ref String OutputPathBuffer) LIBRARY "[Link]" alias for "SearchTreeForFile;Ansi" CONSTANT long MAX_PATH = 260 string tempStr,ls_buscar,ls_unidad long Ret ls_buscar=sle_buscar.text ls_unidad=sle_unidad.text tempStr = space(MAX_PATH) //'retorna 1 si lo encuentra, 0 si falla en la busqueda Ret = SearchTreeForFile(ls_unidad,ls_buscar,tempStr) if ret=1 then st_ruta.text = tempStr //muestra el path else messagebox("Error...","El fichero no encontrado.") end if

Lic. Vladimir Cotaquispe Gutirrez.

11

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder

Power Builder

Conectarse a SQL Server desde PowerBuilder 10 PowerBuilder desde la versin 10 ya no tiene la opcin de configuracin de drivers nativos (MSS Microsoft SQL Server) en el DBProfile. Ahora para conectarse "Nativamente" debe utilizar [Link], JDBC, o OLE DB. O si lo prefiere por el tradicional ODBC con sus limitantes de rendimiento conocidas. A continuacin le mostramos la manera de conectarse: "Nativamente" por OLE DB a SQL Server. Abra el Database Profiles: All seleccione OLE Microsoft OLE DB y haga click en Nuevo: Luego seleccione en la pestaa conexin: Profile Name Provider DataSource User ID Password Extended --> nombre de la conexin --> SQLOLEDB --> Nombre del Servidor de Base de datos (nombre o IP) --> Nombre del usuario de la base de datos --> Clave del Usuario de la base de datos --> Aqui se define la base de datos asi : Database=NOMBRE_DE_LA_BASE_DE_DATOS // Profile Coneccion [Link] = "OLE DB" [Link] = "sa" [Link] = False [Link] = "PROVIDER='SQLOLEDB',DATASOURCE='.',PROVIDERSTRING='Database=Northwind'" Connect using SQLCA; If [Link]=0 then open(W_Buscar) else Messagebox ("Error de Conexin",[Link]) Halt end if Nos pasamos a la ficha PREVIEW, Probamos la conexin y si es satisfactoria. Copiamos la lnea de conexin. Normalmente el objeto transaccin (transaction) se configura y se conecta cuando se inicia la aplicacin, es decir en el open de la aplicacin. Para hacer esto abra el objeto aplicacin (file/open/aplication) en el evento open donde est el cdigo de abrir la ventana inicial, borrelo y remplace por este cdigo:

Para conectarse desde el PowerScript use la siguiente sintaxis:

Tradicional ODBC con sus limitantes de rendimiento Por ODBC. Si deseas utilizar la seguridad integrada de Windows. En la Pestaa Security: Persist Security Info: (activar la casilla) Integrated: SSPI (digitar en la caja de texto) Pasos 1.- La BD NORTHWIND se encuentra de forma predeterminada en el motor de Base de dato SQL server, para este caso se hace uso del SQL server. Pasos 2.- Acceder al panel de control \ Herramientas administrativas \ ODBC \ USUARIO. Click en el Botn Agregar.
Lic. Vladimir Cotaquispe Gutirrez.

DSN

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Power Builder

Power Builder

Seleccionamos el origen de Datos SQL Server

Agregamos una nueva conexin NEW PROFILE.

Activamos las Opciones: Con la autentificacin de Windows NT, mediante el ID de autentificacin de Red. Luego establecer la Base de datos Northwind.

Nos pasamos a la ficha PREVIEW, Probamos la conexin y si es satisfactoria. Copiamos la lnea de conexin. Normalmente el objeto transaccin (transaction) se configura y se conecta cuando se inicia la aplicacin, es decir en el open de la aplicacin. Para hacer esto abra el objeto aplicacin (file/open/aplication) en el evento open donde est el cdigo de abrir la ventana inicial, borrelo y remplace por este cdigo:

Luego en adelante pulsar siguiente, probar la conexin de Base de datos y luego aceptar. Para conectarse desde el PowerScript use la siguiente sintaxis: Pasos 3.- Desde PowerBuilder 10 el Entorno del // Profile Venta [Link] = "ODBC" [Link] = False [Link] = "Connectstring='DSN=venta" Connect using SQLCA; If [Link]=0 then open(W_Buscar) else Messagebox ("Error de Conexin",[Link]) Halt end if

Ventana DATABASE. Luego obtenemos las siguientes vistas

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

Lic. Vladimir Cotaquispe Gutirrez.

E.P. DE INGENIERIA DE SISTEMA E INFORMATICA

También podría gustarte