C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[39388] 델파이소스를 빌더로 바꿨는데 제대로 작동을 안하네요...뭐가 잘못됐을까요? 몇줄 안됩니다.
니코로빈 [] 1154 읽음    2005-03-07 09:07
MDI에서 Child가 영역 밖으로 나가면 스크롤 바가 안생기도록 하는 델파이 소스인데요....
빌더로 바꿨는데 제대로 작동을 안하네요...뭐가 잘못됐을까요?
//------------------------------------------------------------------------------
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, ToolWin, Menus, Unit2;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    F1: TMenuItem;
    N1: TMenuItem;
    StatusBar1: TStatusBar;
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    procedure FormCreate(Sender: TObject);
    procedure N1Click(Sender: TObject);
  private
    { Private declarations }
  protected
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TForm1 }

function ClientWindowProc(wnd: HWND; msg: Cardinal; wparam, lparam: Integer): Integer; stdcall;
var
  f: Pointer;
Begin
  f := Pointer(GetWindowLong(wnd, GWL_USERDATA));
  case msg of
    WM_NCCALCSIZE:
      begin
        if (GetWindowLong(wnd, GWL_STYLE) and (WS_HSCROLL or WS_VSCROLL)) <> 0 Then
          SetWindowLong(wnd, GWL_STYLE,
                        GetWindowLong(wnd, GWL_STYLE) and not(WS_HSCROLL or WS_VSCROLL));
      end;
  end;
  Result := CallWindowProc(f, wnd, msg, wparam, lparam);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  if ClientHandle <> 0 Then
  begin
    if GetWindowLong(ClientHandle, GWL_USERDATA) <> 0 then
      Exit;

    SetWindowLong(ClientHandle, GWL_USERDATA,
                  SetWindowLong(ClientHandle, GWL_WNDPROC, Integer(@ClientWindowProc)));
  end;
end;

procedure TForm1.N1Click(Sender: TObject);
begin
  TForm2.Create(Self);
end;

end.
//------------------------------------------------------------------------------
빌더로 변경한겁니다.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "Main.h"
#include "About.h"
#include "Unit1.H"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TMainForm *MainForm;
//---------------------------------------------------------------------------
LRESULT ClientWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    WNDPROC f = (WNDPROC)GetWindowLong(hWnd, GWL_USERDATA);
    if (uMsg == WM_NCCALCSIZE)
    {
        if ((GetWindowLong(hWnd, GWL_STYLE) & (WS_HSCROLL | WS_VSCROLL)) != 0)
        {
            SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) & ~(WS_HSCROLL | WS_VSCROLL));
        }
    }
    return CallWindowProc((FARPROC)f, hWnd, uMsg, wParam, lParam);
}
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent *Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormCreate(TObject *Sender)
{
    if (ClientHandle != 0)
    {
        if (GetWindowLong(ClientHandle, GWL_USERDATA) != 0) return;
        SetWindowLong(ClientHandle, GWL_WNDPROC, (LONG)ClientWindowProc);
    }
}
//---------------------------------------------------------------------------

void __fastcall TMainForm::NewFormMenuClick(TObject *Sender)
{
    TMDIChild *pChild;
    pChild = new TMDIChild(this);   
}
//---------------------------------------------------------------------------

+ -

관련 글 리스트
39388 델파이소스를 빌더로 바꿨는데 제대로 작동을 안하네요...뭐가 잘못됐을까요? 몇줄 안됩니다. 니코로빈 1154 2005/03/07
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.