|
there is a strange thing happening when trying to serialize a COleDateTime member variable of a class.
In fact, i 'm writting:
if (ar.IsStoring()) { // storing
ar << start_date.m_dt;
ar << start_date.m_status;
}
else { // loading
ar >> start_date.m_dt;
ar >> start_date.m_status; // this line does not compile!!!!
}
the commented line does not compile!!!
any ideas why?
thanks for your time
|
|
|
|
|
You can't serialize an enumerated type like that. You can just write the whole COleDateTime object in one go:
ar << start_date; Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hi,
What is your opinion about the expand 'any suitable' function inline ?
Will that cause any problem ? why does the compiler issue warnings while compiling with that option ?
regards.....
Hari Krishnan
|
|
|
|
|
'Any suitable' basically means that the compiler gets to look at every function you wrote and decide whether to inline it. Basically it tries to see whether the cost of inlining the function is more or less than the cost of not doing so - if less, it will probably inline it.
The problem will likely be that your code size will be very large. Most references actually recommend trying to minimize code size in the general case, because more code = more working set = more page faults, typically. A page fault can swamp any benefit you might get from code that would be faster if it had all been in RAM at the same time.
As for the warnings, I have no idea, since I've never used this option. Post a list of the warnings!
--
Mike Dimmick
|
|
|
|
|
thanks.
i better try to minimize code size
Hari Krishnan
|
|
|
|
|
Hi All
i have been given the following code which is used to
Indicate the sort order in list control control, by the
use of up and down arrows (common windows feature)
this works fine for a list control, but i cant get it to work with
a list view, first off i get an error with CHeaderCtrl* HeaderCtrl = GetHeaderCtrl();
saying its an undeclared identifier
has ne1 ne ideas
thanks
si
private:
int m_CurrentSortItem;
bool m_SortAscending;
Constructor -
m_CurrentSortItem = 0;
m_SortAscending = true;
Override Create then after Create is called -
HDITEM HeaderItem;
HeaderItem.mask = HDI_FORMAT | HDI_BITMAP;
CHeaderCtrl* HeaderCtrl = GetHeaderCtrl();
HeaderCtrl->GetItem(m_CurrentSortItem, &HeaderItem);
if (HeaderItem.hbm != 0) {
DeleteObject(HeaderItem.hbm);
HeaderItem.hbm = 0;
}
HeaderItem.fmt |= HDF_BITMAP | HDF_BITMAP_ON_RIGHT;
HeaderItem.hbm = (HBITMAP)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(m_SortAscending ? IDB_UP : IDB_DOWN), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
HeaderCtrl->SetItem(m_CurrentSortItem, &HeaderItem);
Finally -
void OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<lpnmlistview>(pNMHDR);
HDITEM HeaderItem;
HeaderItem.mask = HDI_FORMAT | HDI_BITMAP;
CHeaderCtrl* HeaderCtrl = GetHeaderCtrl();
HeaderCtrl->GetItem(pNMLV->iSubItem, &HeaderItem);
if (HeaderItem.hbm != 0) {
DeleteObject(HeaderItem.hbm);
HeaderItem.hbm = 0;
}
HeaderItem.fmt |= HDF_BITMAP | HDF_BITMAP_ON_RIGHT;
m_SortAscending = (m_CurrentSortItem != pNMLV->iSubItem) ? true : !m_SortAscending;
HeaderItem.hbm = (HBITMAP)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(m_SortAscending ? IDB_UP : IDB_DOWN), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
HeaderCtrl->SetItem(pNMLV->iSubItem, &HeaderItem);
if (m_CurrentSortItem != pNMLV->iSubItem) {
HeaderCtrl->GetItem(m_CurrentSortItem, &HeaderItem);
HeaderItem.fmt &= ~(HDF_BITMAP | HDF_BITMAP_ON_RIGHT);
if (HeaderItem.hbm != 0) {
DeleteObject(HeaderItem.hbm);
HeaderItem.hbm = 0;
}
HeaderCtrl->SetItem(m_CurrentSortItem, &HeaderItem);
m_CurrentSortItem = pNMLV->iSubItem;
}
SortItems(SortFunc, (DWORD_PTR)this);
*pResult = 0;
}
|
|
|
|
|
CListView is not derived from CListCtrl . You have to use GetListCtrl() to get a reference to the list control, and then use that to get the header, etc.
CListCtrl &list = GetListCtrl();
list.GetHeaderCtrl(); Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi y'all!
Can anyone tell me how to create a Win32 DLL that will use a Dialog Box inside its code??
|
|
|
|
|
In VC++ just create a simple DLL, and inside the DLL create the window as usual with CreateWindow() , everything will work fine
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi
Dont forget use AFX_MANAGE_STATE(AfxGetStaticModuleState())
before invoking dialog box see MSDN
|
|
|
|
|
real_space_monkey wrote:
AFX_MANAGE_STATE(AfxGetStaticModuleState())
Not for a Win32 DLL
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
It's only necessary in a MFC DLL.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi All
does any1 know how you get the little arrows, showing the direction
of the sort when you click on a cloumn with a list control
you get an up arrow and a down arrow
the ones you see in, say windows explorer
using OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult)
can ne1 point me in the right direction
thanks
si
|
|
|
|
|
If you're targetting WinXP only, the HDF_SORTUP /HDF_SORTDOWN styles for items in the header control enable the sort arrows. They won't appear on any OS less than WinXP though.
You would set this in OnColumnClick() as you said.
For OSs before WinXP, you'll have to subclass the header control and handle the WM_PAINT message to do it yourself, or use custom draw.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
How can I show an animation for instance a film in desktop instead wallpaper?
For example see:
Winamp 2.9x[^]-> Advanced Visualization Studio v2.6 --> Setting Display --> Ovelay Mode --> Set Desktop to Color!!
|
|
|
|
|
I think this hard work, what dont have simple decision.You can try to do this step:
1.Store desctop image in memory
2.Set transparency bit mask of this image as background color of this image.
3.Overlay this image on picture what represented frame of you animation. Finaly you get frame of you animation with folders images on one.
4.Check all mouse action on desctop image ,what allocated in memory ,for determine whether mouse click by folder.If its occur break you application, enable new folder open in oredr to anew store desctop image in memory and begin all routines anew.
Also you should catch tab key and start button for properly reaction on this action.
This very raw instance of work and not fact what its simplest way for you.
Sorry for bad eanglish
|
|
|
|
|
Hi,
I have a custom control in wich I want to display some vertical text. I want also, before drawing it, know the size this text will take.
For horizotal text, it's simple I can use CDC::GetTextExtent(const CString& str) and CDC::ExtTextOut(...) methods.
Any idea?
Thanks!
|
|
|
|
|
Ok, I found something .
This will look like:
CFont NewFont;
CFont* pOldFont;
NewFont.CreatePointFont(nFontSize,lpFontName,pDC);
if (!bIsHorizontal)
{
LOGFONT* pLogFont;
NewFont.GetLogFont(pLogFont);
pLogFont->lfOrientation = 900;
CFont VertFont;
VertFont.CreateFontIndirect(pLogFont);
pOldFont = pDC->SelectObject(&VertFont);
}
else
pOldFont = pDC->SelectObject(&NewFont);
(Not sure about the orientation value but I will check it).
Sorry to have disturbed you
|
|
|
|
|
You can use GetTextExtent() for vertical text as well - just swap the height and width around
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Not sure 'bout that. I don't think that the width and the heigth are equal for each characters (for example, 'i' is not a perfect square).
In fact I develop for PocketPC so, if I can earn a pixel, I will do it !
Nowaday thanks
|
|
|
|
|
cedric moonen wrote:
I don't think that the width and the heigth are equal for each characters (for example, 'i' is not a perfect square).
That's right, but it doesn't matter. If you get the size of the entire string (say 100 pixels wide and 20 pixels high), and rotate it 90 degrees, the text will now be 20 pixels wide and 100 pixels high.
Or do you mean that you rotate the string, but not the characters? eg.
A
B
C
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Mmmh, that's rigth ! First I wanted just rotate the string and not the characters but I think it will be ugly.
So now I can just invert the width and the height of the rectangle !
Thanks
|
|
|
|
|
You're welcome
BTW, to rotate the text and the characters the same amount, set the lfOrientation and lfEscapement members of the LOGFONT structure to be the same . In fact, this is the only thing that works under Win9x/ME, which don't support letters rotated differently to the entire string (if that makes sense... )
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I am intrested to know ,what are the issues will arise if i write a OCX /DLL in VB and use it in vc++ .If there is any article on that ,please do mention
|
|
|
|
|
No problems. Just make sure you get the parameter types correct in VC++.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|