|
OK, I'm confused. Unless badjerry.exe is a browser in its own right, it as no business opening pdf files... (I assume it's not a pdf viewer).
And if it only handles .badjerry's, then the article I gave you a link to handles that - if a 2nd instance opens, it communicated with the first, to get the first one to open the desired file, then close the 2nd one.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Iain Clarke, Warrior Programmer wrote: 2/ Is marginally harder, but there are several erticles on codeproject dealing with single instance applications, and their headaches. An article I've recently used to good effect was:
Limiting an application to a single Instance - the MFC way[^].
The procedure from that article seems awfully complicated. I always use this code in InitInstance (if it's a MFC app, otherwise WinMain):
CreateMutex(NULL, TRUE, _T("Unique_String_Identifying_The_Application"));
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
return FALSE;
}
|
|
|
|
|
That's what I used to do to...
But that does nothing about running the previous (only) instance, let alone get the 1st instance to open any document that the 2nd instance had been... instantiated... to do.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
It was slightly off topic, I guess.
I'm still not quite sure what exactly the OP wants...
|
|
|
|
|
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
|
|
|
|