|
Trouver une ressource
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
SELECTDIRECTORY AVEC UNE CHECKBOXE.
Information sur la source
Description
ce petit code montre comment ajouter une checkbox dans la boite d'ouverture des dossiers "selectDirectory" du genre scruter les sous-dossier afin de permetre à l'utilisateur de choisir entre l'ouverture du dossier sellectioner seulement et ses sous-dossier.
Source
- unit Unit1;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs,ShlObj, ActiveX, CommCtrl, StdCtrls;
-
- type
- TForm1 = class(TForm)
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- private
- { Déclarations privées }
- public
- { Déclarations publiques }
- end;
-
- var
- Form1: TForm1;
- id:integer;
-
- implementation
- {$R *.dfm}
- {MwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMw}
- function NewDlgProc(Wnd:HWND; uMsg:DWORD; wParam:WPARAM; lParam:LPARAM):integer; stdcall;
- begin
- if (uMsg=WM_COMMAND) then
- if (LOWORD(wParam)=id) then
- if (HIWORD(wParam)=BN_CLICKED) then
- begin
- if (IsDlgButtonChecked(Wnd,id)=BST_CHECKED) then MessageBox(Wnd,'Open SubFolders = Yes','',0) else
- MessageBox(Wnd,'Open SubFolders = No','',0)
- end;
- result:=CallWindowProc(Pointer(GetWindowLong(Wnd,GWL_USERDATA)),Wnd,uMsg,wParam,lParam);
- end;
- {*************************************************************************************************}
- function BrowseCallback(Wnd:HWND; uMsg:DWORD; lParam:LPARAM; lpData:LPARAM ):integer; stdcall;
- var
- hwndCheck:HWND;
- begin
- if (uMsg=BFFM_INITIALIZED) then
- begin
- hwndCheck:=CreateWindow('BUTTON','Open SubFolders', BS_AUTOCHECKBOX or WS_CHILD or WS_VISIBLE,10,10,100,20,Wnd,id,hInstance,nil);
- SendMessage(hwndCheck,WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT),1);
- SetWindowLong(Wnd,GWL_USERDATA,SetWindowLong(Wnd, DWL_DLGPROC, Integer(@NewDlgProc)));
- end;
- Result:=0;
- end;
- {MwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMw}
- procedure TForm1.Button1Click(Sender: TObject);
- var
- bi:TBrowseInfo;
- szDir:array[0..MAX_PATH-1] of char;
- pidl:PItemIDList;
- lpMalloc:IMalloc;
- begin
- if SUCCEEDED(SHGetMalloc(lpMalloc)) then
- begin
- ZeroMemory(@bi,sizeof(bi));
- bi.hwndOwner := Handle;
- bi.ulFlags := BIF_RETURNONLYFSDIRS or BIF_EDITBOX;
- bi.lpfn := BrowseCallback;
- pidl := SHBrowseForFolder(bi);
- if (pidl<>nil) then
- begin
- if SHGetPathFromIDList(pidl,szDir) then MessageBox(Handle,szDir,'Picked',0);
- lpMalloc.Free(pidl)
- end;
- end;
- end;
-
- end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,ShlObj, ActiveX, CommCtrl, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
id:integer;
implementation
{$R *.dfm}
{MwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMw}
function NewDlgProc(Wnd:HWND; uMsg:DWORD; wParam:WPARAM; lParam:LPARAM):integer; stdcall;
begin
if (uMsg=WM_COMMAND) then
if (LOWORD(wParam)=id) then
if (HIWORD(wParam)=BN_CLICKED) then
begin
if (IsDlgButtonChecked(Wnd,id)=BST_CHECKED) then MessageBox(Wnd,'Open SubFolders = Yes','',0) else
MessageBox(Wnd,'Open SubFolders = No','',0)
end;
result:=CallWindowProc(Pointer(GetWindowLong(Wnd,GWL_USERDATA)),Wnd,uMsg,wParam,lParam);
end;
{*************************************************************************************************}
function BrowseCallback(Wnd:HWND; uMsg:DWORD; lParam:LPARAM; lpData:LPARAM ):integer; stdcall;
var
hwndCheck:HWND;
begin
if (uMsg=BFFM_INITIALIZED) then
begin
hwndCheck:=CreateWindow('BUTTON','Open SubFolders', BS_AUTOCHECKBOX or WS_CHILD or WS_VISIBLE,10,10,100,20,Wnd,id,hInstance,nil);
SendMessage(hwndCheck,WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT),1);
SetWindowLong(Wnd,GWL_USERDATA,SetWindowLong(Wnd, DWL_DLGPROC, Integer(@NewDlgProc)));
end;
Result:=0;
end;
{MwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMw}
procedure TForm1.Button1Click(Sender: TObject);
var
bi:TBrowseInfo;
szDir:array[0..MAX_PATH-1] of char;
pidl:PItemIDList;
lpMalloc:IMalloc;
begin
if SUCCEEDED(SHGetMalloc(lpMalloc)) then
begin
ZeroMemory(@bi,sizeof(bi));
bi.hwndOwner := Handle;
bi.ulFlags := BIF_RETURNONLYFSDIRS or BIF_EDITBOX;
bi.lpfn := BrowseCallback;
pidl := SHBrowseForFolder(bi);
if (pidl<>nil) then
begin
if SHGetPathFromIDList(pidl,szDir) then MessageBox(Handle,szDir,'Picked',0);
lpMalloc.Free(pidl)
end;
end;
end;
end.
Fichier Zip
Pour les "Membres Club", vous pouvez télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !
Télécharger le zip
Historique
- 28 mai 2007 08:39:27 :
- changement des mots clés.
Sources du même auteur
Sources de la même categorie
Sources en rapport avec celle ci
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
free pascal sous linux [ par arnohoho ]
bonjour tous le monde voila je suis décider à débuter en pascal, avec free pascal pour être plus précis mon probleme est l'i
Compatibilité flottants entre Pascal ss windows et Delphi 5 [ par ducatman07 ]
Salut à tous !Je suis tout nouveau sur ce chat et débutant en DELPHI, et j'aurais un petit problème à vous soumettre.J'ai une application qui tourne s
Copier un fichier dans le presse papier windows??? [ par jmp77 ]
Bonjour,Est ce que quelqu un saurait comment copier un fichier autocad(.dwg) dans le presse papier???Merci et bonne prog,JMP.
ValueListEditor et Registre Windows [ par j_hawk ]
Bonjour,J'ai une petite question,Voici ce que je souhaiterais faire, j'aimerais faire apparaître dans un "ValueListEditor" toutes les clefs et valeurs
Avoir mon propre Systray + Bitmap en fond d'un CoolBar [ par RealSnake ]
Bonjour!Voila j'essaie de faire un prog ki va remplacer le bureau de windows (c explorer.exe ki s'en charge). G donc besoin de récupérer tous les icon
Style XP [ par LeGuepard ]
Salut à tous!J'ai parcouru le forum avant de vous écrire, mais je n'ai pas trouvé la réponse à la question suivante!Comment détecter l'affichage de Wi
Différence d'affichage entre systèmes Windows [ par gimbflo2002 ]
Bonjour,j'ai un problème d'affichage et j'espère qu'un spécialiste pourra me dépanner !Voilà, j'ai développé une appli sous delphi sur un système Wind
Media Player Windows Ligne de commande [ par Rowan ]
Bonjour à tous,Est-ce quelqu'un connait les lignes de commandes du MediaPlayer de Windows? Mode plein écran, ouverture, arrêt, fermeture, etc...D'avan
OnClose n'est pas appelé lors de la fermeture de Windows [ par globule ]
Bonjour, J'ai crée un application qui tourne en tache de fond et qui se place en systray à coté de l'horloge.J'ai implementé l?événement FormClose du
cryptage windows [ par ralfspark ]
salut a tous j ai crypte certains fichier dans windows (comme mes photos), et apres reinstalation je ne peut plus les lire, que doit je faire ?merci
|
Téléchargements
Logiciels à télécharger sur le même thème :
|