|
Well the following line makes no sense ...
for (int i = 0 ; i fImageList.Remove(0);
Hope that solves your problem.
Steve T
|
|
|
|
|
Please help, I think I must be going mad!!
I'm in the middle of writing a class to do owner-drawn buttons (to combine the Cool Button of Norm Almond and the Flat Button of Davide Calabro) and I'm having a bit of trouble with the button styles.
The button I'm testing with has only the BS_OWNERDRAW style set (as enforced by the PreSubClassWindow function override). In the DrawItem override I need to check whether the BS_DEFPUSHBUTTON style is set to establish whether or not to draw a thick border. This is where the problem begins as highlighted with the following code:
BOOL bDefaultBtn = FALSE;
UINT nStyle = GetButtonStyle ();
UINT nAND = nStyle & BS_DEFPUSHBUTTON;
if (nAND == BS_DEFPUSHBUTTON) {
bDefaultBtn = TRUE;
}
BS_DEFPUSHBUTTON is defined in winuser.h (?) as 0x01L which is 0001 in binary, but BS_OWNERDRAW is defined as 0x0BL which is 1011 in binary. So, in the above example, the value for nStyle is 0x0BL (or 1011) as it should be because it's only got the BS_OWNERDRAW style set. But when I bitwise AND it with BS_DEFPUSHBUTTON (0001) I get 0001!!!!!!
The value for BS_DEFPUSHBUTTON also clashes with BS_CHECKBOX (0x02L) and BS_USERBUTTON (0x08L) although this one is now obsolete. So whenever you check an owner-drawn button for the default style it always appear to be the default when it isn't.
You can see this in evidence in either of the above two mentioned owner drawn buttons when they aren't flat because they are always drawn as default buttons, having used GetWindowLong to determine the style and AND'ed it with BS_DEFPUSHBUTTON.
Who's messed up here, me or Microsoft?? Or I am I just being stupid?
Derek.
|
|
|
|
|
Someone may problem me completely wrong
I think I've heard somewhere that you can't have a default button owner drawn, so in the owner drawn code you have to implement your own flag fo displaying a think line around it. Then to make it act as a default button, ( ) play with the tab order.
|
|
|
|
|
Thanks for your input.
It looks like thats how I'm going to have to do it
|
|
|
|
|
Hi Derek,
If you can wait a few days for this, I'm writing an article on how to solve this problem, that is how to enable default state for an owner-draw button.
I wrote 1/2 article, so please be patient.
Paolo.
|
|
|
|
|
So far I've implemented it as a separate function call in the class, which provides access to a boolean data member.
I'll be interested to read your article.
|
|
|
|
|
I need to convert a double to a string, because i want to use setwindowtext, but i don't know we could use ecvt(), or fcvt(). How do they work?
thanks.
gerald
|
|
|
|
|
There's plenty of examples on the web & msdn.
int sign=0, decimal=0;
double dval=9999.9999;
char* str;
str = _ecvt(dval, 10, &sign, &decimal);
Easy way.
char buf[21]={0x00};
double dValue = 9.9;
sprintf(buf,"%.2f",dValue);
Only thing to watch is the precision with formatting strings.
Gerry.
|
|
|
|
|
I have created a Dialog box app. All my processing is in ***dlg.cpp.
The app runs fine except for ... The window does not refresh. I have to move the
mouse over the app to refresh the window.
I have tried ShowWindow(SW_SHOW) and UpdateData(FALSE) to no avail.
Please Help.
Thanx
Leezo
|
|
|
|
|
Neither of these force a paint mesage. When you change your data, call Invalidate(false) to force a redraw without erasing the dialog first. Get rid of false to make it also erase.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I'm using ADO to do a connection with Access database. I have a dlgbox with editbox which are linked to this app. When i do the loop:while(!pRs->EndOfFile)
{
if(m_dlglDate==rs.m_ch_RateDate)
{....}
I would like to return value in an editbox when my test "if" succeeded, so how could i do that?
thanks in advance
gerald
|
|
|
|
|
Do you mean, just pass a value into the editbox field?
if so,I just use DDX &
m_EditControl.SetWindowText("VALUE");
or
SetDlgItemText(IDC_EDIT1,"VALUE");
Gerry.
|
|
|
|
|
yes, exactly, if i could find the value in the database i want to return it in the editbox, but it could be a COleDateTime or a double, so i believe that setwindowtext return string. How could i return a double value or a COleDateTime value in editbox?
|
|
|
|
|
There are plenty of ways to convert a double to a string.
Function _ecvt for one. double to string pointer.
As for COleDateTime,
COleDateTime x(1999, 3, 19, 22, 15, 0);
CString str = x.Format(_T("%A, %B %d, %Y"));
m_EditBox.SetWindowText(str);
Hope this helps....
Gerry.
|
|
|
|
|
Hi All,
I have a query regarding MS Access Database.I am creating a Database & a table in it .I add the Records to the table.The size of teh Database mdb file is increasing as I add the record.But, when I deleted all the REcords in the table in Database, the size of the Database remained the same(as before deletion of REcords).Why is it so ?I am using ADOX to add the Records & the same to delete the Records .
How can I overcome this problem ?
Does in MS Access the size of Database decrease on deletion of Records if any ?If so how it can be done ?
YAMINI
|
|
|
|
|
What I use to do was, to repair the db.
Tools, Database Utilities, Repair
&
Then use compact. Not sure why it happens. Might have something to do with system objects in access?
Gerry.
|
|
|
|
|
Hi All,
I have a query regarding MS Access Database.I am creating a Database & a table in it .I add the Records to the table.The size of teh Database mdb file is increasing as I add the record.But, when I deleted all the REcords in the table in Database, the size of the Database remained the same(as before deletion of REcords).Why is it so ?I am using ADOX to add the Records & the same to delete the Records .
How can I overcome this problem ?
Does in MS Access the size of Database decrease on deletion of Records if any ?If so how it can be done ?
YAMINI
|
|
|
|
|
You have to compress the database. I can not remember how to do it from C++, but it's possible to do through ADO...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hello,
I'm urgently looking for a nice little commandline tool (with stdoutput) to stamp the version of an executable (Major, Minor, Build).
Has anybody come across something?
Thanks,
Matthias
|
|
|
|
|
You can quickly create you own program to extract this type of information.
On nt, you have version.dll, which has windows api function GetFileVersionInfo.
Good luck.
Gerry.
|
|
|
|
|
I want to get the cchTextMax property of treeview item.
I'm using the following:
TVITEM tvitem;
tvitem.hItem = m_tree->GetSelectedItem();
tvitem.mask = TVIF_TEXT ;
m_tree->GetItem (&tvitem);
but it doesn't work
at the same time code:
TVITEM tvitem;
tvitem.hItem = m_tree->GetSelectedItem();
tvitem.mask = TVIF_IMAGE ;
m_tree->GetItem (&tvitem);
works correctly
|
|
|
|
|
You can't get just the length of the item's text. When you set TVIF_TEXT, the control expects you to pass in a buffer (along with its size, in cchTextMax). Since you don't have a buffer, the call fails.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
I want to get the cchTextMax property of treeview item.
I'm using the following:
TVITEM tvitem;
tvitem.hItem = m_tree->GetSelectedItem();
tvitem.mask = TVIF_TEXT ;
m_tree->GetItem (&tvitem);
but it doesn't work
at the same time code:
TVITEM tvitem;
tvitem.hItem = m_tree->GetSelectedItem();
tvitem.mask = TVIF_IMAGE ;
m_tree->GetItem (&tvitem);
works correctly
|
|
|
|
|
Have you tried...
CString strText = m_Tree->GetItemText(m_Tree->GetSelectedItem())
|
|
|
|
|
Hi all,
What is best algorithm for get space between two dates ?
For example space between:
01-02-97 to 05-01-98 ???
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|