Solved

GetClassName function

Posted on 1998-07-28
1
1,438 Views
Last Modified: 2009-12-16
I am trying to use a piece of code that was given  to me but I am having problems with the getclassname function.
The number of parameters seems to have changed. Could you please help me figure them out. In TWebExplorer the TAB key does not tab to the net field and that fixes that.

In Windows.pas:

{$EXTERNALSYM GetClassName}
function GetClassName(hWnd: HWND; lpClassName: PChar; nMaxCount: Integer): Integer; stdcall;


The code I was given:

procedure TFormWebBrowser.MessageLoop(var Msg: TMsg; var Handled: Boolean);
const
  DialogKeys: set of Byte = [VK_TAB, VK_RETURN, VK_DELETE, VK_EXECUTE, VK_ESCAPE, VK_CANCEL, VK_F10];
  MSJVMClassName = 'MSAWT_Comp_Class';                            // for Java Applets
var
  iOIPAO: IOleInPlaceActiveObject;
  Dispatch: IDispatch;
  buf: array[0..50] of Char;
begin
  if (WebBrowser <> nil) and
     ((Msg.Message = WM_KEYDOWN) or (Msg.Message = WM_KEYUP)) and
     (Msg.wParam in DialogKeys) then
  begin
    Handled := IsDialogMessage(Webbrowser.Handle, msg) = True;
    if (Msg.wParam = VK_DELETE) and (GetClassName(Msg.hwnd) = MSJVMClassName) then
    else
      if Handled then
        if FOleInPlaceActiveObject <> nil then
          FOleInPlaceActiveObject.TranslateAccelerator(Msg)
        else
        begin
          Dispatch := Webbrowser.Application_;
          if Dispatch <> nil then
          begin
            Dispatch.QueryInterface(IOleInPlaceActiveObject, iOIPAO);
            if iOIPAO <> nil then
              FOleInPlaceActiveObject := iOIPAO;
          end;
        end;
  end
  else
    Handled := False;
end;

0
Comment
Question by:moonrise
1 Comment
 
LVL 8

Accepted Solution

by:
ZifNab earned 20 total points
ID: 1358781
Hi moonrise,

what about this :

var  lpBuffer : PChar;

 if (Msg.wParam = VK_DELETE) and (GetClassName(Msg.hwnd, lpBuffer, 255) = MSJVMClassName)

don't suppose you need the other.
Zif.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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