|
Joe Woodbury wrote:
Many existing APIs don't distinguish between critical, major or minor error codes. In many cases, it turns out that the API will never return a critical error code.
In that case, it's a good thing that Microsoft is moving to a more stable/logical design, isn't it ?
Joe Woodbury wrote:
(I've written functions which return error codes that should only be checked during testing since the function is designed to fail in a designed way internally.)
Naturally, when you own the code, you can choose to employ whatever mechanism that seems right to you. But it has been a problem under windows that many API's do return meaningful error information, which is never stored or referred to.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
In that case, it's a good thing that Microsoft is moving to a more stable/logical design, isn't it ?
But they aren't. Simply because .NET has a more consistant error model doesn't mean the OS is. Moreover, I don't see that as making anything intrinsically more stable. Not that it matters, we have what we have.
Christian Graus wrote:
But it has been a problem under windows that many API's do return meaningful error information, which is never stored or referred to.
I seriously fail to see your point. As I said, for many API's the error information may be interesting, but may still be safely ignored. (Even in .NET you can catch an exception then ignore doing anything about it.)
|
|
|
|
|
Joe Woodbury wrote:
(Even in .NET you can catch an exception then ignore doing anything about it.)
Yes, but you must *explicitly* ignore it.
Joe Woodbury wrote:
As I said, for many API's the error information may be interesting, but may still be safely ignored.
Which is a real problem, because people are in the habit of ignoring them when they should not.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
Yes, but you must *explicitly* ignore it.
Not really. Human behavior is such that creating a default exception catch using the general handler is becoming second nature. The only way to force this would be to entirely eliminate the concept of a general exception handler.
Christian Graus wrote:
because people are in the habit of ignoring them when they should not.
That same habit has already arrived with exception handling. Only the code is less readable and the possible coding error not at all obvious.
|
|
|
|
|
I am looking for a way to create a sort of "glass" window. A window that is transparent and can be placed on top of other window and can filter mouse clicks using WM_NCHITTEST. It needs to work as a sort of intelligent SetCapture that allows certain click to break the capture.
I tried using WS_EX_TRANSPARENT and can get that to work but it caused the entire desktop to redraw itself. I tried added WS_EX_LAYERED to the window style which the removes the redraw but does not allow me to intercept the mouse clicks
Using SetCapture does not work since it does not allow for filtering but just blocking messages…
Any suggestions is more than welcome
Thanks,
Hakon
|
|
|
|
|
|
Thanks, hooks are next on my list of things to try out. However, I seem to remember that adding hooks can slow down the system but my knowledge about hooks might as old as from Charles Petzold's "Programming Windows 3.1"
As far as I can see will the WS_EX_LAYERED let mouse message pass through unless there is painted something on the window or the alpha value is greater than 0 (which means only semi-transparent)....
I will look into hooks
|
|
|
|
|
I am developing a BlackJack game and cannot find out how to Hide control buttons when the user should not be able to click them. You can set the property in the Properties box of the control ([] Visible) , but I am confused as to how to then make it Visible again when the user has the option to click the button.
Any Help,
Neal
|
|
|
|
|
Use ShowWindow with the SW_SHOW or SW_HIDE flags.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Thanks Alvaro...works like a charm. To think, I was using EnableWindow anyway. At least I know now, Thanks again.
|
|
|
|
|
I am going to start using CVS. I am a one man shop so something big like sourcesafe is not required. My question is, I am using VC.NET and wonder what file I should commit to CVS. I know I should put my header and cpp files, but should I include the .vcproj and .sln files? Can I recreate those files by creating a new project and just adding my header and cpp files into the project, oh and resource directory?
I just notice vcproj, .sln, and other seem to change each time I open VC.NET and I would have revision 1.1 of a file and all of a sudden my .vcproj or .sln file would be revision 50.1 or something.
Thanks for any insight into the matter.
Code4Food
----
"There is no try; only do or do not"
-Yoda
|
|
|
|
|
Commit everything but .aps, .ncb, .suo, and autogenerated header files from idl-files. It's better to create a new module for midl-generated header files IMHO.
.vcproj and .sln you want to keep. it stores information about your project in general (files, compiler settings). Only commit then when you know you've made changes (like added a new file, changed some configuration, etc).
This seems to be working for me so far.
--
Only in a world this sh*tty could you even try to say these were innocent people and keep a straight face.
|
|
|
|
|
Thanks for the response!
Code4Food
----
"There is no try; only do or do not"
-Yoda
|
|
|
|
|
I want to know as to how to close my view i.e Kill the view in my MDI Framework when I encounter an error condition .
As for example one of the Initialization routines in the View fails in which case I need to terminate or kill the View. What is the correct way of doing this ? Please help
|
|
|
|
|
DestroyWindow should do it. If not, post some code that may help us assist you.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Hello,
I'm having the following problem; when I try to put a CRectTracker inside a CScrollView, it LOOKS fine, but doesn't actually work. As soon as I scroll an item inside the CRectTracker out of the screen, it appears as if the item IS outside the working area, but the actual rectangle surrounding the item remains stuck to the side on which I scrolled it out. So the picture appears to be half out of the working area, but when I click next to the picture, it still grabs the rectangle and I see the surrounding rectangle line as if the objects border is at the working area border.
Does anyone have a solution for this problem?
Thanks,
- Fahr
|
|
|
|
|
If I understand correctly, you need to use CWnd::SetCapture to capture the mouse event to the view that has the action.
you do a SetCapture on the ButtonDown , and you do a release capture on the ButtonUp.
Max.
|
|
|
|
|
I guess that's not quite what I mean...
Check out the following screenshots, the first one shows where the rectangle is when I select it. The second one is more clear, it shows the border of the rectangle is sizing dots, while the content is obviously scrolled out...
screenshots:
http://www.lycantrope.com:5000/~Vahlinear/recttracker1.jpg
http://www.lycantrope.com:5000/~Vahlinear/recttracker2.jpg
Thanks,
- Fahr
|
|
|
|
|
I think Fahr's problem is similar to my problem.I want to explain more , maybe someone could solve our problem.
I wrote a program that someone could choose items from a toolbar and put them on the document by clicking left
button of mouse on the view. I considered a CRectTracker variable for each symbol and in the OnDraw function I
draw each symbol's tracker's rectangle.And for selecting each symbol which is shown on the page I check if the
position of left click of mouse is in the tracker of any of the symbols or not.At the beginning I used CView class
but now I want to use CScrollView in order that my program could support scrolling.I changed the base class of
my view class to CScrollView and write some lines in its OnInitialUpdate in order to set the size of scrolling.Now I
scroll my program but when I put an item on the page and scroll the page , in some places that my item doesn't
exist , it seems that its tracker exists and if I move it or delete it or sth else , those changes would be applied on
the real item that is somewhere upper than there. I think I should change the coordinates of the CRectTracker
variable of my item , but I don't know how.
Thanks
Azadeh
|
|
|
|
|
From a Win32 C++ program, running on Windows 95/98/Me, how can I:
1. Launch a process
2. Wait for the process to finish
3. Resume program execution after the process finishes
The obvious answer is to use CreateProcess and WaitForSingleObject... but, for whatever reason, this is NOT working. It is very strange - what I am trying to do is launch a little executable that sees if any Add New Hardware dialogs are running, and if so, wait for them to finish. If I launch this app manually (e..g, from Windows Explorer), it works fine. If I spawn it from a third executable using CreateProcess, it also works fine. But if I try to do a WaitForSingleObject on its process handle, it apparently causes some sort of deadlock with the Add New Hardware wizard, and they both lock up.
So is there some way around this? I am guessing a method of waiting for an executable to finish that does not rely on WaitForSingleObject would be sufficient. This is for Windows 9X, which sucks anyway, so I don't care if the solution is inefficient. Just as long as it doesn't lock up.
Even a broken clock is right twice a day.
|
|
|
|
|
This is weird. As you said you don't care about dirty solutions, maybe this can do it:
for(;;){
if(WaitForSingleObject(hProcess,0)==WAIT_OBJECT_0)break;
Sleep(100);
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
After reading what Mike Dunn said, and looking into this FindWindow thing, I think this may work. Guess I'll just have to cross my fingers and try...
Even a broken clock is right twice a day.
|
|
|
|
|
Nice idea, but I found it doesn't work...
Even a broken clock is right twice a day.
|
|
|
|
|
Are you using FindWindow(Ex) to look for the Add Hardware dialogs? If so, then FindWindow(Ex) has a known bug on 9x that can cause a hang. (I can't find it in the KB now, but I know I've seen it.) We ran into this at work at we just had to skip the FindWindow checks on 9x.
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Yeah. Actually, another team wrote the code that searches for the window, and I believe it does use FindWindow. There is a nifty API you can call to see if a plug and play is happening, but it only works for 2K and XP. So I think we're stuck using FindWindow.
Ack! I hate 9X.
Even a broken clock is right twice a day.
|
|
|
|