|
|
I think it will be much easier should you use a rich edit control.
Best regards,
Alexandru Savescu
|
|
|
|
|
|
Hello,
I have a problem with an edit control. It doesn't get updated until I show a MessageBox.
I have a variable attached to the edit control called m_szText. From outside view class I call a function
void MyView::AddText(CString szNewText)
{
m_szText += szNewText;
if ( UpdateData(FALSE) )
std::cout << "updated" << std::endl;
else
std::cout << "not updated" << std::endl;
}
As those couts go to a debug console, I get to know, if updating has succeeded or failed.
But the result is - no text in the edit control and debug window claims that updating succeeded.
I checked with a small application, that normally this should work.
Where should I continue searching for a mistake??
-Janetta
|
|
|
|
|
Are you calling your AddText function in a lenghtly operation, that is initiated from within the same dialog or another modal dialog of the same thread?
The edit box has no chance to display it's changed content until windows message processing occurs.
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Daniel Lohmann wrote:
Are you calling your AddText function in a lenghtly operation, that is initiated from within the same dialog or another modal dialog of the same thread?
I use SDI and CFormView. First I have an OnButton function in the view that calls a function in the Doc. Doc calls another function in another file (written in C) and that calls another function in another file that calls AddText. I hope I answered the question you asked. And I know it doesn't sound like a very good structure...
I guess I could use your CEditLog in here, but this is so small thing that adding a couple of classes because of this seems too much.
Daniel Lohmann wrote:
The edit box has no chance to display it's changed content until windows message processing occurs.
So should I add windows message handlers OnUpdateEdit and OnChangeEdit for my edit control and call those from AddText? And if so, what should I do in those functions?
-Janetta
|
|
|
|
|
Janetta wrote:
use SDI and CFormView. First I have an OnButton function in the view that calls a function in the Doc. Doc calls another function in another file (written in C) and that calls another function in another file that calls AddText. I hope I answered the question you asked. And I know it doesn't sound like a very good structure...
Yep, this sounds that there is no messange processing during perfoming a lengthy operation. Unless the thead returns from the OnButton function, no message processing occurs.
You have, in prinicple, two possibilities:
- Perform the lenghty operation in it's own thread. In this case I recommend using CEditLog, because it is proven to be thread safe.
- Add some code to the end of your AddText() function that ensures all outstanding messages are processed. It's quite a long time ago I did this last, but AFAIR the following code should do it (taken with slight modifications from MSDN, do a search for "Idle Loop Processing":
MSG msg;
while ( ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if ( !AfxGetThread()->PumpMessage( ) )
{
::PostQuitMessage( );
break;
}
}
LONG lIdle = 0;
while ( AfxGetApp()->OnIdle(lIdle++ ) )
;
Note: I was not able to check this code and I am not an expert on this deep MFC stuff, but I assume it would work. Maybe somebody else with more in-depth MFC knowledge could comment on this.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Thanks!
I tried number two and it worked.
-Janetta
|
|
|
|
|
Hi all,
i'm looking for code samples or components to create flowchart's.
It should looking like in MS Visio.
I need a WorkSheet and then i want place Shapes and Connections between
these shapes. I want to move these Shapes also.
It's for a Programm Generator Program.
Has anybody links / classes or demo applications for me ?
( I'm a newbie in GDI Programming )
Thanxs !
Marco
|
|
|
|
|
Hi everybody,
I have added a button in Internet Explorer. When I toggle this button, I want to write and load values to and from the IE->Internet Options->Connections->LAN Settings->Advanced dialog.
Q1: Does anyone know how to directly (not going through the registry) change the values in the above mentioned dialog?
Q2: If this is not possible (direct access), then I know how to change the registry settings which IE reads every time it is started. However, being a button in IE, I need the registry settings to reflect immediately to IE without closing (now that would be stupid). This may be inefficient but if it's the only solution then how can I do it? I've been told that it could be done by broadcasting WM_SETTINGCHANGE to all top-level windows. But I don't know the syntax of the wParam or lParam argument it expects. I've tried the reg key that was changed and even tried with nothing at all (SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0)), but still the changes are not visible at runtime in IE.
I have a strict deadline in two days and I really need to fix this!!!
Any help would be greatly appreciated,
/Tommy
|
|
|
|
|
On Windows 2000 I need to know whether a particular disk is Basic or Dynamic . Is there a API through which I can get this info' or is it available through WMI(if so what is the WMI class I need to go far).
thanks
Kannan
|
|
|
|
|
I think UINT GetDriveType(LPCTSTR lpRootPathName) should do the trick.
It takes a string to the rootpath and returns an unsigned int containing:
0 The drive type cannot be determined.
1 The root directory does not exist.
DRIVE_REMOVABLE The drive can be removed from the drive.
DRIVE_FIXED The disk cannot be removed from the drive.
DRIVE_REMOTE The drive is a remote (network) drive.
DRIVE_CDROM The drive is a CD-ROM drive.
DRIVE_RAMDISK The drive is a RAM disk.
"After all it's just text at the end of the day. - Colin Davies
|
|
|
|
|
thanks for the info', but I think I need a different type
of information. I think I need to fillin more info.
In Win2K and above OS's you have this option of having dynamic volumes. By default, I think its the Basic volume which can then be converted to dynamic.
You do this by rt clicking My Computer->Manage->Disk Management->Rt. Click on Disk 0 -> Convert to Dynamic Disk. I would like to know whether a Disk is Basic or Dynamic.
thanks again for the reply.
regards
Kannan
|
|
|
|
|
Hello
I am doing a project where I have to display multiple HTML pages in a tabbed format like in the Opera Web browser. I intend to use the Property Pages for the tabbing and CHtmlView for the display.
Can you tell me how to start off? If you have any alternative to using this combination, that would be fine too.
Regards
Sridhar J
|
|
|
|
|
When I use CListCtrl::SetBkImage(..), the function returned FALSE
In my application
In CMyWinApp::InitInstance(..) {...
// I Add
AfxOleinit();
}
void CMyListView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
CListCtrl& ListCtrl = GetListCtrl();
HBITMAP bmp = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), "F:\\jpeg2\\first\\Bk.bmp",
IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
ASSERT(bmp != NULL);
ASSERT(ListCtrl.SetBkImage(bmp)); // Wrong here !!!
....
}
It's me, code_cold
|
|
|
|
|
I have a MFC dialog based app, which is a small setup for another program. This setup may save data with a specific file extension, say ".evl" . So if i double click on a .evl file, it opens automatically my app (Because i asked it to do so the first time i double clicked, you know, with the Open with...) and then ... How do i programatically catch that the user actually started the app by double clicking, and how do i retrieve the file name ???
Thanks
RaGE
~RaGE();
|
|
|
|
|
Check out the following:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (!ProcessShellCommand(cmdInfo))
return FALSE;
Generally, this is put into the InitInstance of the app class.
Dylan Kenneally
London, UK
|
|
|
|
|
I've tried to override ReportSaveLoadException in one of my classes, but when I trace into it, it seems to ignore me!
The class is called COleServerDocEx and is based on COleServerDoc , so I added this to the header:
public:
virtual void ReportSaveLoadException(LPCTSTR lpszPathName, CException* e, BOOL bSaving, UINT nIDPDefault);
And this to cpp file:
void COleServerDocEx::ReportSaveLoadException(LPCTSTR lpszPathName, CException* e, BOOL bSaving, UINT nIDPDefault)
{
} When I trace into it (i.e. tell the app to open a file that I know will fail), I end up in COleLinkingDoc::ReportSaveLoadException - what am I doing wrong?
Dylan Kenneally
London, UK
|
|
|
|
|
Having mysterious problems? 'Rebuild all' can help.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
How should i use an array of BSTR s in some IScriptControl object?
I've tried with VT_ARRAY | VT_BSTR and it doesn't work.
rechi
|
|
|
|
|
|
|
isn't that vierd! (quote from Austin Powers: Goldmember)
and yet, i need the value and all the other OLESCRIPT_ HRESULT values... there seem to be a lot of them mentioned throughout the IActiveScript documentation yet none of them exist
anyway, thanks for your searching
- Roman -
|
|
|
|
|
Hello,
I've a data structure which is nested CArray structures 3 deep (years full of single years full of days full of hours).
Here is my .h code:
<br />
struct t_SchGoal {<br />
UINT Num : 21;
UINT Minutes : 11;
};<br />
<br />
struct t_SchDay {<br />
CArray <t_SchGoal, t_SchGoal&> SchGoal;<br />
UINT AvailableMinutes : 30;<br />
UINT bOverridden : 1;
};<br />
<br />
struct t_SchYear {<br />
CArray <t_SchDay, t_SchDay&> SchDay;<br />
};<br />
Then, there's the member of my document:
CArray <t_SchYear, t_SchYear&> m_SchYears;
In the CDoc init routine, I set all of the "AvailableMinutes" to 60 and I can verify this with the VC++ debugger (shows the nested m_SchYears structure tree and "AvailableMinutes" = 60).
However, when I try to access this value in code:
AvailMinutes = m_SchYears[YearIndex].SchDay[DayOfYear].AvailableMinutes;
I get nothing but 0 (instead of 60 that I KNOW is in there).
Upon trying the following code:
AvailMinutes = ((m_SchYears.GetAt(YearIndex)).SchDay.GetAt(DayOfYear)).AvailableMinutes;
The compiler complains that there is no copy constructor for my structures which is true since they're not classes. CArray has two return values for operator []--one of which is a &TYPE which is why I'm able to get away with the first line. However, it doesn't work.
I would rather not make indidual classes of each of these structures but I fear I may have to. Does anyone have any insight in to finding a way to get what I want? Or general academic comments on this situation?
Thanks!
JennyP
|
|
|
|
|
Sorry, in the last post, the CodeProject system cut out the CArray template definitions ... I'll try to copy it here again...hmm... I cannot seem to find the way to display the carrot symbols.... so I've replaced them with "[]"
<br />
struct t_SchGoal {<br />
UINT Num : 21;
UINT Minutes : 11;
};<br />
<br />
struct t_SchDay {<br />
CArray [t_SchGoal, t_SchGoal&] SchGoal;<br />
UINT AvailableMinutes : 30;<br />
UINT bOverridden : 1;
};<br />
<br />
struct t_SchYear {<br />
CArray [t_SchDay, t_SchDay&] SchDay;<br />
};<br />
JennyP
|
|
|
|