|
Hi All,
Is there an API in MFC to run internal test of a hard disk and know its status?
Regards
Abinash Mohanty
|
|
|
|
|
Seems very unlikely. The most likely way of being able to do that would be via an IOCTL[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Why would MFC care about something as low-level as that?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I think assembly is better than c++ for you.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I am in the process of re-writing an application. I cut and pasted the code to test if the OS and application are themed from the old version. Even though a manifest is in the resource file and the app clearly has themes enabled (all the controls are themed) the IsAppThemed function returns FALSE??? The code is:
bool WindowsTheme::CheckThemeActive()
{
PFNISAPPTHEMED pfnIsAppThemed = reinterpret_cast<PFNISAPPTHEMED>(GetProcAddress(themeDllHandle_, "IsAppThemed"));
PFNISTHEMEACTIVE pfnIsThemeActive = reinterpret_cast<PFNISTHEMEACTIVE>(GetProcAddress(themeDllHandle_, "IsThemeActive"));
if(pfnIsAppThemed && pfnIsThemeActive && pfnIsAppThemed() && pfnIsThemeActive())
return true;
return false;
}
IsThemeActive returns TRUE. The display settings under Properties for the .exe has visual styles enabled. I'm at a loss to explain what is happening so any help much appreciated.
|
|
|
|
|
Isn't it enough to check only IsAppThemed[^] for TRUE?
Also check in the drawing code weather OpenThemeData() is successful, when an application uses the old common controls (e.g. has no manifest or themes are globally disabled) calling this function will fail. Also see Using Visual Styles with Owner-Drawn Controls[^] (MSDN).
Hope this helps!
|
|
|
|
|
Well I found the answer to this, but am still at a bit of a loss to explain why. I went back to my original logic and commented things out until I reproduced the error. It turned out to be one line of code. If I commented out:
HtmlHelp(NULL, NULL, HH_INITIALIZE, (DWORD)&m_dwCookie);
IsAppThemed returned FALSE. If I removed the comment, adding this line of code back in IsAppThemed returned TRUE.
|
|
|
|
|
Hi Andrew,
Interesting discovery. Are you able to reproduce this bug in a small VS2008 wizard-generated application?
Best Wishes,
-David Delaune
|
|
|
|
|
Hi,
I am trying to compile this program with Visual Studio C++ 2008 as the compiler in Windows.
It is the program:
#include <stdio.h>
int main()
{
FILE *fichero;
char letra;
fichero = fopen("origen.txt","r");
if (fichero==NULL)
{
printf( "No se puede abrir el fichero.\n" );
exit( 1 );
}
printf( "Contenido del fichero:\n" );
letra=getc(fichero);
while (feof(fichero)==0)
{
printf( "%c",letra );
letra=getc(fichero);
}
if (fclose(fichero)!=0)
printf( "Problemas al cerrar el fichero\n" );
}
It is the error message:
>1.......warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
>c:\archivos de programa\microsoft visual studio 9.0\vc\include\stdio.h(237) : vea la declaración de 'fopen'
>...error C3861: 'exit': no se encontró el identificador
--------
Could anyone help me?
|
|
|
|
|
Please next time before posting read the posting guidelines here[^] (and more specifically, the point 7).
For your question, did you include stdlib.h as stated in the documentation[^] for the exit function ?
|
|
|
|
|
|
First: Please use "pre" tag to format your code so it will be readable.
About the error: Because of poor formatting (not using "pre" tag) i can't see which header you've included but i suppose that it is <stdio.h> . The error message is about the exit function.
To use this function you have to include <stdlib.h> .
Regards,
Nuri Ismail
|
|
|
|
|
|
programmer202 wrote: Could anyone help me?
The warning message is self explanatory. Use fopen_s() instead. If you insist on using fopen() , then define _CRT_SECURE_NO_WARNINGS .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Objective: Modify a dll(binary) to either
1. Call another exe
2. Call another dll (function)
3. Modify the Dll binary by inserting code(Asm/Binary) and generate a shell(cmd.exe)
I know it sounds stupid but I hope you guys got the idea. Please feel free if you need more clarification...I have been trying to do this but no info is available. Now Im wondering is it even possible?
Dll injection/hooking/tampering...any(all) concept is ok, just want to know whats the roadblock to achieve something like this.
Eg:
I have a 3rd part dll called Game.dll. now I want to modify it somehow/anyhow and make it call calc.exe....alrite you guys can laugh !!!!
|
|
|
|
|
Well it's certainly possible, but you will need to know the format of not just the dll but the specific obj portion that you want to modify. There are various technical websites around which may offer tools to help you do this but it is not a trivial task.
|
|
|
|
|
I have an app written in VS 2005, which consists of a single exe file, but when I move it to another machine and try to start it it gives me the error:
---------------------------
C:\Documents and Settings\R\Desktop\MyApp\MyApp\MyApp.exe
---------------------------
C:\Documents and Settings\R\Desktop\MyApp\MyApp\MyApp.exe
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
---------------------------
OK
---------------------------
I haven't created this app, just compiled it, and I needed to link it against wxWidgets (the build mode was "Static Unicode Release Multilib").
On the machine where I compiled it it runs fine. Anyone know what is the problem? When a dll is missing the error message usually tells which one, but I've never seen this error message before.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
Randor wrote: Everytime I come to codeproject.com I experience Deja-Vu[^]
From that Wikipedia page:
This article contains weasel words, vague phrasing that often accompanies biased or unverifiable information.
I could swear I've seen this before...
|
|
|
|
|
Thanks for the answer, I also think that it has to do with VS2005 runtime because the app started on a colleague's computer and he had VS2008.
I tried installing the redistributable package on the virtual machine but it didn't work, and when I tried building with /MT instead of /MD I got this warning:
1>cl : Command line warning D9025 : overriding '/MT' with '/MD'
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
sashoalm wrote: Command line warning D9025 : overriding '/MT' with '/MD'
I believe this means you have set /MD on one or more of your .CPP files. Right click all of the .CPP files in your project and change them all to /MT runtime and the D9025 warning should be gone.
Best Wishes,
-David Delaune
|
|
|
|
|
I found where the problems was, I had compiled wxWidgets under VS2008, now I compiled both wxWidgets and the app under VC6 and it worked.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
So was compiling the app in VS2005 not one of your goals?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Not specifically, the app had 3 different workspaces - for VC6, VS2003, and VS2005, while wxWidgets had workspaces for VC6, VS2003, VS2005 and VS2008. I had just picked the newest versions supported, because the newest is supposed to be the best, not for any particular reason.
The problem was that while the app itself only needed VS2005 runtime, but wxWidgets which had been statically linked introduced dependencies on VS2008 too. That was the problem - the VS 2008 dependency that came with wxWidgets. The computer when it showed up had XP SP2 without any VS installed. When I realized that I figured it's best to compile wxWidgets and the app with the same version of VS and I decided to use VC6 because it gives the least dependencies.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I want to create a table in a database which should contain columns that are just like in the other known database, I know how to retrieve columns information by CODBCFieldInfo structure but how could I convert it to sql string to use in my create table string.
|
|
|
|