Hello, that's still not quite what i want, maybe i'm going about it all wrong. The dialog box has a text box inside, and i would like this to display text strings about the status of the program to the user. The whole process needs to be launched by pressing a button, which launches the form, and only then once the form and controls are visible can the program's main function begin as otherwise any realtime messages to the controls won't be visible. I know i could probably do this more efficiently using another thread but i thought it would be much more complex and error prone. Is there a better way of doing this? Thanks a lot for all your help btw.
sschilachi
Posts
-
How to know when Dialog is open -
How to know when Dialog is openI have done everything you have said above, and it still calls the message handler before OnInitDialog() returns, so the dialog is not visible. Have you tried this yourself to see if it works, am i making a silly mistake somewhere? This is my code:
#define UWM_DELETEFILE (WM_APP + 1) LRESULT OnDeleteFile(WPARAM wParam, LPARAM lParam); BEGIN_MESSAGE_MAP(CStatusDlg, CDialog) ON_MESSAGE(UWM_DELETEFILE, OnDeleteFile) END_MESSAGE_MAP() BOOL CStatusDlg::OnInitDialog() { CDialog::OnInitDialog(); PostMessage(UWM_DELETEFILE ); return TRUE; } LRESULT CStatusDlg::OnDeleteFile(WPARAM wParam, LPARAM lParam) { //dialog should be visible but isn't }
-
How to know when Dialog is openI haven't overridden anything, that's the problem, i don't know what to override that would work the way i want it to? Any suggestions? Thanks -- modified at 17:28 Thursday 8th June, 2006
-
How to know when Dialog is openHow do you advise doing this, because when i use postmessage with a WM_COMMAND message, the dialog isn't displayed until the handling function has ended? -- modified at 17:28 Thursday 8th June, 2006
-
How to know when Dialog is openI would like call a function as soon as a dialog is open and visible, but i cannot find a way of telling when this is so. The dialog is a simple CDialog and is run by using DoModal. I have tried OnInitDialog amongst a number of other overrides but they all seem to be called just before the dialog is displayed. Any help would be greatly appreciated. Thanks
-
Registry export/mergeHello, I would like to backup and restore registry keys to and from a .reg file like the one that regedit.exe creates when you export registry keys, and i was wondering whether there was an API or COM function that would do this for me without having to code it myself. I have tried looking but don't have a clue where to start, if someone could point me in the right direction it would be much appreciated. Thanks a lot
-
Default Menu ItemI have tried that but for some reason it does not seem to work, that is why I asked the question in the 1st place. Thanks
-
Default Menu ItemI have the following code to set one of the menu items as a default one (it should go bold), however the menu item is not displayed bold for some reason:
MENUITEMINFO menuItemInfo; menuItemInfo.cbSize = sizeof(MENUITEMINFO); menuItemInfo.fMask = MIIM_STATE; VERIFY(pSubMenu->GetMenuItemInfo(IDC_SHOWWINDOW,&menuItemInfo)); menuItemInfo.fMask = MIIM_STATE; menuItemInfo.fType = MFS_ENABLED|MFS_DEFAULT; VERIFY(pSubMenu->SetMenuItemInfo(IDC_SHOWWINDOW,&menuItemInfo));
Both GetMenuItemInfo() and SetMenuItemInfo() are successful as they return 1, but I cannot figure out why it doesn't display the menu item as bold. Any help would be greatly appreciated Thanks -
Startup computer automaticallyI actually meant is there any way to turn the computer on automatically at a specific time, when it has been turned off manually. For example could I program the computer to boot up at 8 o'clock every morning? If not, is there any way to bring the computer out of standby mode in the same way, ie bring the computer out of standby at 8 o'clock every morning. Thanks
-
Startup computer automaticallyIs there any way to boot up a computer automatically at a specific time from a program, ie run the program, call a function (???) and then switch off the computer, and then the computer would start up automatically at the specified time. If not then is there some way of bringing the computer out of hibernation in a similar way??? Thanks
-
CDateTimeCtrlNo, I looked absolutely everywhere and tried just about everything but I eventually gave up as I couldn't find a solution anywhere. If I do have any success I will let you know, and could you do the same if you find a solution. Thanks
-
CEditView re-sets caret position on saveI have created a program using the doc/view architecture, and using CEditView as the view window. When you are typing something, and then save the document, the caret is moved back to the start of the text, and I want to know how to stop this from happening. I have tried responding to the ON_FILE_SAVE message, and finding the position of the caret with
pCaretPoint = CEditView->GetCaretPos()
, then callingCDocument::OnFileSave()
, and then usingCEditView->SetCaretPos(pCaretPos)
to set the caret position to its initial position, however I think the caret gets re-set after CDocument::OnFileSave() as this has no effect. Any help is much appreciated -
Responding to a laptop lid closeIs there any message generated when a laptop lid is closed, as I would like to run a function when the lid has just been shut? Thanks
-
EncryptionI would like to encyrpt the contents of my program before I write them to a file. How do I go about encypting the data before I write it to a file, (at the minute I am using serialization). One limitation is that I don't want to serialize the data to a temporary file and then encrypt the file as if the unencrypted file still exists then the data is not secure. Could someone please just get me started, as I am not sure where to look as many encryption tutorials on this site encrypt and decrypt a file that already exists, I want to encrypt data in memory and write it to a file encrypted, then read the encrypted data back into the program's memory. Thanks a lot
-
CMonthCalCtrlI have a MonthCalCtrl control in a dialog box. I want to set the daystates for the Month Cal Ctrl, the thing is I have a CArray of COleDateTime objects, and I'm not sure how to best set the daystates. Should I respond to the MCN_GETDAYSTATE message, and just update the visible months, or is there a way to set all of the daystates (visible or not) in the CDialog::OnInitDialog() function? Any suggestions welcome, Thanks
-
Setting Dialog Box positionHow do you set the position of a dialog box, as you cant call SetWindowPos before DoModal, nor can you call it after, as the dialog box window doesnt exist. Thanks
-
CDateTimeCtrlI have tried to destroy the control using pMonthCalCtrl->DestroyWindow() in response to the user clicking the dropdown button, however, I get an access violation when i run it, how do you destroy the MonthCalCtrl? Thanks
-
CDateTimeCtrlThanks, I haven't got time to try that tonight but I will look at it tomorrow
-
CDateTimeCtrlI know that, I am using the following code in an OnDtnDropdown() message handler for my own wrapper of the CTimeDateCtrl object that is an object in my own custom Toolbar:
CMonthCalCtrl* pCtrl = (CMonthCalCtrl*) GetMonthCalCtrl(); ASSERT(pCtrl != NULL); pCtrl->ModifyStyle(0, MCS_DAYSTATE); SYSTEMTIME timeFrom; SYSTEMTIME timeUntil; int nCount = pCtrl->GetMonthRange(&timeFrom, &timeUntil, GMR_DAYSTATE); LPMONTHDAYSTATE pDayState; pDayState = new MONTHDAYSTATE[nCount]; memset(pDayState, 0, sizeof(MONTHDAYSTATE) * nCount); int nIndex = (timeFrom.wDay == 1) ? 0 : 1; pDayState[nIndex] |= BIT4; pDayState[nIndex] |= BIT19; pDayState[nIndex] |= BIT25; pCtrl->SetDayState(nCount, pDayState); delete [] pDayState;
However when I call pCtrl->SetDayState(), it is there that the problem occurs and it directs me to the line that asserts that i previously mentioned. TheModifyStyle
function used in the third line seems to have no effect, as I checked the return value from pCtrl->GetStyle() before and after the call to ModifyStyle and the result was the same. By the code to create the CMonthCalCtrl I meant the code that is prewritten in the source code provided with Visual C++, not the code the user writes. Thanks -
CDateTimeCtrlI also tried ModifyStyleEx and that had no effect either.