473,325 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Simple Message question...

I'm experimenting with the message object in C#. If I try to move the
window by clicking on the client area, why does this work:

private void baseForm_MouseDown(object sender, MouseEventArgs e)
{
Capture = false;
Message message = Message.Create(Handle, 161, (IntPtr)2, IntPtr.Zero);
WndProc(ref message);
}

but if I do the same thing from an object on the form:

private void label1_MouseDown(object sender, MouseEventArgs e)
{
Capture = false;
Message message = Message.Create(Handle, 161, (IntPtr)2, IntPtr.Zero);
WndProc(ref message);
}

it doesn't work?

Nov 17 '05 #1
1 1888
Hi Craig,

I think it would be easier to override WndProc, handle WM_NCHITTEST and once
the pointer is over the label, return HTCAPTION in response to WM_NCHITTEST.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"craig.kelly" <cr*********@rogers.com> wrote in message
news:zN********************@rogers.com...
I'm experimenting with the message object in C#. If I try to move the
window by clicking on the client area, why does this work:

private void baseForm_MouseDown(object sender, MouseEventArgs e)
{
Capture = false;
Message message = Message.Create(Handle, 161, (IntPtr)2, IntPtr.Zero);
WndProc(ref message);
}

but if I do the same thing from an object on the form:

private void label1_MouseDown(object sender, MouseEventArgs e)
{
Capture = false;
Message message = Message.Create(Handle, 161, (IntPtr)2, IntPtr.Zero);
WndProc(ref message);
}

it doesn't work?


Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
3
by: Peter | last post by:
Hello Thanks for reviewing my question. I would like to know how can I programmatically select a node Thanks in Advanc Peter
7
by: Mark Prenter | last post by:
Hi all, I'm fairly new to .NET and I haven't done much in C++ before, nothing complex anyway, but I have a pretty good understanding of programming in general. What I'm trying to do is create a...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
7
by: Rudy | last post by:
Hi All! How do you control what's in the blue title bar in IE. Like for example "Discussions in dotnet.framework.aspnet - Microsoft Internet Explorer" on this page. Where do you controll the text...
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
1
by: Brian Henry | last post by:
Hello, I was tring to learn socket's (being i never used them before) and have a simple question. I want to create a listner that will get any data recieved and print it out. I've been able to...
27
by: karan.shashi | last post by:
Hey all, I was asked this question in an interview recently: Suppose you have the method signature bool MyPairSum(int array, int sum) the array has all unique values (no repeats), your...
4
by: dba_222 | last post by:
Dear Experts, Ok, I hate to ask such a seemingly dumb question, but I've already spent far too much time on this. More that I would care to admit. In Sql server, how do I simply change a...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.