|
Is there any hope of making this work under Windows 10? So far it refuses to draw to the NC area and instead draws the new title bar at the top of the client area.
John Murphy
|
|
|
|
|
Apologies John, I honestly have no idea. Wow, that is very old code, I thought I had taken it down. That ImageList drag functionality is pretty useful sometimes, I am using in in my current project as a matter of fact. I just wrote an ImageList class that loads PNGs with transparency, if that would be of any use to you I could email it to you (or whatever way is best to send stuff).
To be honest I do not have a bit of experience with Win10 but from what I understand there seems to be some differences. I did download an iso recently and was contemplating installing a VM soon, I guess today is as good as any. Which VS version are you running? I will install the same one and give it a try.
I'll help if I can but I can't promise anything (not sure if this ISO will install).
|
|
|
|
|
Thank you JJMatthews. I am just trying to get control over that white Win 10 title bar and tone it down a bit. My attempts to get TBar to draw to the NC area so far have failed.
John L. Murphy
|
|
|
|
|
Hi,
I added your class in a Formview SDI application. My problem is that your title bar appears on bottom of the menu area.
How can I your title bar appears on top of the menu area.
|
|
|
|
|
This is really cool - I tried to use it to replace the title bar in a dialog, which displays OK, but the thing hooks the main frame as well, so any attempt to drag the dialog will drag the main frame as well, etc....
Any ideas on how I can remedy that?
thanks
|
|
|
|
|
Hi, I was wondering how can I implement this on C#?
It is a really nice caption bar replacement and it would be awesome to have it has a control or library.
Thank you in advance
|
|
|
|
|
It would have to be rewritten, I dont know enough c# to know if windows hooking is even available. I could probably do it but I dont have the time right now honestly. If youd like to attempt it I could help you out when you get stuck.
Jeremy
|
|
|
|
|
Yes hooking is aviable, but it makes C# code look ugly.
CLR: Removes tough Java-based stains fast!
|
|
|
|
|
Sorry but C# code always looks ugly. I recommend using VisualC++, .NET is garbage.
Jeremy
|
|
|
|
|
To me it's the other way around. Besides, they crippled VC++ Express so it has no Window Designer and resource editor. Personally I would love if they made Win32/MFC/ATL/WTL obsolete. VC++ only purpose is for C++/CLI.
People using Windows XP are still living in 2001.
|
|
|
|
|
I apologize for the delay in my response as I was on an extended vacation. Normally I wouldn't dignify such a comment with a response but I don't want any beginning programmers to consider it. When you are writing code different projects require different tools. Just like in construction you wouldn't hammer in a nail with a screwdriver, you would choose a hammer. A few contracts ago I was working with EEs and various hardware device, cameras, lasers, scanheads and by far the best tool for that job was VC++/MFC. My environment was VS2003 because there was not any real improvement to the C++ stuff after that release. When I needed to write a driver to send data through a parallel port I wrote it in C with VS6. A few years later on a different contract writing a front end for a relational database I use VB.NET, VC++ would have been the wrong tool for that. C++ will never be obsolete. It may be difficult to learn at first but it is well worth the effort. Once you understand coding on that level picking up any other language is easy. In my experience I've found that people don't even try because they are convinced it will be too difficult. That is a self defeating attitude and it will defeat you.
|
|
|
|
|
First thank you for your great class!
Now my question:
Is there a way to show an Icon on the left side of the title bar and Title text, like in a normal dialog window?
Thanks!
|
|
|
|
|
Sorry for the delay in getting back to you. Yes, it would be very easy, just draw it there.
Jeremy
|
|
|
|
|
Try this:
1. Open your project
3. Open another app which has the ability to keep it's windw "always on top"
4. Move this new app with "always on top" enabled so that it partially covers your app.
5. Drag your app with "ghost drag" enabled
Result: The drag image contains a portion of the "always on top" window
Just as I thought
You need to create a memory dc and then (re)paint your window into it. Dunno how this can be done. Maybe WM_SYNCPAINT
The concept is nice though.
|
|
|
|
|
Thank you for finding that issue. I had a feeling there was something I overlooked. I alot of other problems while developing this pertaining to having to take a screenshot of my main window, thats why in ghost drag mode I only allowed it to be moved inside the desktop area. The ideal way to do it, like you said, would be to cache a dc or bitmap and somehow hook into all the painting messages from the main window down to all its child windows. I havent been unable to figure out how to do this so far. Please let me know if you find a solution, it would be greatly appreciated.
|
|
|
|
|
Windows XP introduced PrintWindow(), which paints the window onto a given dc.
Here's the code I used, to see the difference between the two methods:
(TBar.cpp, line 563, function CTBar::CreateDragImage):
static int alternate = 0;
if (++alternate % 2)
::BitBlt(hDragDC, 0, 0, pRect->Width(), pRect->Height(),
hDesktop, pRect->left, pRect->top, SRCCOPY);
else
::PrintWindow(::GetParent(m_hWnd), hDragDC, 0);
|
|
|
|
|
Well this should fix the multi monitor problem (Well it worked for me)
Just insert into TBar.cpp below line 579
CRect baseline(rDesktop),backup(rDesktop);
for (int i = 0;i < 10;i++)
{
DISPLAY_DEVICE dev;
dev.cb = sizeof(DISPLAY_DEVICE);
if (!EnumDisplayDevices(NULL,i,&dev,NULL))
{
break;
}
else
{
if ((dev.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) == DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
{
LPDEVMODE devmode = (LPDEVMODE)new DEVMODE;
devmode->dmSize = sizeof(LPDEVMODE);
if (!EnumDisplaySettings(dev.DeviceName,ENUM_CURRENT_SETTINGS,devmode))
{
ASSERT(0);
}
else
{
if ((devmode->dmPelsHeight != baseline.Height()) ||
(devmode->dmPelsWidth != baseline.Width()))
{
rDesktop = backup;
delete devmode;
devmode = 0;
break;
}
if (devmode->dmPosition.x < 0) rDesktop.left += devmode->dmPosition.x;
if (devmode->dmPosition.x > 0) rDesktop.right += devmode->dmPosition.x;
if (devmode->dmPosition.y < 0) rDesktop.top += devmode->dmPosition.y;
if (devmode->dmPosition.y > 0) rDesktop.bottom += devmode->dmPosition.y;
}
delete devmode;
devmode = 0;
}
}
}
-- modified at 5:57 Tuesday 17th October, 2006
Johan Pretorius
-- Artificial Intelligence is no match for Natural Stupidity --
|
|
|
|
|
Hi,
I added your class in a SDI application... the problem is that your title bar appears on top of the client area but the original title bar is there also. Any ideeas?
Thanks in advance.
To make mistakes is normal.
To blame your computer for your mistakes, it's more than normal, it's NATURAL.
|
|
|
|
|
Nevermind, I had to set the WS_POPUP style...
To make mistakes is normal.
To blame your computer for your mistakes, it's more than normal, it's NATURAL.
|
|
|
|
|
When I 'Ghost drag' the demo app, it consumes an enormous amount of CPU. Infect it claims one of my CPUs entirely. Not only that all this is in kernel mode.
Do not use it in production code.
|
|
|
|
|
Nice code.
Here is one little bug I have found:
when I press left mouse button on the close button and release it somewhere else, then when I move mouse cursor over application form, close button start flickering and there's no any way to stop it.
Thanks, carter.
|
|
|
|
|
Thank you for finding this bug. I have fixed it.
Jeremy Matthews
|
|
|
|
|
And what about a setting to remove the Close button?
|
|
|
|
|
I have added that funcionallity for you. You can still close the window with the system menu from the task bar.
Jeremy Matthews
|
|
|
|
|
"Ghost drag" feature does not work on the 2'nd screen of 2 monitor system.
Nice article otherwise.
|
|
|
|