 |
|
|
 |
|
|
 |
|
 |
A good thing!Very perfect!Thank you !
|
|
|
|
 |
|
 |
cannot load images over dialog bar(CDialogBar control)? why?
and if yes..how i could make this?
|
|
|
|
 |
|
 |
ButtonST(452) rpImage.top += ((rpImage.Height() - dwHeight)/2);
When the image's size is larger than the button.
For example: if rpImage.Height() = 20 and dwHeight - 21
then rpImage.top = 0x7fffffff. Draw in wrong place!!!
and some others work in this way.
Fix advice: rpImage.top += ((rpImage.Height()/2 - dwHeight/2));
any way, thanks for your work.
|
|
|
|
 |
|
 |
I found another resource leak in the code when using Icons. Icons are loaded from the projects resources using the LoadImage() function. MSDN states that Icons loaded in this way have to be deleted using DestroyIcon(). The FreeResources() method of the CButtonST class uses DeleteObject() instead which leads to a resource leak.
Correct the FreeResources() method to the following to avoid this resource leak:
[...]
if (m_csIcons[0].hIcon != 0) { ::DestroyIcon(m_csIcons[0].hIcon); }
if (m_csIcons[1].hIcon != 0) { ::DestroyIcon(m_csIcons[1].hIcon); }
[...]
yours,
Markus
|
|
|
|
 |
|
 |
Hey,
Any plans to port over the latest ButtonST version?
|
|
|
|
 |
|
 |
I made a rotating button dispaying different bitmaps.
A resource leak was the result.
Analysis learns that the ::GetIconInfo() function
allocates 2 bitmaps that are not deleted by CButtonSt class
(See function CButtonST::SetIcon())
use DeleteObject to correct the error.
(The class was used in an application that controls a 4.000.000 Euro electron beam texturing machine for the largest cold roll mill in Arcelor.)
John.Gijs@Sidmar.arcelor.com
|
|
|
|
 |
|
 |
Great stuff! I'm using it in a 'conventional' looking application - only when the mouse hovers on a button, the text color changes (to light blue). The understatement is, according to a few users, quite cute... In order to keep the classic look, the only way I found was setting m_bIsFlat to false - by using SetFlat(false), of course. But in OnMouseMove(), I was returning before changing the text color. Commenting out the line "if (!m_bIsFlat) { return 0; };" made the buttons work the way I wanted, but I don't feel comfortable with it. Is there any other way to do this? Thanks a lot, Pablo.
|
|
|
|
 |
|
 |
Hey, Does this class support keyboard input(TAB, SPACE, ENTER, etc...)??? If it does, I must be doing something wrong. I assume that it is not working as a result of the messages being reflected to the button, but I could be wrong.
Any help would be apprecitated.
Rob Melchione
|
|
|
|
 |
|
 |
Great article! I'm finding this class immensely useful in my project. One suggestion: would be cool to add custom fonts to the buttons. I see in DrawItem you're just doing DrawText ... so should be pretty simple to add. (I can do it, but ... oh, so lazy.
|
|
|
|
 |
|
 |
I have added CButtonST in mine ATL+MFC the project and has received:
e:\program files\microsoft visual studio\vc98\wtl\include\atlctrls.h(1585) : error C2065: 'ImageList_Read' : undeclared identifier
e:\program files\microsoft visual studio\vc98\wtl\include\atlctrls.h(1590) : error C2065: 'ImageList_Write' : undeclared identifier
|
|
|
|
 |
|
 |
ImageList_Read and ImageList_Write are standard Windows API functions avalaible sin Windows 95 and IE 3.0... There are defined in the header commctrl.h.
Try to check the following points:
- Are you using Visual Studio 6 (wtl requires at least VS6)?
- Have a look inside the file
commctrl.h and look for the declaration of these functions.
- What is the value of the macro
_WIN32_IE? Try to put:#define _WIN32_IE 0x0300 as the first line of your stdafx.h file.
Regards,
Serge
|
|
|
|
 |
|
 |
I am sorry to say I got the same problem, but I am using vs6 / atl 3.1 win2000.... and I put #define _WIN32_IE 0x0300 in the first line of stdafx.h
but it doesnt work......
what can I do ?
|
|
|
|
 |
|
 |
It's the MFC support.. What you can do if you support MFC is to just copy the two prototypes and put them before the WTL-includes in your code.
Best regards
|
|
|
|
 |
|
 |
I don't know if this has to do with the button class or the dialog but I was able to get the sample program to lockup by clicking on the "Click and hold pressed" button. I believe I clicked the button and held down the mouse, draged away and then released the button to get it to lockup.
|
|
|
|
 |
|
 |
Yes that's right.
It seems to be fixed with the following modifications in CButtonST::OnLButtonDown():
SetCapture();
while(PeekMessage(&csMsg, m_hWnd, WM_LBUTTONUP, WM_LBUTTONUP, PM_REMOVE) == FALSE)
{
::SendMessage(hWndParent, WM_COMMAND, MAKEWPARAM((WORD)nButtonID, BN_CLICKED), (LPARAM)m_hWnd);
::Sleep(m_dwPeriodAutoRepeat);
}
CPoint ptCursor;
GetCursorPos(&ptCursor);
CRect rcWnd;
GetWindowRect(rcWnd);
if(rcWnd.PtInRect(ptCursor))
SendMessage(WM_LBUTTONUP);
Max
|
|
|
|
 |
|
 |
There are in fact two bugs:
- The first one is due to the fact that the mouse has not been captured and so if the user release the mouse button outside the button window, the WM_LBUTTONUP message will never been sent
- The second bug is that the icon used when the user relase the mouse button, can be the active icon.
Here it is a simple fix:
LRESULT CButtonST::OnLButtonDown(UINT nFlags, CPoint pt)
{
DefWindowProc();
if (m_bAutoRepeat)
{
MSG csMsg;
int nButtonID;
HWND hWndParent;
bool initialState = true;
nButtonID = GetDlgCtrlID();
hWndParent = GetParent();
SetCapture();
while(::PeekMessage(&csMsg, m_hWnd, WM_LBUTTONUP, WM_LBUTTONUP, PM_REMOVE) == FALSE)
{
::SendMessage(hWndParent, WM_COMMAND, MAKEWPARAM((WORD)nButtonID, BN_CLICKED), (LPARAM)m_hWnd);
::Sleep(m_dwPeriodAutoRepeat);
initialState = !initialState;
}
if(!initialState)
{
::SendMessage(hWndParent, WM_COMMAND, MAKEWPARAM((WORD)nButtonID, BN_CLICKED), (LPARAM)m_hWnd);
}
ReleaseCapture();
SendMessage(WM_LBUTTONUP);
CPoint ptCursor;
::GetCursorPos(&ptCursor);
ScreenToClient(&ptCursor);
SendMessage(WM_MOUSEMOVE, 0, MAKELPARAM(ptCursor.x, ptCursor.y));
}
return 0;
}
Serge
|
|
|
|
 |
|
|
 |
|
 |
Thanks! I have no words!
SoftechSoftware
Davide Calabro'
davide_calabro@yahoo.com
http://members.tripod.com/~SoftechSoftware/index.html
|
|
|
|
 |