[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Call caption messages

Posted on 1998-12-05
23
Medium Priority
?
260 Views
Last Modified: 2010-04-04
Hi!

I'm making an application without a caption but I want it to move on the desktop like a caption. I have tried various methods. I tried to use movewindow but the window was visible while it was dragged. So, I disabled the repaint and added it in the mouseup event but the image of the window was still on the desktop where the form originally was (I thought I could then use "rect" to paint the rectangle).

Finally, I want to know exactly How can I make windows think that I'm dragging a real caption using the window messages (WM_MOVING, WM_MOVE)in the onmousedown, onmousemove and onmouseup events.

Thanks in advance!
0
Comment
Question by:Yoni
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 6
  • 4
  • +2
23 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 1349415
Just to clear things in my mind...  

You have an application with no border...
You want to be able to define your own area where you can click and drag the window as if you clicked on the toolbar...

Correct?

Tim.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 1349416
(by toolbar, I meant border title bar)...

heh...

Tim.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1349417
Here is how it's done...

in OnMouseMove()

OnMouseMove()
begin
  if ssLeft in Shift then begin
    ReleaseCapture;
    FormName.Perform(WM_SYSCOMMAND, $F012, 0);
  end;
end;

That's all... You can put this code in any controls OnMouseMove() and the form will move if you try dragging that control whose OnMouseMove() has got the code above...

Cheers,
Viktor
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Yoni
ID: 1349418
Sorry it doesn't work.I get a few errors
Illegal Charecter in input file: ''($A0)

(by the way Yes tim, that's exactly what I mean)
0
 

Author Comment

by:Yoni
ID: 1349419
Sorry it doesn't work.I get a few errors
Illegal Charecter in input file: ''($A0)

(by the way Yes tim, that's exactly what I mean)
0
 

Author Comment

by:Yoni
ID: 1349420
Sorry it doesn't work.I get a few errors
Illegal Charecter in input file: ''($A0)

(by the way Yes tim, that's exactly what I mean)
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1349421
Hi Yoni,

Try this a form and a button

and this code in unit1

unit1;
interface

uses
  SysUtils,
  WinTypes,
  WinProcs,
  Messages,
  Classes,
  Controls,
  Forms,
  StdCtrls,
  ExtCtrls,
  Menus;

type
  TCapLessForm = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    procedure CreateParams(var Params: TCreateParams); override;
    procedure WMNCHitTest(var Msg: TMessage);  message WM_NCHITTEST;
  end;

var
  CapLessForm: TCapLessForm;

implementation

{$R *.DFM}

procedure TCapLessForm.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams (Params);
  Params.Style := ws_Popup or ws_ClipChildren or ws_ClipSiblings or ws_Border;
end;

procedure TCapLessForm.WMNCHitTest(var Msg: TMessage);
begin
  if GetAsyncKeyState(VK_LBUTTON) < 0 then
    Msg.Result := HTCAPTION
  else
    Msg.Result := HTCLIENT;
end;

procedure TCapLessForm.Button1Click(Sender: TObject);
begin
  Close;
end;

end.

0
 

Author Comment

by:Yoni
ID: 1349422
Sorry it doesn't work.I get a few errors
Illegal Charecter in input file: ''($A0)

(by the way Yes tim, that's exactly what I mean)
0
 

Author Comment

by:Yoni
ID: 1349423
thanks bruintje! I'll try...
0
 

Author Comment

by:Yoni
ID: 1349424
Illegal Charecter in input file: ''($A0)
Nope. I get this error message at the following lines:
unit1;
interface
uses
  SysUtils,
  WinTypes,
  WinProcs,
  Messages,
  Classes,
  Controls,
  Forms,
  StdCtrls,
  ExtCtrls,
  Menus;
type
  TCapLessForm = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    procedure CreateParams(var Params: TCreateParams); override;
    procedure WMNCHitTest(var Msg: TMessage);  message WM_NCHITTEST; 2 Errors
  end;
var
  CapLessForm: TCapLessForm;
implementation
{$R *.DFM}
procedure TCapLessForm.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams (Params); Error
  Params.Style := ws_Popup or ws_ClipChildren or ws_ClipSiblings or ws_Border; Error
end;
procedure TCapLessForm.WMNCHitTest(var Msg: TMessage);
begin
  if GetAsyncKeyState(VK_LBUTTON) < 0 then   Error
    Msg.Result := HTCAPTION      Error
  else                           Error
    Msg.Result := HTCLIENT;      Error
end;
procedure TCapLessForm.Button1Click(Sender: TObject);
begin
  Close;    Error
end;
end.
0
 

Author Comment

by:Yoni
ID: 1349425
Illegal Charecter in input file: ''($A0)
Nope. I get this error message at the following lines:
unit1;
interface
uses
  SysUtils,
  WinTypes,
  WinProcs,
  Messages,
  Classes,
  Controls,
  Forms,
  StdCtrls,
  ExtCtrls,
  Menus;
type
  TCapLessForm = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    procedure CreateParams(var Params: TCreateParams); override;
    procedure WMNCHitTest(var Msg: TMessage);  message WM_NCHITTEST; 2 Errors
  end;
var
  CapLessForm: TCapLessForm;
implementation
{$R *.DFM}
procedure TCapLessForm.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams (Params); Error
  Params.Style := ws_Popup or ws_ClipChildren or ws_ClipSiblings or ws_Border; Error
end;
procedure TCapLessForm.WMNCHitTest(var Msg: TMessage);
begin
  if GetAsyncKeyState(VK_LBUTTON) < 0 then   Error
    Msg.Result := HTCAPTION      Error
  else                           Error
    Msg.Result := HTCLIENT;      Error
end;
procedure TCapLessForm.Button1Click(Sender: TObject);
begin
  Close;    Error
end;
end.
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1349426
Hi Yoni,

Looks like a lot of messages of the (T)Error type. I will take another look at it.

Bruintje
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1349427
The illegal char thing happens when you paste code from IE (or Netscape) into Delphi. Try typing victornet's code, not pasting it, or search and replace $A0 with spaces in Delphi.
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1349428
Hi philip,
Well I did that myself and did not experience this problem (Happy IE5 user)hahahahahahahahaahaha

Greetz.
0
 

Author Comment

by:Yoni
ID: 1349429
Victor and Bruintje

It's my mistake. When I use your source On a blank form it works perfectly but it gives me the above error message when I add it to the project that I'm programming and in which I want to implement this feature...
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1349430
Well, hope your problem is solved then....
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1349431
Yoni does it work now??
0
 

Author Comment

by:Yoni
ID: 1349432
Ok. I've found the problem and it workes.

You can repost the answer for the points...
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1349433
Hi Yoni,
Viktor had the first answer so give him the points....
If that solves your problem.

Bruintje
0
 
LVL 10

Accepted Solution

by:
viktornet earned 400 total points
ID: 1349434
Well, ok I'll answer the question then :)
10x bruintje and Yoni

Cheers,
Viktor
0
 

Author Comment

by:Yoni
ID: 1349435
ok, Your very honest bruintje.
Bye!:-)
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1349436
Well, that's just the way things work.........
:O)
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1349437
10x to philipleighs for identifying the problem with the $A0 char thing
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

656 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