I need to get the width and height of the monitor.
i tried with GetWindowRect, I am able to get the width( .right) correctly but when it comes to height, the .bottom shows an integer which will be just more than half of the screen.
I am working in C++ and I need to run an executable , "Process#1", within the context of another executable, "Process#2". Process#1 is bound to throw exceptions and Process#2 must be able to handle the exceptions thrown by process#1. I am unable to handle using createprocess() or ShellExecute(). Please let me know if there is a way to accomplish this.
There is no easy way of doing this apart from Process#1 catching the exception and telling Process#2 what happened using some form of interprocess communication, you cannot throw exceptions across process boundaries which is a good thing.
This is an unusual scenario and, without knowing exactly what you’re up to, I feel safe saying it is probably a bad design decision. That said it is possible. When you use the CreateProcess API you can pass the DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS flags (the second is probably what you’re after) in the ‘dwCreationFlags’ parameter. This flag is used by debuggers, as you probably guessed by the name, and results in exceptions thrown in the child process being reported to the parent. The information is passed to the parent process via the WaitForDebugEvent API. There is more to it that that obviously and, as I said, I don’t recommend using this technique. If you don't know exactly what you're doing you'll make a mess. Also throwing an exception becomes much more expensive for the child as it now results in a context switch to the parent and back to the child again. The child my also behave slight differently in some aspects; for example the ghost window[^] feature will not work in the process being debugged (the child). That said there are protection schemes, such as Armadillo, which use this technique and the software which uses it seems to work ok and when a developer is making an app it works in the debugger. Also note that as a process can only have one debugger attached to it you will probably not be able to use your debugger on it and even debuggers which can work under these conditions (such as WinDBG) will not be as powerful under this environment.
Steve, thank you for all that information. I wish to putforth a little more information that I need.
The child process handles most of the known exceptions, however, the parent process should handle the rest of the exceptions thats not handled by the child process itself. Exception handling by the parent process is a major part of the app that I need to develop.
The only thing you can do is something in the lines of wget. Download each page, parse it and get the next link.
This doesn't give you complete folder listings and may throw you to another http server also.
(usually, when someone asks if something can be done...i take a long time before saying no. In this case there's no doubt)
well yeah..if that's what he needs. If you have a better ideea, post it. Anyway, there's no way of listing files on a http server unless the server. If you're lucky, the server might print the contents of a folder into a html page but that still leaves you with a html page full of links.