AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi Drag & Drop im Edit erkennen und farbig markieren
Thema durchsuchen
Ansicht
Themen-Optionen

Drag & Drop im Edit erkennen und farbig markieren

Ein Thema von Helmi · begonnen am 30. Sep 2011 · letzter Beitrag vom 7. Dez 2011
 
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.373 Beiträge
 
Delphi 12 Athens
 
#10

AW: Drag & Drop im Edit erkennen und farbig markieren

  Alt 6. Dez 2011, 21:20
Dieses Interface gibt es seit Windows 2000,
und Delphi 7 stammt aus dem Jahre 2002.

Embarcadero ... ähhhhhh Borland, waren beim Importieren der WinAPI noch nie die Schnellsten.


http://msdn.microsoft.com/en-us/libr.../bb762034.aspx
usw.

Eventuell ist in den JEDI-WinAPI-Headern, bzw in der JCL noch mehr/besseres Zeugs enthalten,
wenn nicht gar ein ganzes Drag&Drop-Komponentendinges.

Delphi-Quellcode:
///////////////////////////////////////////////////////
//
// Drag and Drop helper
//
// Purpose: To expose the Shell drag images
//
// This interface is implemented in the shell by CLSID_DragDropHelper.
//
// To use:
// If you are the source of a drag (i.e. in response to LV_DRAGBEGIN or
// equivelent begin drag message) call
// IDragSourceHelper::InitializeFromWindow
// (<hwnd of window supporting DI_GETDRAGIMAGE>,
// <pointer to POINT indicating offset to the mouse from
// the upper left corner of the image>,
// <pointer to data object>)
//
// NOTE: The Data object must support IDataObject::SetData with multiple
// data types and GetData must implement data type cloning
// (Including HGLOBAL), not just aliasing.
//
// If you wish to have an image while over your application add the
// IDragImages::Dr* calls to your IDropTarget implementation. For Example:
//
// STDMETHODIMP CUserDropTarget::DragEnter(IDataObject* pDataObject,
// DWORD grfKeyState,
// POINTL pt, DWORD* pdwEffect)
// {
// // Process your DragEnter
// // Call IDragImages::DragEnter last.
// _pDropTargetHelper->DragEnter(_hwndDragOver, pDataObject,
// (POINT*)&pt, *pdwEffect);
// return hres;
// }
//
//
// If you wish to be able to source a drag image from a custom control,
// implement a handler for the RegisterWindowMessage(DI_GETDRAGIMAGE).
// The LPARAM is a pointer to an SHDRAGIMAGE structure.
//
// sizeDragImage - Calculate the length and width required to render
// the images.
// ptOffset - Calculate the offset from the upper left corner to
// the mouse cursor within the image
// hbmpDragImage - CreateBitmap( sizeDragImage.cx, sizeDragImage.cy,
// GetDeviceCaps(hdcScreen, PLANES),
// GetDeviceCaps(hdcScreen, BITSPIXEL),
// NULL);
//
// Drag Images will only be displayed on Windows NT 5.0 or later.
//
//
// Note about IDropTargetHelper::Show - This method is provided for
// showing/hiding the Drag image in low color depth video modes. When
// painting to a window that is currently being dragged over (i.e. For
// indicating a selection) you need to hide the drag image by calling this
// method passing FALSE. After the window is done painting, Show the image
// again by passing TRUE.

const
  SID_IDropTargetHelper = '{4657278B-411B-11D2-839A-00C04FD918D0}';
  SID_IDragSourceHelper = '{DE5BF786-477A-11D2-839D-00C04FD918D0}';
  SID_IDragSourceHelper2 = '{83E07D0D-0C5F-4163-BF1A-60B274051E40}';

  // This is sent to a window to get the rendered images to a bitmap
  // Call RegisterWindowMessage to get the ID
  DI_GETDRAGIMAGE = 'ShellGetDragImage';

  DSH_ALLOWDROPDESCRIPTIONTEXT = $1;

type
  LPSHDRAGIMAGE = ^SHDRAGIMAGE;
  SHDRAGIMAGE = record
      sizeDragImage: SIZE; // OUT - The length and Width of the
                                      // rendered image
      ptOffset: TPoint; // OUT - The Offset from the mouse cursor to
                                      // the upper left corner of the image
      hbmpDragImage: HBITMAP; // OUT - The Bitmap containing the rendered
                                      // drag images
      crColorKey: COLORREF; // OUT - The COLORREF that has been blitted
                                      // to the background of the images
  end;
  TShDragImage = SHDRAGIMAGE;
  PShDragImage = ^TShDragImage;

  IDropTargetHelper = interface(IUnknown)
    [SID_IDropTargetHelper]
    function DragEnter(hwndTarget: HWND; const pDataObject: IDataObject;
                       var ppt: TPoint; dwEffect: DWORD): HRESULT; stdcall;
    function DragLeave: HResult; stdcall;
    function DragOver(var ppt: TPoint; dwEffect: DWORD): HRESULT; stdcall;
    function Drop(const pDataObject: IDataObject; var ppt: TPoint;
                  dwEffect: DWORD): HRESULT; stdcall;
    function Show(fShow: BOOL): HRESULT; stdcall;
  end;

  IDragSourceHelper = interface(IUnknown)
    [SID_IDragSourceHelper]
    function InitializeFromBitmap(pshdi: LPSHDRAGIMAGE;
      const pDataObject: IDataObject): HRESULT; stdcall;
    function InitializeFromWindow(hwnd: HWND; var ppt: TPoint;
      const pDataObject: IDataObject): HRESULT; stdcall;
  end;

  IDragSourceHelper2 = interface(IDragSourceHelper)
    [SID_IDragSourceHelper2]
    function SetFlags(dwFlags: DWORD): HRESULT; stdcall;
  end;
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:22 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz