|
Both macros are adding the ability to query runtime information with CObject::IsKindOf for the classes. But only classes declared with DECLARE_DYNCREATE are enabled to be created by CRuntimeClass::CreateObject. Normally all views used inside the "MFC-Document-View-Architecture" were created by the framework by a call to CRuntimeClass::CreateObject.
Hope this helps.
Best regards
Holger Persch
|
|
|
|
|
Hello,
I am relatively new to programming for windows, so bear with me. I am trying to write a program that will read class members from a file and store them in an STL vector. Once that is complete, I would like to have a dialogue with various buttons that will perform operations using the members of that vector.
My question, though, is this: Is there any way to have a single instance of the vector that all of the Buttons' functions can have access to? Should it be a global variable? If so, how does one declare a global variable in VC++6?
Thank you
|
|
|
|
|
Globals are pretty much always a bad idea. If you put your vector into the dialog/window class, that is where you're going to handle click events for your buttons anyhow.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
|
GREETINGS!
I need an advice. I need to create an object or a simple structure with some dynamic arrays. Should i use CArray class for it, and shall i have the problems with serialization and saving this object? Or is there another way?
Thank YOU.
Good luck!
LOVE & PEACE to everyone
|
|
|
|
|
Unless you have pressing reason to use CArray, you should use std::vector, which is much more powerful.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I agree with Christian. std::vector owns! Check out my article, CDataFile[^] for use of it, and reading from a file. I will have an updated version soon that will write to CSV also. But you can use standard serialization if you want.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Thank you for help.
LOVE & PEACE to everyone
|
|
|
|
|
Hi,
I was handling WM_SIZING message to keep a aspect ratio for my window.It works fine if desktop properties
"Show window content while dragging" is checked. else it goes crazy.
How can solve this problem?
Regards
Neha
|
|
|
|
|
What do you mean it goes crazy? Could you elaborate a little more? Does it not allow you to change the size of the window or something like that?
If you want to force the window to have full dragging mode on while you resize this window you can set that value with ::SystemParametersInfo and the SPI_SETDRAGFULLWINDOWS flag.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Neha wrote:
How can solve this problem?
Make sure you're not depending on a WM_SIZE handler for correct behavior, and don't be resizing the window (via MoveWindow() , SetWindowPos() , etc.) from within your WM_SIZING handler.
---
Shog9
This is my December
These are my snow covered dreams
This is me pretending
This is all I need...
|
|
|
|
|
in your code you are using GetWindowRect() function .. ?. If yes then it will not work. At the time when user resizing the window GetWindowRect() returns the old position ( when the Show window content is off)..
Call your Resizing functon in WM_EXITSIZEMOVE Message.
It Will Work All time
|
|
|
|
|
Does anyone know how to change the mainframe's noclient area's back color(toolbar,status bar,etc.),not it's original grey.
Best regards;P
|
|
|
|
|
Non-client area will be painted when the frame recieves WM_NCPAINT message. Then you can paint your own custom window frame in CWnd::OnNcPaint().
|
|
|
|
|
Hi everyone. I have a listview control, in which some items are loaded into when the dialog it is on initalizes. I want to select the first row, that is, have the first row selected so it is highlighted, and will return the row datas when I do . I tried the following code, where 0 is the first row (0), 1 is to set the selected flag active, and LVIS_SELECTED is the selected flag I wish to change:
<br />
m_lvwEMails.SetItemState(0, 1, LVIS_SELECTED);<br />
This does not highlight the first row, nor does it return the selected row when I do the following
<br />
iSelected = m_lvwEMails.GetNextItem(-1, LVNI_SELECTED);<br />
I have tried every permutation of this code, and putting it in different spots in code. No luck, nor does this work with other list views in my program. All list views are fully functional and work as expected otherwise. All list views are set to report style. Anyone know what I might be doing wrong?
|
|
|
|
|
Anonymous wrote:
m_lvwEMails.SetItemState(0, 1, LVIS_SELECTED);
Most likely, 1 != LVIS_SELECTED. Use:
m_lvwEMails.SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
(leave out the LVIS_FOCUSED bits if you're *sure* don't want it to have the focus.)
---
Shog9
This is my December
These are my snow covered dreams
This is me pretending
This is all I need...
|
|
|
|
|
I should have refreshed my browser; I didn't notice you had already answered!
|
|
|
|
|
No worries - you gave a more complete explanation of the problem in any case.
---
Shog9
This is my December
These are my snow covered dreams
This is me pretending
This is all I need...
|
|
|
|
|
I think the call would be:
m_lvwEMails.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);
The state mask and the state information are one in the same in this case. You might have been thinking in terms of TRUE/FALSE for the second param. The LVITEM bitfields can be confusing.
Cheers
|
|
|
|
|
In the article,its name is "Using the CFindReplaceDialog class"
you can see it in:http://www.codeproject.com/dialog/cfindreplacedialog.asp
you can see A Function which names CMyTreeCtrl::OnFindDialogMessage
LRESULT CMyTreeCtrl::OnFindDialogMessage(WPARAM wParam, LPARAM lParam)<br />
{<br />
ASSERT(m_pFindDialog != NULL);<br />
<br />
if (m_pFindDialog->IsTerminating())<br />
{<br />
m_pFindDialog = NULL;<br />
return 0;<br />
}<br />
<br />
if(m_pFindDialog->FindNext())<br />
{<br />
CString FindName = m_pFindDialog->GetFindString();<br />
bool bMatchCase = m_pFindDialog->MatchCase() == TRUE;<br />
bool bMatchWholeWord = m_pFindDialog->MatchWholeWord() == TRUE;<br />
bool bSearchDown = m_pFindDialog->SearchDown() == TRUE;<br />
<br />
<big>FindWhatYouNeed(</big>FindName, bMatchCase, bMatchWholeWord, bSearchDown);<br />
}<br />
<br />
return 0;<br />
}
you see the Function : FindWhatYouNeed().
what is it ? user difined Function?
I Don't difined it
How can i use it ?
without it ,how can i over My FindReplace??
Study Together!
|
|
|
|
|
why don't you post this on the actual article? if you do, the article's author will get a copy of your message and maybe he/she will be able to answer you.
-c
There's one easy way to prove the effectiveness of 'letting the market decide' when it comes to environmental protection. It's spelt 'S-U-V'.
--Holgate, from Plastic
|
|
|
|
|
thanks,
i am afried that i pose but no recall.
i can try it .
thank you.
does any one know the question ,
Study Together!
|
|
|
|
|
|
Hi
CFileDialog problem under win 2000 !!
select 'my document' then the dialogbox lock, didn't work ! only killed by task manager. also 'GetSaveFileName' either.
I'm afraid this is an MFC bug !
below is my sample code, check it !
CFileDialogEx *pDlg = new CFileDialogEx(FALSE,
_T("jpg"),
NULL,
OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
_T("JPG Files(*.jpg)|*.jpg|BMP Files (*.bmp)|*.bmp|AVI Files(*.avi)|*.avi|All Files(*.*)|*.*||"),
NULL);
long nRet = pDlg->DoModal(); // <-- here, don't return when select 'my document'.
delete pDlg;
|
|
|
|
|
I'm not familiar with CFileDialogEx, but I would try CFileDialog first. It takes the same args, and it doesn't seem that you need the Ex version. Everything looks right.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|