|
Well, what's actually stopping you?
I can see a few steps:
First, you need this to toggle on and off. If it was on all the time, anyone using this dialog will hate you. "I just tried to press OK, but the damn button keeps moving!"
You'll need to subclass your button(s), and override WM_LBUTTONDOWN,WM_MOUSEMOVE,WM_LBUTTONUP. For the button messages, either pass them on as normal, or toggle a "I'm dragging flag". In the mouse button, subtract the current position from the last position, and move the window by that much. Something like:
void CMyMovableButton::OnMouseMove (UINT fFlags, CPoint ptMouse)
{
if (m_bDragging)
{
CWnd *pParent = GetParent ();
MapWindowPoints (pParent, &ptMouse, 1);
CPoint ptDelta = ptMouse - m_ptMouseLast;
MoveWindow (ptDelta.x, ptDelta.y);
SetWindowPos (NULL, ptDelta.x, ptDelta.y, 0,0, SWP_NOSIZE | SWP_NOZORDER);
m_ptMouseLast = ptMouse;
}
else
__super::OnMouseMove (fFlags, ptMouse);
}
You'll also need to store all your window positions when the dialog closes (or store them whenever a control has finished moving) so that you can use that information next time the dialog is used. Maybe make structure full of CPOints (ie, ptOKButton, ptCancelButton) and save that in the registry for use in you CMyMovableDlg::OnInitDialog function?
You might also want to look at CDiagramEditor - DIY vector and dialog editor[^] for an alternate way of doing all this.
It sounds like you have a lot of work ahead of you - and I know no shortcut. I hope you have a strong business case for this, and not just "wouldn't it be cool?"
Maybe when you're done, you could write an article based on it?
Good luck,
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
|
I m having 3 coloumns in my list view
Column1 Column2 Column3
when i click a button Column1 should move to 2nd position column3 should come to first and column2 will be in 3rd position
i m trying this in win 32
thanks in advance
|
|
|
|
|
AFAIK there's no magic for that: you have to rebuild properly the list.
[added]
Wow: it looks like I was wrong...
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Have a look at ListView_SetColumnOrderArray . It should do what you're looking for.
|
|
|
|
|
|
Is there any way to remove the space for the title at the top of a groupbox. When I use the GetWindowRect property, it's giving me a rectangle with a gap at the top. I don't want the gap - I want the dimensions of the entire group box, with title area (which I am not using). How do I get this? I found a solution for .NET here, but nothing for MFC:
http://stackoverflow.com/questions/2110148/wpf-groupbox-with-no-header-space[^]
Thanks in advance.
|
|
|
|
|
permutations wrote: When I use the GetWindowRect property, it's giving me a rectangle with a gap at the top. I don't want the gap - I want the dimensions of the entire group box, with title area...
I'm obviously misunderstanding, but what is the difference between the "gap at the top" and the "title area?"
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
No difference - I'm talking about the title area. Is there a way to style the groupbox so no space is given to the title and GetWindowRect will return the entire groupbox, all the way to the top?
|
|
|
|
|
Not that I know of. You might try taking the height of the font and dividing it in half, since that's how much sticks above the group border.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Is there any built-in interface to allow me to make an extension for explorer that sits in explorer's title bar? If not, what is the best way to hook explorer so I can put something in the titlebar?
|
|
|
|
|
|
Problem is, I can't see any way to put something on the title bar of explorer using this.
|
|
|
|
|
Hi,
I upgraded a legacy C++ application from Visual Studio 6.0 to Visual Studio 2008. The application mimics the front panel of a fire alarm system and is implemented by overlaying a bitmap drawing of the fire alarm panel with hidden button controls. When the VS 6.0 version was run with a resolution different than what was originally used to create it, the bitmap and the button controls became misaligned. After upgrading to Visual Studio 2008, this misalignment problem went away(!), so that I could run at any resolution.
A problem that occurred was that when I gave the .EXE to someone else to try on their machine, they received an error dialog that read:
“This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.”
When I looked at the system error log, I saw the following 3 errors had occurred:
1) Source: SideBySide
EventID: 59
Description: Generate Activation Context failed for ...\Panel.exe. Reference error message: The operation completed successfully.
2) Source: SideBySide
EventID: 59
Description: Resolve Partial Assembly failed for Microsoft.VC90.MFC. Reference error message: The reference assembly is not installed on your system.
3) Source: SideBySide
EventID: 32
Description: Dependent Assembly Microsoft.VC90.MFC could not be found and Last Error was The referenced assembly is not installed on your system.
Thanks in advance.
|
|
|
|
|
|
Joe,
Thanks. I didn't mention that I had the user do that because my original question was already long enough. What happened after he did that though was that the application ran, BUT it repeated the behavior that had been seen using VS 6.0 which was that the buttons and the bitmap became misaligned. When I run the app created with VS 2008 on my machine, the buttons and the bitmap stay aligned no matter what screen resolution I use.
I'm going to now have to go back and verify what happens if I run the original executable created with VS 6.0 on my machine.
|
|
|
|
|
Looks like you and your user were using different MFC DLL versions.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
can we change ascii table characters ???
|
|
|
|
|
|
As Chris says, ASCII is a standard coding and you can't change it, we won't let you. However, are you asking if you can change what is actually displayed when you print a particular ASCII character? If that's your question, then the answer is yes. Create your own font. Check out Dingbats for an example of how crazy you can get with that.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
if(0x65)
{
cout << 0x66;
}
??
|
|
|
|
|
Ok, that's possible but trivial. It's obviously not clear to me what he's asking.
The wonderful thing about the Darwin Awards is that everyone wins, especially the members of the audience.
|
|
|
|
|
if(0x65)
{
cout << 0x66;
}
this is the way, but only hollow
like that,
65 means A ? YES
and 66 means B ? YES
now when we change it 65 will B, 66 mean A
but how ?
if we take a file which s called ascii table, let change something on it
but ı couldnt see anyhing for now. ı just think
maybe its trivial and unused but something we should do that to me.
|
|
|
|
|
So clarify for us what you're trying to do. Is it when you execute the following line:
printf("%s", "Foo");
You want to change something in the OS so that the following output is produced?
Xyy
The wonderful thing about the Darwin Awards is that everyone wins, especially the members of the audience.
|
|
|
|
|
Do you mean to display like?
cout << (char)0x66;
Also 66 is 'B', 0x66 is not! 0x66 is 102, which is 'f'.
Or, do you a string-array, and want to manipulate it?
|
|
|
|