|
I've tried it with WM_CTLCOLOR but unsuccessful. Now I will try with WN_ERASEBKGND, thanks )
|
|
|
|
|
Hi,
I'm new to Carchive and Serialization so i will try to be as detailed as possible with my question.
I currently have a dialog box with a CListCtrl and what i want to do is serialize the CListCtrl. From what i have read , serialization will allow you to recreate your object/class based on storing member variables. I find code where they do this for one variable at a time i.e.
archive << m_bMyVariable;
etc...
i don;t know about you but i do not find this useful at all... i could write all this code myself...
what is special about the serialize() function?
what does IMPLEMENT_SERIAL do?
what i'm trying to do is take a "snapshot" of my list control with all its items, the currently selected item, the currently checked items etc... and save it to file so i can reload that state when i show the dialog box again.
now I could do this all manually but i thought i had seen something useful in serialization.
am i braking up the wrong tree?
thank you in advance,
|
|
|
|
|
If I click on my item in the CListCTrl, I cycle back to the red line THREE times (just from one click). I thought one click means the itemchnaged function runs ONCE...?
void CSearchView::OnItemchangedListctrlkeys(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if (pNMListView->uOldState == 0 && pNMListView->uNewState == 0)
return;
<code> m_optionsListBox.DeleteAllItems();</code> this breakpoint is stepped into THREE times and after the third time the UI shows up. Why three times and not just once?
Appreciate your help,
ns
|
|
|
|
|
Check the flags that get passed in the message. The old item gets unselected (one message) and the item you click on gets selected (second message). Not sure where the third one comes from, but check the state flags and it should be apparent.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
Hi! I'm a sig virus. Attach me to the end of your sig to help me take over the world!
|
|
|
|
|
The sequence goes something like this.
Selected
Repaint
Update due to repaint
Kuphryn
|
|
|
|
|
Ah - Thanks!!! Now I have to figure out how to set a flag which depends on stuff happening, and it gets set the first time around, but the subsequent two times it gets unset....
Like initially (firtst pass),, if my map is empty, so I say m_flag = TRUE, else false. Then it goes and fills the map. So obviously second time it passes through it sees that the maps filled and then of course the flag gets unset ad leads to chaos.....but at leat sI can see why now and can try to work around it.....
Appreciate your help,
ns
|
|
|
|
|
Ok, I know I am supposed to use ON_UPDATE_COMMAND_UI handlers for each menu item, but is there a way to do it for allof them from one function? I have a ton of these to go through if that is the case!
(I just want to enable-disable them)
Thanks
|
|
|
|
|
Yeah, just hook all the IDs up to the same function (i.e., when ClassWizard supplies you with a function name, just change it to be like OnUpdateAllMenuItems, and do this for every menu item you want to enable/disable at the same time).
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
Thank you. I got it all working!
Now I have a new problem.. When some of the top-level menues are disabled, then re-enabled some time later, they are not correnctly redrawn. They have the white from being diabled, and they aren't updated until the mouse is moved over them.
How can I get the whole top-level menu redrawn? (File, Edit, etc.)
Thanks again!
|
|
|
|
|
Call the DrawMenuBar member of your CMainFrame class. If you are doing the enable/disable in a class other than CMainFrame, you can do this:
AfxGetMainWnd()->DrawMenuBar();
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
Is there a way to add tool tip text for a button that was dynamically added to a tool bar?
So far, I have managed to add the button and image but the tool tip never attempts to come up. From what I have seen so far, everything seems to want to use a string resource ID instead of a char* somewhere. Does anyone know if this can be done?
Does anyone know where the tool tip "LoadString()" happens?
thanks,
Dave
|
|
|
|
|
Handle the TTN_NEEDTEXT notification in your CMainFrame class (you have to add it manually, not from ClassWizard). Inside the notification function, you can check what the ID of the item is, and if it's your special toolbar button, you can specify your own text to be displayed. I can set up a small demo if you want.
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
Thank you very, very much. You have just saved an entire day of screwing around. This is exactly what I needed.
|
|
|
|
|
|
Hi,
Does somebody know a secure solution to ensure that the DLL an application
is talking to hasn't been replaced with a fake one?
I am thinking about implementing a "handshaking" procedure. With this
method, the application sends a "challenge" random message to the DLL. The DLL responds with a value calculated using a one-way hash function. The application checks the response against its own calculation of the expected hash value. If the values match, the authentication is acknowledged; otherwise the application is terminated.
Do you know other/better solutions?
Remark: I am developing both the application part and the DLL part.
Thanks.
antoine
|
|
|
|
|
antoine_boillier wrote:
The DLL responds with a value calculated using a one-way hash function. The application checks the response against its own calculation of the expected hash value.
the cracker finds this one-way hash function in the DLL and implements it in his own DLL.
it's a tough problem.
-c
Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey
|
|
|
|
|
This is usually done by cryptographically signing the dll. This too is not fool-proof.
|
|
|
|
|
I have a property sheet that contains 5 property pages. One of my pages (let’s call it the summary page for this discussion) is not initially visible, and contains a list control that keeps track of all interaction with the other pages. When I first run the program, I can’t write anything to the summary page until I select the summary tab. I believe it’s because the OnInitDialog member function hasn’t been called for the summary page, until it’s displayed for the first time. Unfortunately, I configure my list control (set up headings) in the OnInitDialog member function of the summary page, and until I do, I can’t use it!
Is there something I can do to force all property pages to “initialize” prior to being displayed for the first time
I’ll keep searching for the answer myself, but I find that someone usually posts the answer before I find it!
Thanks
|
|
|
|
|
work_to_live wrote:
Is there something I can do to force all property pages to “initialize” prior to being displayed for the first time
You can do this on a page-by-page basis. Add the PSP_PREMATURE style to the PROPSHEETPAGE struct for each page you want created right away.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
Hi! I'm a sig virus. Attach me to the end of your sig to help me take over the world!
|
|
|
|
|
That sounded like it would work, but here's what happened...
I'm using MFC (may be the problem), CPropertySheet and CPropertyPage.
Here's how I modified the style...
m_cResultsPage.ModifyStyle(0,PSP_PREMATURE);
Then I added all the pages...
m_cSheet.AddPage(&m_cConfigPage);
m_cSheet.AddPage(&m_cCommandPage);
m_cSheet.AddPage(&m_cMeasurePage);
m_cSheet.AddPage(&m_cAlarmsPage);
m_cSheet.AddPage(&m_cIdentPage);
m_cSheet.AddPage(&m_cResultsPage); // This is my summary page
m_cSheet.Create(this, WS_CHILD | WS_VISIBLE, 0);
But I failed the debug assertion in ModifyStyle!...
BOOL CWnd::ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags)
{
ASSERT(::IsWindow(m_hWnd));
if (m_pCtrlSite == NULL)
return ModifyStyle(m_hWnd, dwRemove, dwAdd, nFlags);
else
return m_pCtrlSite->ModifyStyle(dwRemove, dwAdd, nFlags);
}
Still searching...
|
|
|
|
|
As soon as I hit the submit button, I realized what I had done wrong. I had to directly manipulate the prop sheet structure as follows...
m_cResultsPage.m_psp.dwFlags |= PSP_PREMATURE;
Then it worked!
Thanks
|
|
|
|
|
work_to_live wrote:
I had to directly manipulate the prop sheet structure as follows...
That's it
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
Hi! I'm a sig virus. Attach me to the end of your sig to help me take over the world!
|
|
|
|
|
Consider ShowWindow().
Kuphryn
|
|
|
|
|
I don't want to display, or flash the page. I want to be able to use the controls before it's selected for the first time.
|
|
|
|
|
Is it possible to add a bitmap as a "top-level" menu item in a window's menu bar? I understand you can use bitmaps in submenus as owner-draw type menus, but I'm having trouble adding a bitmap to the toplevel menu. Any help would be much appreciated
Thanks,
Ben
|
|
|
|