AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

NM_RETURN - Problem

Ein Thema von silentAMD · begonnen am 20. Mai 2004 · letzter Beitrag vom 18. Mai 2007
 
Dirk - nonVCL

Registriert seit: 14. Mai 2007
Ort: Islamabad
2 Beiträge
 
Delphi 2005 Personal
 
#33

Re: NM_RETURN - Problem

  Alt 14. Mai 2007, 11:32
Hallo Dezipaitor,

Super Beitrag. Danke.

In Delphi habe ich das subclassing-Problem so gelöst:

Delphi-Quellcode:
type
  {Since Delphi does not distinguish between capital and non-capital
   letters, TWPARAM & TLPARAM should be declared.}

  TWPARAM = WPARAM;
  TLPARAM = LPARAM;

var
  WndProcLV : Integer;
  hListView : HWND;


//*************** LVWndProc ***************
function LVWndProc(handle : HWND; Msg : Cardinal; wParam1 : TWPARAM;
                   lParam1 : TLPARAM) : Integer; stdcall;

begin // LVWndProc
  // if "Return" was pressed, then process it in the list view
  if (Msg = WM_GETDLGCODE) and (wParam1 = VK_RETURN) then
  Result:= DLGC_WANTALLKEYS or DLGC_WANTMESSAGE
  // otherwise give the control back to the calling procedure
  else
  Result:= CallWindowProc(Pointer(WndProcLV), handle, Msg, wParam1, lParam1);
end; // LVWndProc
//*************** LVWndProc ***************



//begin main dialog function
//...

  hListView := GetDlgItem(hwndDlg, FolderList); // handle to the ListView
  hHeader := SendMessage(hListView, LVM_GETHEADER, 0, 0); // LV header
  {Create a subclass for the list view,
   to catch the VK_RETURN for the list view}

  WndProcLV:= GetWindowLong(hListView, GWL_WNDPROC);
  SetWindowLong(hListView, GWL_USERDATA, WndProcLV);
  SetWindowLong(hListView, GWL_WNDPROC, Integer(@LVWndProc));

//...
// end main dialog function
Mit CallWindowProc muss man sich keine Gedanken um das richtige weiterleiten der Msg machen. Windows erledigt das. In meinen Programmen funktioniert das super.
Verbesserungen sind bestimmt noch möglich.

Viele Grüße

Dirk
Dirk
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

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 03:24 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