Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
Cut files to Clipboard (in Windows)
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Building static libraries...
by
Fibonacci
[
Today
at 04:15:55 am]
failed to create named pi...
by
lazpas
[
Today
at 03:55:34 am]
Web assembly in Lazarus
by
PierceNg
[
Today
at 02:54:17 am]
TScroollBar vs TControlSc...
by
jamie
[
Today
at 12:26:23 am]
Online Package Manager
by
Beazy
[October 03, 2023, 11:22:22 pm]
Tmenuitem of TpopopMenu
by
paweld
[October 03, 2023, 11:06:26 pm]
Poor optimization of cons...
by
440bx
[October 03, 2023, 11:00:18 pm]
fpsStreams unit problems
by
wp
[October 03, 2023, 10:44:02 pm]
Disable sse/avx
by
marcov
[October 03, 2023, 10:43:02 pm]
Component for generating ...
by
colo
[October 03, 2023, 08:58:24 pm]
Screen.Cursor does not wo...
by
davemoriupak
[October 03, 2023, 08:24:27 pm]
LCLIntf.SetFocus don't ca...
by
davemoriupak
[October 03, 2023, 08:23:34 pm]
Linking error - Cocoa pro...
by
davemoriupak
[October 03, 2023, 08:21:48 pm]
Wayland and Free Pascal
by
nouzi
[October 03, 2023, 07:54:01 pm]
LAMW - opening URL in ext...
by
c4p
[October 03, 2023, 06:37:06 pm]
TBufferedFileStream crash...
by
AlexTP
[October 03, 2023, 06:13:54 pm]
Notarization under macOS ...
by
TRon
[October 03, 2023, 05:16:39 pm]
FPImageException while l...
by
wp
[October 03, 2023, 05:05:57 pm]
What is a .DB file
by
wp
[October 03, 2023, 04:13:15 pm]
IntraWeb in Lazarus??
by
ginoo
[October 03, 2023, 01:32:49 pm]
Pull an icon from a runni...
by
BIT
[October 03, 2023, 01:10:29 pm]
IMAP Search command & uni...
by
Rebell
[October 03, 2023, 12:24:14 pm]
[SOLVED] Debugger do not ...
by
BSaidus
[October 03, 2023, 10:04:29 am]
pgNotex, a document and t...
by
maxnd
[October 03, 2023, 09:45:57 am]
Improvement of function E...
by
AlexTP
[October 03, 2023, 09:30:23 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Cut files to Clipboard (in Windows) (Read 883 times)
domasz
Sr. Member
Posts: 276
Cut files to Clipboard (in Windows)
«
on:
May 23, 2023, 12:38:19 pm »
Here I found a nice piece of code which copies list of files to clipboard and then those files can be pasted in a Windows Explorer window:
https://forum.lazarus.freepascal.org/index.php/topic,51601.msg379065.html#msg379065
But how do I do the same but instead of "copy" I need "cut", so files are not copied but moved?
Logged
Remy Lebeau
Hero Member
Posts: 1235
Re: Cut files to Clipboard (in Windows)
«
Reply #1 on:
May 24, 2023, 09:32:37 pm »
Quote from: domasz on May 23, 2023, 12:38:19 pm
But how do I do the same but instead of "copy" I need "cut", so files are not copied but moved?
Microsoft's
Handling Delete-on-Paste Operations
documentation explains how to accomplish this.
You can still use the same
CF_HDROP
data format for the file paths, but you will have to wrap that data inside of an object that implements the
IDataObject
interface, so that the paster can communicate back to you whether the paste was successful or not, and whether the files were copied or moved. If the paste was successful but the files were copied, you will have to delete the source files yourself.
«
Last Edit: May 24, 2023, 09:39:37 pm by Remy Lebeau
»
Logged
Remy Lebeau
Lebeau Software
- Owner, Developer
Internet Direct (Indy)
- Admin, Developer (
Support forum
)
domasz
Sr. Member
Posts: 276
Re: Cut files to Clipboard (in Windows)
«
Reply #2 on:
May 26, 2023, 11:03:24 am »
A lot more complicated than it should be. Thanks for the info!
Logged
KodeZwerg
Hero Member
Posts: 1647
Fifty shades of code.
Re: Cut files to Clipboard (in Windows)
«
Reply #3 on:
May 26, 2023, 01:34:06 pm »
Since I never needed such in my applications, I can't help much but a good starting point to be used as a tutorial I found
here
.
I hope it helps.
Logged
«
Last Edit:
Tomorrow
at 31:76:97 by
KodeZwerg
»
jamie
Hero Member
Posts: 5709
Re: Cut files to Clipboard (in Windows)
«
Reply #4 on:
May 26, 2023, 11:13:16 pm »
If you truly want to move files, this means the source is going to be deleted.
Windows has "MoveFileEx" A or the W version.
Also, you can use the "ShFileOperation" which allows you to do all kinds of juicy stuff.
Logged
The only true wisdom is knowing you know nothing
domasz
Sr. Member
Posts: 276
Re: Cut files to Clipboard (in Windows)
«
Reply #5 on:
May 29, 2023, 02:48:19 pm »
Thanks, I'll try!
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
Cut files to Clipboard (in Windows)
TinyPortal
© 2005-2018