|
Not much you can do unless the person who wrote the app chose to impliment an interface to do so. There is a multitude of ways to do a splash screen, (I have never used the one included with VC), so there is no way of knowing how it is being done. The best you could hope for ( and I'm not suggesting I'd bother ) is to enumerate all windows after you start the program, and hope the splash screen has "slpash" or something on the hidden title so you can call DestroyWindow on it. Even then, you'd see it for a moment.
|
|
|
|
|
unless you want to go the hex way and jump out the slpash screen
|
|
|
|
|
most splash screens run in a separate thread so you'd have to hex jump out the instructions to terminate the thread too ... very icky indeed
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Environment:
Win2K.
VC++6
No service packs.
We can trap the message that is produced by pressing the 3 keys but we aren't able to disable it before the system handles it.
I've thought of hide the window that appears whe I get the message, but I don't understand what happens with my code, it makes all the system crash at the start of my program.
Could you take a look at it and give me an advice?
Thank you in advance.
Joan Murt.
IT developer.
// at the header file of my class.
static LRESULT CALLBACK HookDeMostrarFinestres(int nCode, WPARAM wParam, LPARAM lParam);
//-----------------------------------
// at the implementation file of my class.
// Inside the constructor
this->m_hHookMostrarFinestres = SetWindowsHookEx(WH_CALLWNDPROCRET,(HOOKPROC)this->HookDeMostrarFinestres,AfxGetApp()->m_hInstance,NULL);
// HandlerLRESULT CALLBACK CCtrlTeclesEspecials::HookDeMostrarFinestres(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HC_ACTION)
{
LPCWPRETSTRUCT pRetStructInfo = NULL;
pRetStructInfo = (LPCWPRETSTRUCT)lParam;
if (pRetStructInfo->message != WM_CLOSE)
{
CWnd pWnd;
CString csCaption = "";
pWnd.Attach(pRetStructInfo->hwnd);
pWnd.GetWindowText(csCaption);
if (csCaption == "Seguridad de Windows")
{
pWnd.PostMessage(WM_CLOSE);
}
}
}
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
|
|
|
|
|
It looks like maybe WH_CALLWNDPROCRET is a factor - if you use this, you get the message after it is sent to the destination window. Maybe try WH_CALLWNDPROC to get it before it gets processed.
|
|
|
|
|
I've tried it too with the same result...
Thank you for your time and help.
|
|
|
|
|
Ah - well, a nice thankyou deserves some extra effort!
I found two problems with your approach - first, you must be careful with the hInstance - if your hook is in the application from which its called (not a DLL) use NULL.
Second, the handle that is passed to CallNextHookEx must be shared amongst all applications, and I think this is what was causing the (very noticicable) crashes.
Here's my stab at it - if you create a header file containing this code and a def file containing the SECTIONS statement as shown and include them in your project, you can include the header (once) and you have a system wide keyboard hook.
I think it still only gets the ctrl.alt.del after the system does, but you can play. HTH
LRESULT CALLBACK HookDeMostrarFinestres(int nCode, WPARAM wParam, LPARAM lParam);
#pragma data_seg (".Whatever")
HHOOK g_hHookMostrarFinestres = NULL;
#pragma data_seg ()
class CCaptain {
private:
public:
CCaptain();
virtual ~CCaptain();
};
CCaptain::CCaptain(){
g_hHookMostrarFinestres =
SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)HookDeMostrarFinestres,NULL,NULL);
}
CCaptain::~CCaptain(){
UnhookWindowsHookEx(g_hHookMostrarFinestres);
}
LRESULT CALLBACK HookDeMostrarFinestres(int nCode, WPARAM wParam, LPARAM lParam)
{
MessageBeep(-1);
if (nCode == HC_ACTION) { MessageBeep(-1); }
return CallNextHookEx(g_hHookMostrarFinestres, nCode, wParam, lParam);
}
static CCaptain Hook;
Oops - forgot to mention - I tested this on Win98 only! Don't know if it will work on NT...
=================
later...
Oops - one more goof - just tested a release build, where it works - but only when the app containing the hook has focus. Dang. Oh well... hope it helps the crash problem anyway...
|
|
|
|
|
Have had a look at that code I posted wrt NT, and it is pretty bogus.
For a system wide hook under NT you really want to put the hook in a DLL. I was able to use the code as a local thread hook by supplying a thread ID:
SetWindowsHookEx(WH_CALLWNDPROC,(HOOKPROC)HookDeMostrarFinestres,NULL,AfxGetThread()->m_nThreadID);
but I think thats about the best you can do if the hook is not in a separate lib - on NT anyway. Running this in debug on win98 was misleading.
Am also rethinking the use of the .def file in sharing the handle. Perhaps a #pragma comment(linker, "/SECTIONS... would do the trick.
Anyway, I am thinking out loud here - just thought I'd depreciate that last posting. I'm going to be thinking more on this in the context of a quirk I'm seeing in a project. A local hook might be a useful debug tool - but the code as posted needs a bit of refining.
|
|
|
|
|
if you were allowed to trap and disable the ctrl-alt-del key combo you could totally take over the system and prevent anybody logging on and off, as well as other stuff ... is this possible to do?
also ... just a small point but you are checking for window captions in a way that would break the software should it ever run on a system with different language settings
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
You're not supposed to be able to capture ctrl-alt-del under NT/2000/XP, and for a very good reason.
NT provides what's called a Trusted Path, which is a guarantee by the OS that there is a mechanism which user mode applicatons cannot "simulate" a login or logoff. Ctrl-alt-del is used for this trusted path, and it's part of the Department of Defense C2 security compliance. There are ways to overcome this, such as installing a GINA DLL, but I don't think you can prevent the system from processing ctrl-alt-del first.
|
|
|
|
|
newbie with a simple question for some
facts are
msvc++ 6.0
dialog based prog
created a dialog class called CMain on Cmain i need data input then user pushes ok to move to next window
added a second dialog class called CMain2 when this window pops up it is suppose to have some of the data from dialog 1
i can get everything to work but there is no data
if you can help great email me at fubarsmut@aol.com
|
|
|
|
|
there are many ways ... you could use global data in the app level object ... you could use a shared block of memory ... you could copy data from one to the other after the one exits but before you show the other ... or ... the best way it sounds to me is to use a wizard (a step by step property sheet in effect)
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Can anyone answere following questions:
a)How can I change the active partition of my hard drive using visual
c6.0 working on win2k
b)How can I change the active partion of a remote hard drive. The remote
workstation is running win2k
c)How can I change the active partion of a remote hard drive. The
remote workstation is running DOS.
Thanks,
Saad
|
|
|
|
|
errrrr
from what i remember of that kind of programming doing this is a very dodgy thing to do while a machine is running an OS ... i dont know if its even possible under modern OS's ... on a dos machine you would have to force a remote reboot for the change to come into effect which you can't do without having some kind of network-aware resident app running that would do the reboot on a received command
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Dear all,
How can I read a text file and put all the text into ONE CString?
Thanks for your help!
Vickie
|
|
|
|
|
Perhaps you could open the file binary, get the length, then
read it all into a CString by calling CString::GetBufferSetLength()
first with the size of the file.
"das leid schlaft in der maschine" -Einstürzende Neubauten
|
|
|
|
|
Just kidding...
Seriously, I'm almost finished (*GASP*) with my program and I wanted to thank the following folks for taking the time to lead me in the right direction:
Erik Funkenbusch
ov
lauren
Christian Graus
Chris Losinger
Tim Deveaux
Thanks a million folks! If we could only meet, I'd buy a round for everybody, hehe!
Being a complete and unadulterated newbie, I've tried hard to find information before posting here, only to find out that (in some cases) I didn't look hard enough. Your comments and replies to my questions were a great help.
Just thought I'd thank you folks and give you a little feedback. You are appreciated!
|
|
|
|
|
awwwwwww
thats so sweet
thank you for saying so
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Cool! - a nice warm fuzzie to end the work week! Thanks for the thanks - and for putting my name in such good company! (Ed. No, Tim, we don't have a brown nosed emoticon).
|
|
|
|
|
Well, thank you.
I'm glad it's come together for you, and that I was able to help. As I didn't get the chance to go to Uni, I am 'self educated', which is usually a misnomer - it means I had no formal education, but relied heavily on books and forums like this one. It is gratifying to know I am able to offer the sort of help that got me going when I was starting out.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hi,
I am writing a string class in VC++.I am using array to take user input and to display them to the user.
1.in one function I want to change the complete input to uppercase.
2.In second function I want to change first character to uppercase.
I am giving code for my main class.
main()
{
String A;
cout<<"enter Words:";
String Sentence[ArSize];
char temp[MaxLen];
int i;
int wordLen;
for(i=0;i
|
|
|
|
|
look in the MSDN for "strupr" and "toupper"
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Make a loop. Search for spaces and other characters (like brackets).
Make the next character uppercase, then search for the next character
after that that is a space...
void _MakeSentenceCase(CString& sNewName)
{
int iChar = 0, iLen;
iLen = sNewName.GetLength();
char charUpper;
while (iChar < iLen) {
charUpper = sNewName.GetAt(iChar);
if ((charUpper != '(') && (charUpper != '[')) {
charUpper = *strupr(&charUpper);
sNewName.SetAt(iChar, charUpper);
iChar = sNewName.Find(" ", iChar);
}
iChar++;
if (iChar == 0)
break;
}
}
HTH,
Daniel
"das leid schlaft in der maschine" -Einstürzende Neubauten
|
|
|
|
|
Does anyone know how to create a CSplitterWnd within a CMDIFrameWnd, with only one view (at the left side), and the CMDIFrameWnd at the right side???
CString Dutch = "Double Dutch";
|
|
|
|
|
If you're looking to have a docking view (or just a dockbar)
on the left and the MDICLIENT on the right check out www.datamekanix.com.
"das leid schlaft in der maschine" -Einstürzende Neubauten
|
|
|
|