|
I looked and every other file in a MFC app had this line so I added it and the program compiled.
<br />
#include "stdafx.h"<br />
I hate Microsoft.
What does "The configuration registry key is invalid." have to do with no including "stdafx.h"?
Can anyone know why I need to add this header file to all my .cpp files?
|
|
|
|
|
Raskolnikov wrote:
Can anyone know why I need to add this header file to all my .cpp files
THe simple answer: Precompiled headers
It makes a huge difference in compile times, however it is not hte most logical thing to use in the settings
You can turn it off for the whole project if you go to "Project Settings" and click the "C++ tab" and the "Precompiled Headers" category.
If you click on "Not using procompiled headers" it will get rid of this problem but considerably slow things down.
If you just want to shut it off for the file, then you can click on the file (still in the project settings dialog) and for the precompiled header settings just turn them off ONLY for the offending file.
If you are doing MFC stuff it is worth leaving them on
|
|
|
|
|
I don't mind the feature now that I know what it does, but the error message bites. "must #include stdafx.h when using precompiled headers" or any error message that mentioned either stdafx.h or precompiled header would be better than a cryptic message about an invalid registry configuration key.
Maybe the message makes sense to the implementers, but error messages should be written at the users level of abstraction!
|
|
|
|
|
The message was
fatal error C1010: unexpected end of file while looking for precompiled header directive
and it is not at ALL cryptic. Your precompiled header does not need to be called stdafx.h, and it's reasonable to consider that the user of a C++ compiler will either know what a precompiled header is, or be able to find out.
BTW you can also tell the compiler to automatically use precompiled headers with stdafx.h, and it will simply not use the precompiled headers where stdafx.h is not included. But it's usually better to include it everywhere, stdafx is a good central point to include libraries you want visible through the project, etc. For example, you'll find my stdafx is always going to include string, iostream, sstream, fstream, vector and algorithm with appropriate using statements as a minimum
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
The compiler error was fine, what I was upset about was the result I got when I tried to find further informaiton about the error using the error lookup tool, which I know now has nothing to do with compiler errors.
Anyway I have been using C++ compilers for years, mainly with compand line compilers like gcc but I have never heard of precomiled headers or precomiled header directives. The Visual C++ .NET book I am just read fails to mention them.
|
|
|
|
|
Hi,
Can anyone tell me how to make a Splash Screen using VC++ ?
I am used to the Visual Basic style :
frmSplash.show
do our initialization work
frmSplash.hide
With VC++, when I create a splash screen dialog box, then write:
CSplashDialog dialog;
dialog.DoModal();
Sleep(1000); /* or do my init stuff */
dialog.EndDialog();
It seems like the system gets stuck in the dialog.DoModal() function.
How to change the code ? Do I have to do my stuff inside my splash dialog ?
Thanks a lot
|
|
|
|
|
|
If you're using VC6, go to Project/Add to project/Components and controls/Visual C++ components. There's a Splash Screen component which is ready to use.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
All,
I was wondering if anyone has had issues with FtpGetFile. This behavior is rather odd; the file is there but cannot be downloaded. I have had my remote user check out the file security/privileges; they appear to be in order. I would like to be able to provide more information. However, since this is happening at a remote site, I do not have more information. Does anyone have any ideas?
Thanks in Advance,
Rich
|
|
|
|
|
Hi,
How can i read the unicode string from a file?
Thanks
Neha
|
|
|
|
|
Hi people,
A small question.
In a dialog-based app, why is it impossible to start up a new dialog after the main dialog closes? (i.e. right after the DoModal returns in the app's InitInstance handler)
Even when you try to pop up a simple MessageBox it doesn't show. You can just hear the typical MessageBox 'Bling', but then the app shuts down.
Can anyone explain why this is the case? And what I should do to achieve my goal: showing a 'saving, please wait' dialog after the users hits finish in my wizard.
Thanks a lot for your help,
ren
|
|
|
|
|
|
|
Hey, I posted this once and I am hoping to get some suggestions this time. If nobody knows, hey, that is life. I am trying to set the font/color, etc, for text in a multiline text editor. The user can highlight as many lines (or chars) as he/she wants, and then change all the text that has been selected to the font/color. The problem is that it is not working. I get the font characteristics, then call EM_SETCHARFORMAT with the SCF_SELECTION. According to MS website, this will change all the selected text. It doesn't. It seems, when there is a carriage return or word wrap of some kind, it cannot handle these characters. So it only changes 1 line. I do not know how to get around this. I have used EM_EXGETSEL and then send EM_EXSETSEL, this doesn't help either. Does anybody have any ideas? I have no clue how to get around the word break chars.
|
|
|
|
|
|
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
|
|
|
|