|
i havent checked mike ryan's article in depth but you will want to be using the Process Status API (PSAPI.DLL) and the Virtual DOS Machine Debug API (VDMDBG.DLL) to get at the info you want
to get the 16-bit tasks inside the VDM's use VDMEnumTaskWOWEx():
if (!stricmp(szProcessName,"ntvdm.exe"))
{
VDMEnumTaskWOWEx(processID,EnumWin16Processes,0);
}
check the VDMDBG.H file for the info on this call
if the VDM is running an msdos app rather than hosting a WOW box it wont call your callback
the callback function EnumWin16Processes:
BOOL WINAPI EnumWin16Processes (DWORD dwThreadID,WORD hMod16, WORD hTask16, PSZ pszModName,PSZ pszFileName, LPARAM lpUserDefined)
{
wada wada wada ...
}
hope this helps
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hi Lauren,
Many thanks for your advices.
I'll try it soon.
Best regards.
|
|
|
|
|
Ok first I'm really new to windows programing, so I'm working on a really simple automation program for some of the webpages I visit, one of the things I need to be able to do is autofill and submit an HTML form on a page, I've been looking at some MSHTML methods, and it seems to be there I just don't see how exactly I can retrieve the form and modify its elements, if someone could help me out it would be really appreciated. and secondly if anyone has some good web references for MSHTML or C++ in general they wouold be greatly apprciated as well ,as I've found them very hard to come by esp. geared for begginers, MSDN reads like greek to me at the moment.
Thanks, ßlack Widow
|
|
|
|
|
Help!! How can I detect in Visual C++ the state of the phone line?
The phone line is used by another application.
I'm posting from Italy.
When something go wrong (for instance: an error dialing) I don't find a "busy" line (I could detect this), but a kind of "answer" telling me "this number is temporarily unavailable. Try later.", not a modem answer (I dialed the number of an ISP). Then the line begins a kind of "fast busy"; after this there's silence. Can I detect this "fast busy" at least?
Thank you very much.
|
|
|
|
|
I am working on telephone signaling using modems and tones. From what you say, you have a few big problems. I don't know how experienced you are so I assume you wan't to know as much as possible.
Firstly, if another application has the modem you cannot normally see what is comming in unless that other application co-operates. The serial port cannot be shared.
Secondly, modem technology is, how shall I say, pazzesco nel capo. It is very difficult to get it to do the right thing unless you wan't to do very ordinary simple things. Each modem is set up for a particular country (or countries) at the factory and some countries do not allow you to change important settings. If your modem does not detect the "fast busy" it means that this is not a recognised tone-sequence in your country.
There is a solution but it is hard. I am going to solve my own problems this way. You have to write a customised serial port driver and use the voice modem commands (I assume you are using a voice enabled chipset) to detect the "fast busy". The driver is difficult enough to write even if you know how. The voice commands and timing have a few tricks as well. This solution is probably not what you are looking for but I have been unable to find any other way of detecting non-standard signals outside of applications without external hardware.
I believe that there might be something in TAPI3 which could help you but I don't use TAPI so I don't know. Buona fortuna!
|
|
|
|
|
Help!! How can I detect in Visual C++ the state of the phone line?
The phone line is used by another application.
I'm posting from Italy.
When something go wrong (for instance: an error dialing) I don't find a "busy" line (I could detect this), but a kind of "answer" telling me "this number is temporarily unavailable. Try later.", not a modem answer (I dialed the number of an ISP). Then the line begins a kind of "fast busy"; after this there's silence. Can I detect this "fast busy" at least?
Thank you very much.
|
|
|
|
|
maybe use the tapi functions
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Since you say you can detect a "busy", I would guess that you are already using TAPI.
Look into "LINEBUSYMODE_TRUNK" and "lineGetCallStatus" in the TAPI help.
Peace!
-=- James.
|
|
|
|
|
I need not to show the splash screen of an app that I haven't done, how could I do it?
Thank you in advance.
Joan Murt
|
|
|
|
|
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
|
|
|
|