FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Shell Common Dialogs
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Shell Common Dialogs
Posted: Mon Jul 11, 2011 08:21 AM
http://koti.mbnet.fi/vaultec/files/miscellaneous/undocw95/common.html

comdlg32.prg
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

聽 聽MsgInfo( PickIconDlg() )

return nil

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

BOOL WINAPI PickIconDlg(
聽 聽 聽HWND 聽 聽 hwndOwner, 
聽 聽 聽LPSTR 聽 聽lpstrFile, 
聽 聽 聽DWORD 聽 聽nMaxFile, 
聽 聽 聽LPDWORD 聽lpdwIconIndex );

HB_FUNC( PICKICONDLG )
{
聽 聽DWORD dwIconIndex = 0; 
聽 聽char buffer[ 256 ];
聽 聽
聽 聽memset( buffer, 0, 256 );

聽 聽if( PickIconDlg( ( HWND ) hb_parnl( 1 ), buffer, 256, &dwIconIndex ) )
聽 聽 聽 hb_retnl( dwIconIndex );
} 

#pragma ENDDUMP


regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Shell Common Dialogs
Posted: Mon Jul 11, 2011 08:32 AM
http://www.codeproject.com/KB/shell/runfiledlg.aspx

Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

聽 聽// MsgInfo( PickIconDlg() )

聽 聽RunFileDlg()

return nil

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

BOOL WINAPI PickIconDlg(
聽 聽 聽HWND 聽 聽 hwndOwner, 
聽 聽 聽LPSTR 聽 聽lpstrFile, 
聽 聽 聽DWORD 聽 聽nMaxFile, 
聽 聽 聽LPDWORD 聽lpdwIconIndex );
聽 聽 聽
typedef void WINAPI ( * PRUNFILEDLG ) (
聽 聽 聽HWND 聽 聽hwndOwner, 
聽 聽 聽HICON 聽 hIcon, 
聽 聽 聽LPCSTR 聽lpstrDirectory, 
聽 聽 聽LPCSTR 聽lpstrTitle, 
聽 聽 聽LPCSTR 聽lpstrDescription,
聽 聽 聽UINT 聽 聽uFlags ); 聽 聽 

HB_FUNC( PICKICONDLG )
{
聽 聽DWORD dwIconIndex = 0; 
聽 聽char buffer[ 256 ];
聽 聽
聽 聽memset( buffer, 0, 256 );

聽 聽if( PickIconDlg( ( HWND ) hb_parnl( 1 ), buffer, 256, &dwIconIndex ) )
聽 聽 聽 hb_retnl( dwIconIndex );
} 

HB_FUNC( RUNFILEDLG )
{
聽 聽FARPROC pRunFileDlg = GetProcAddress( GetModuleHandle( "shell32.dll" ), ( LPCSTR ) 61 );
聽 聽PRUNFILEDLG p = ( PRUNFILEDLG ) pRunFileDlg;
聽 聽
聽 聽p( ( HWND ) hb_parnl( 1 ), ( HICON ) hb_parnl( 2 ), hb_parc( 3 ), hb_parc( 4 ), hb_parc( 5 ), hb_parnl( 6 ) );
}
聽 聽
#pragma ENDDUMP


regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 625
Joined: Wed Mar 14, 2007 06:49 PM
Re: Shell Common Dialogs
Posted: Mon Jul 11, 2011 07:12 PM
Hola Maestro Antonio:

Yo hize lo mismo que la funcion PickIconDlg(), algo parecido, pero muy muy rudimentario.



http://forums.fivetechsupport.com/viewtopic.php?f=6&t=8814&p=106798#p106798

Woow. me hubiera esperado unos meses m谩s jejeje, que se necesita para implementarlo..?

Como siempre: Elegante funci贸n..
Soluciones y Dise帽o de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Dise帽ador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
Posts: 625
Joined: Wed Mar 14, 2007 06:49 PM
Re: Shell Common Dialogs
Posted: Mon Jul 11, 2011 08:12 PM
Contnuando y molestando con los dialogos de Windows:

Hay alguna correcci贸n o modo de poder hacer trabajar la funci贸n WNetBrowseDialog()

tengo lo siguiente:

Code (fw): Select all Collapse
#Include "FIVEWIN.CH"

STATIC oWnd

#Define TYPE_DRIVE 聽 1 聽
#Define TYPE_FILE 聽 2 聽
#Define TYPE_PRINTER 聽 3 聽
#Define TYPE_COMM 聽 4 聽
聽
//--------------------------------------------------------------------//
FUNCTION Main()

DEFINE Window oWnd TITLE 聽 聽"Probando la Red Local"
ACTIVATE Window oWnd MAXIMIZED ON INIT MSGInfo(WNetBrowseDialog(oWnd,TYPE_FILE, "Z:\"),"Demo")

Return nil


Siempre retorna "Nil", ya agregue el archivo "netapi32.Prg", y tampoco funciona...

Gracias.
Soluciones y Dise帽o de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Dise帽ador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
Posts: 514
Joined: Sun Oct 16, 2005 03:32 AM
Re: Shell Common Dialogs
Posted: Tue Jul 12, 2011 04:16 AM

Maestro Antonio,

No compila con xHarbour: "Error: Unresolved external 'PickIconDlg' referenced from C:\TRANSI68\PRUEBA1.OBJ
"
Qu茅 cambio debe hacerse para xHarbour ?

Observo desde hace semanas que tus ejemplos est谩n hechos s贸lo para Harbour, por lo que los que usamos s贸lo xHarbour quedamos out. Hay alguna raz贸n ?

Saludos y gracias,

Carlos Gallego

Saludos,



Carlos Gallego



*** FWH-25.12, xHarbour 1.3.1 Build 20241008, Borland C++7.70, PellesC, ADS 11.1***

Posts: 625
Joined: Wed Mar 14, 2007 06:49 PM
Re: Shell Common Dialogs
Posted: Thu Jul 14, 2011 12:40 AM

Perd贸n por la Inistencia :oops: :cry: :oops: :oops:

Pero alguien le funciona bien la funci贸n WNetBrowseDialog(), si fuera posible me explicaran como poder usarla, o explicar porque me retorna "Nil", usando el ejemplo "SAMPLES\TestNet.prg "

Gracias de antemano.. :mrgreen: :cry: :lol:

Soluciones y Dise帽o de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Dise帽ador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
Posts: 817
Joined: Sun Jun 15, 2008 07:47 PM
Re: Shell Common Dialogs
Posted: Thu Jul 14, 2011 06:03 AM

Tal vez la linea:
ACTIVATE Window oWnd MAXIMIZED ON INIT MSGInfo(WNetBrowseDialog(oWnd,TYPE_FILE, "Z:\"),"Demo")
Deber谩s cambiarla a:
ACTIVATE Window oWnd MAXIMIZED ON INIT MSGInfo(WNetBrowseDialog(oWnd:hWnd,TYPE_FILE, "Z:\"),"Demo")


:D:D:D:D

______________________________________________________________________________

Sevilla - Andaluc铆a
Posts: 625
Joined: Wed Mar 14, 2007 06:49 PM
Re: Shell Common Dialogs
Posted: Thu Jul 14, 2011 03:56 PM

Manuel:

Gracias pero ya lo habia probado, y tampoco funciona.. :cry:

Maestro Antonio o Daniel, una ayudita por favor.. :roll: :roll: :cry:

Gracias.. :mrgreen: :mrgreen:

Soluciones y Dise帽o de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Dise帽ador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Shell Common Dialogs
Posted: Thu Jul 14, 2011 05:07 PM

Victor

al parecer es una funcion que se usaba en 16bit, no sabria decir la equivalemte a 32bit

Posts: 625
Joined: Wed Mar 14, 2007 06:49 PM
Re: Shell Common Dialogs
Posted: Fri Jul 15, 2011 12:21 AM
Gracias Daniel por la Info, no tengo a la mano Fivewin para Clipper para comprobarlo y asegurarlo, buscando en la red encontre un codigo en VB6 que hace lo mismo, pero no entiendo y no lo puedo traducirlo a FW, Alguien puede darme una mano:



Code (fw): Select all Collapse
Option Explicit 聽
聽 
'Constantes 聽
Private Const ERROR_SUCCESS As Long = 0 聽
Private Const MAX_PATH As Long = 260 聽
Private Const CSIDL_NETWORK As Long = &H12 聽
Private Const BIF_RETURNONLYFSDIRS As Long = &H1 聽
Private Const BIF_BROWSEFORCOMPUTER As Long = &H1000 聽
聽 
'Estructura BROWSEINFO necesaria para el Api SHBrowseForFolder 聽
聽 
Private Type BROWSEINFO 'BI 聽
聽 聽 hOwner As Long 聽
聽 聽 pidlRoot As Long 聽
聽 聽 pszDisplayName As String 聽
聽 聽 lpszTitle As String 聽
聽 聽 ulFlags As Long 聽
聽 聽 lpfn As Long 聽
聽 聽 lParam As Long 聽
聽 聽 iImage As Long 聽
End Type 聽
聽 
'Declaramos la funci贸n Api SHBrowseForForlder 聽
Private Declare Function SHBrowseForFolder _ 聽
聽 聽 Lib "shell32.dll" _ 聽
聽 聽 Alias "SHBrowseForFolderA" ( _ 聽
聽 聽 聽 聽 lpBrowseInfo As BROWSEINFO) As Long 聽
聽 
'Declaramos la funci贸n Api SHGetSpecialFolderLocation 聽
聽 
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" ( _ 聽
聽 聽 ByVal hwndOwner As Long, _ 聽
聽 聽 ByVal nFolder As Long, _ 聽
聽 聽 pidl As Long) As Long 聽
聽 
聽 
'Funci贸n que devuelve el nombre de la m谩quina 聽
聽 
聽 
Private Function Buscar_Equipo_De_Red() As String 聽
聽 
Dim BI As BROWSEINFO 聽
Dim pidl As Long 聽
Dim sPath As String 聽
Dim pos As Integer 聽
聽 
' Obtener el pidl de la carpeta Entorno de red 聽
If SHGetSpecialFolderLocation(Me.hWnd, CSIDL_NETWORK, pidl) = ERROR_SUCCESS Then 聽
聽 
聽 聽 With BI 聽
聽 聽 聽 聽 .hOwner = Me.hWnd 聽
聽 聽 聽 聽 .pidlRoot = pidl 聽
聽 聽 聽 聽 .pszDisplayName = Space$(MAX_PATH) 聽
聽 聽 聽 聽 .lpszTitle = " Seleccionar el ordenador de la red de la lista :" 聽
聽 聽 聽 聽 .ulFlags = BIF_BROWSEFORCOMPUTER 聽
聽 聽 End With 聽
聽 
聽 聽 ' Esto abre el di谩logo para buscar el equipo de red 聽
聽 聽 If SHBrowseForFolder(BI) <> 0 Then 聽
聽 聽 聽 聽 'retorna el valor a la funci贸n, es decir el nombre del equipo 聽
聽 聽 聽 聽 Buscar_Equipo_De_Red = "\\" & Replace(BI.pszDisplayName, Chr(0), vbNullString) 聽
聽 聽 End If 聽
聽 
End If 聽
End Function 聽
聽 
Private Sub Command1_Click() 聽
聽 聽 ' Llama a la funci贸n que abre el cuadro de di谩logo 聽
聽 聽 Call Buscar_Equipo_De_Red 聽
End Sub 聽
聽 
Private Sub Form_Load() 聽
聽 聽 Command1.Caption = " Buscar equipo de Red " 聽
End Sub


Fuente:
http://www.recursosvisualbasic.com.ar/htm/trucos-codigofuente-visual-basic/3.htm

Gracias.. :-) :-) :-)
Soluciones y Dise帽o de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Dise帽ador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Shell Common Dialogs
Posted: Fri Jul 15, 2011 01:12 AM
Hola

asi es mas facil....
te dejo el codigo

Code (fw): Select all Collapse
#include "fivewin.ch"

#define BIF_RETURNONLYFSDIRS   0x0001  // For finding a folder to start document searching
#define BIF_DONTGOBELOWDOMAIN  0x0002  // For starting the Find Computer
#define BIF_STATUSTEXT         0x0004   // Top of the dialog has 2 lines of text for BROWSEINFO.lpszTitle and one line if
                                        // this flag is set.  Passing the message BFFM_SETSTATUSTEXTA to the hwnd can set the
                                        // rest of the text.  This is not used with BIF_USENEWUI and BROWSEINFO.lpszTitle gets
                                        // all three lines of text.
#define BIF_RETURNFSANCESTORS  0x0008
#define BIF_EDITBOX            0x0010   // Add an editbox to the dialog
#define BIF_VALIDATE           0x0020   // insist on valid result (or CANCEL)

#define BIF_NEWDIALOGSTYLE     0x0040   // Use the new dialog layout with the ability to resize
                                        // Caller needs to call OleInitialize() before using this API

#define BIF_USENEWUI           (BIF_NEWDIALOGSTYLE | BIF_EDITBOX)

#define BIF_BROWSEINCLUDEURLS  0x0080   // Allow URLs to be displayed or entered. (Requires BIF_USENEWUI)
#define BIF_UAHINT             0x0100   // Add a UA hint to the dialog, in place of the edit box. May not be combined with BIF_EDITBOX
#define BIF_NONEWFOLDERBUTTON  0x0200   // Do not add the "New Folder" button to the dialog.  Only applicable with BIF_NEWDIALOGSTYLE.
#define BIF_NOTRANSLATETARGETS 0x0400   // don't traverse target as shortcut

#define BIF_BROWSEFORCOMPUTER  0x1000  // Browsing for Computers.
#define BIF_BROWSEFORPRINTER   0x2000  // Browsing for Printers
#define BIF_BROWSEINCLUDEFILES 0x4000  // Browsing for Everything
#define BIF_SHAREABLE          0x8000  // sharable resources displayed (remote shares, requires BIF_USENEWUI)



function main()

? BrowseFolder( 0, "Probando", BIF_BROWSEFORCOMPUTER )

return nil



#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
#include <shlobj.h>
#include <shtypes.h>

HB_FUNC( BROWSEFOLDER )
{
   
   HWND hWnd = ( HWND ) hb_parnl( 1 );
   ITEMIDLIST * ppidl;
   BROWSEINFO  lpbi;
   char pszDisplayName[MAX_PATH];
   char pszReturn[MAX_PATH];
   
   memset( &lpbi, 0x00, sizeof( BROWSEINFO ) );
   
   if( SHGetSpecialFolderLocation( hWnd, CSIDL_NETWORK, &ppidl ) == S_OK )
   {
      lpbi.hwndOwner   = hWnd;  
      lpbi.pidlRoot = ppidl;  
      lpbi.pszDisplayName = pszDisplayName; 
      lpbi.lpszTitle = hb_parc( 2 );  
      lpbi.ulFlags = hb_parnl( 3 ) ;
      if( SHBrowseForFolder(&lpbi) != 0 )
         strcpy( pszReturn, lpbi.pszDisplayName );
      else
         strcpy( pszReturn, "\0" );
   }
   
   hb_retc( pszReturn );

}


#pragma ENDDUMP
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Shell Common Dialogs
Posted: Fri Jul 15, 2011 01:19 PM
Cgallegoa wrote:Maestro Antonio,

No compila con xHarbour: "Error: Unresolved external 'PickIconDlg' referenced from C:\TRANSI68\PRUEBA1.OBJ
"
Qu茅 cambio debe hacerse para xHarbour ?

Observo desde hace semanas que tus ejemplos est谩n hechos s贸lo para Harbour, por lo que los que usamos s贸lo xHarbour quedamos out. Hay alguna raz贸n ?

Saludos y gracias,

Carlos Gallego


Carlos,

Vamos a revisarlo. La raz贸n de usar Harbour preferentemente es que est谩 mucho m谩s maduro y desarrollado que xHarbour, adem谩s de funcionar perfectamente en multiples versiones y sistemas operativos (32, 64 bits) (Windows, OSX, Linux, Android, iPhone) algo que xHarbour no soporta y que por lo que se ve no hay intenci贸n de implementar.

Nuestro mejor consejo es que los usuarios migren a Harbour y estar谩n muy contentos con el cambio. Seg煤n se ha comentado en varios grupos de desarrollo, parece que xHarbour pueda dejar de desarrollarse. Esto es algo que el propio Patrick Mast me coment贸 por email (no pretendo con esto desvelar conversaciones privadas pero creo que es justo que los usuarios de xHarbour lo sepan).
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 625
Joined: Wed Mar 14, 2007 06:49 PM
Re: Shell Common Dialogs
Posted: Fri Jul 15, 2011 03:41 PM
Daniel:

Gracias por traducir el ejemplo, pero al compilar me da 1 Warning y 1 Error: :-) :-)

Code (fw): Select all Collapse
Z:\PRUEBAS\OBJ\ntbrwdlg.hrb:
Warning W8065 Z:\\PRUEBAS\\ntbrwdlg.prg 55: CALL TO FUNCTION 'IF' WITH no prototype in FUNCTION HB_FUN_BROWSEFOLDER
Error E2379 Z:\\PRUEBAS\\Variable\\ntbrwdlg.prg 56: Statement missing ; in FUNCTION HB_FUN_BROWSEFOLDER
*** 1 errors in Compile ***


Maestro Antonio:

Gracias por la Informaci贸n que pena si en un futuro ya no se siga trabajando y desarrollando este compilador, esperemos que esto no pase por lo menos muy pronto. :-) :-)
Soluciones y Dise帽o de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Dise帽ador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Shell Common Dialogs
Posted: Fri Jul 15, 2011 03:54 PM
Hola

acabo de copiar y pegar y funciona bien

verifica que estes copiando bien el codigo...

te dejo el link de descarga

http://www.sitasoft.net/fivewin/samples/net.zip
Posts: 625
Joined: Wed Mar 14, 2007 06:49 PM
Re: Shell Common Dialogs
Posted: Fri Jul 15, 2011 04:15 PM

Rapida Respuesta Daniel:

Cierto, Funciona, que Flags debo poner para compilar, lo tengo asi para xHarbour: /n /m /es2 /gc1, para BCC32: /c /O2 y para ilink32 /Gn /Tpe, creo que por aqui esta el detalle.

Garcias de nuevo. :P :P

Soluciones y Dise帽o de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Dise帽ador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon