Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Desktop Subclass Problem

Posted on 2001-09-05
3
Medium Priority
?
405 Views
Last Modified: 2010-08-05
I wrote this dll, and it isn't working. Can anybody help?

--------------------------------------------------------
library Desktop;

uses
  SysUtils, Classes,windows, Messages, Dialogs;

const
    WM_PAINTPRIVATE_MESSAGE = WM_USER + 322;

var oldWndProc: Integer;

function myDesktopWndProc(WindowHandle:hWnd; TheMessage:Longint; ParamW:Longint;ParamL:Longint):LongInt; stdcall;
begin
  case TheMessage of
  xxx : ShowMessage('Testing...');
  end;

   myDesktopWndProc := CallWindowProc(Pointer(OldWndProc),WindowHandle, TheMessage, ParamW, ParamL);
end;


procedure SetProc; stdcall;
var FhDesktopWnd : HWND;
    FDesktopWndInstance : TFarProc;
    Errol : Cardinal;
    DProc : LongInt;
begin

 oldWndProc:=GetWindowLong(GetDesktopWindow, GWL_WNDPROC);
 if SetWindowLong( GetDesktopWindow, GWL_WNDPROC, Longint(@myDesktopWndProc))=0 then
  begin
  Errol:= GetLastError;
  showmessage(inttostr(Errol));

  end
  else
   showmessage('Set')
end;

procedure KillProc; stdcall;
begin
  SetWindowLong( GetDesktopWindow, GWL_WNDPROC, LongInt(oldWndProc));
  showmessage('Kill')
end;


exports SetProc index 1,
        KillProc index 2;
begin

end.




--------------------------------------------------------

I get the ERROR_CALL_NOT_IMPLEMENTED error when I call then SetWindowLong function.


Regards,
guitfatio
0
Comment
Question by:guitfatio
3 Comments
 
LVL 14

Accepted Solution

by:
DragonSlayer earned 100 total points
ID: 6459374
Check out Madshi's comment (it's at the bottom of the page):

http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=20178822
0
 
LVL 20

Assisted Solution

by:Madshi
Madshi earned 100 total points
ID: 6460063
:-)

The problem is that SetWindowLong is only supported for windows that belong to the current process. So your dll can call SetWindowLong only, if your dll is loaded in the context of the explorer process. See DragonSlayer's link for more information...

Regards, Madshi.
0
 
LVL 17

Expert Comment

by:geobul
ID: 9295457
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

split points between DragonSlayer and Madshi

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question