Solved

GetClassName function

Posted on 1998-07-28
1
1,425 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now