मैं निम्नलिखित प्रक्रिया है कि खिड़कियों से फाइल droping की अनुमति देता है, छोड़ने के ठीक काम करता है लेकिन जब मैं का उपयोग कर क्रम (TStyleManager.TrySetStyle(styleName)
) में शैली बदलने, रूप को स्वीकार अब और नहीं गिर रहा है! वास्तव में क्या गलत है?कार्यावधि में डेल्फी शैलियों बदलने प्रपत्र के लिए फ़ाइलों को छोड़ने की अनुमति नहीं है
public //public section of the form
...
procedure AcceptFiles(var msg : TMessage); message WM_DROPFILES;
...
procedure TMainFrm.AcceptFiles(var msg: TMessage);
var
i,
fCount : integer;
aFileName : array [0..255] of char;
begin
// find out how many files the form is accepting
fCount := DragQueryFile(msg.WParam, {uses ShellApi is required...}
$FFFFFFFF,
acFileName,
255);
for I := 0 to fCount - 1 do
begin
DragQueryFile(msg.WParam, i, aFileName, 255);
if UpperCase(ExtractFileExt(aFileName)) = '.MSG' then //accept only .msg files
begin
if not itemExists(aFileName, ListBox1) then// function checks whether the file was already added to the listbox
begin
ListBox1.Items.Add(aFileName);
end
end;
end;
DragFinish(msg.WParam);
end;
...
procedure TMainFrm.FormCreate(Sender: TObject);
begin
DragAcceptFiles(Handle, True); //Main form accepts the dropped files
end;
+1 @hvd thaks: आप बस कोड अपने
FormCreate
मेंCreateWnd
है कि के लिए स्थानांतरित कर सकते हैं! एक आकर्षण की तरह काम कर रहे हैं – Raul@TLama संपादन के लिए धन्यवाद, सहमत है कि यह काफी स्पष्ट बनाता है। – hvd