Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. void __fastcall TForm18::Button3Click(TObject *Sender)
  2. {
  3.     String s = DirectoryListBox1->GetItemPath(DirectoryListBox1->ItemIndex);
  4.     String s1 = DirectoryListBox1->GetItemPath(DirectoryListBox1->ItemIndex - 1) + "\\" + Edit1->Text;
  5.  
  6.     s += '\0';
  7.     s1 += '\0';
  8.  
  9.     SHFILEOPSTRUCT op;
  10.     ZeroMemory(&op, sizeof(op));
  11.     op.hwnd  = Handle;
  12.     op.wFunc = FO_RENAME;
  13.     op.pFrom = s.c_str();
  14.     op.pTo = s1.c_str();
  15.     op.fFlags = 0;
  16.     SHFileOperation(&op);
  17.  
  18.     DirectoryListBox1->Directory = DirectoryListBox1->GetItemPath(DirectoryListBox1->ItemIndex - 1);
  19.     DirectoryListBox1->Directory = DirectoryListBox1->GetItemPath(DirectoryListBox1->ItemIndex + 1);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement