Looks like it'll be the only way. For some reasons i would have favoured an approach to trap the key event and handle it by myself. For now, it remains a mystery to me why i can't do so. Anyway, thanks!
wolfgangpuelm
Posts
-
Catch key event in .NET form used as modeless dialog -
Catch key event in .NET form used as modeless dialogThanks, unfortunately, it's not a focus problem. Nevertheless, it seems that handling the 'escape' button click is the only way to get around. Still wondering why i can't trap a key event. Thanks again.
-
Catch key event in .NET form used as modeless dialogHi, I created a form that is invoked as a modeless dialog: MyForm dlg = new MyForm(); dlg.Show(); // instead of ShowDialog() This form should be closed after a user hits the Escape key. Unfortunately, neither the assignment of a cancel button (with Dialogresult 'Cancel') to the form's property 'Cancelbutton' nor any attempt to catch a key event (KeyDown, keyPress) are working. I even tried to catch a WM_KEYDOWN (0x100) by overriding OnWndProc, no success. Does anyone have an idea where this message gets stuck or how to trap it? Thanks a lot in advance!
-
Which process is using a file i want to delete / update?Hi everybody, I'm looking for the (WIN32) API to find out which process is currently using a file i'm just trying to delete or update. There's a great tool called FileMon in sysinternals.com, but unfortunately the source isn't available (although it's free). It would be a great help if some one might have an idea at least where to start with to get this info. Thanks in Advance! Wolfgang.
-
How can i intercept Escape button in dialog form?Hi, Thanks a lot for your answer! It took me on the right track - at last: The xxx_FormClosing event has a FormClosingEventArgs parameter. From the MSDN i found out that there is a CancelEventArgs param also. Since it's possible to cast the FormClosingEventArgs into a CancelEventArgs, the latter's Cancel property can be used: if set true, the dialog stays alive, other it get's closed! :-D Thank's again! :rose: Regards. Wolfgang Puelm
-
How can i intercept Escape button in dialog form?Hi, thank you very much for your propmpt answer! But I'm afraid that's not my problem since the default event handler gives me no chance to remove this event (ESC pressed) from the form's message processing queue. That means the dialog will be inevitably be closed and that's what i'm trying to prevent if desired by user input. If this handler had a KeyEventArgs parameter instead of a EventArgs, the KeyEventArgs.Handled property could be set to true which might do the job (if it's passed by reference). Unfortunately, the event handler is implemented as it is. Once again, thank you for your effort! Regards Wolfgang Puelm
-
KVM RecommendationsI can recommend KVM switches from uniclass. They have different layouts to what is switched (USB / PS2, DVI-I / Analog video, ...). They are small, reliable (until now after 6 months) and come with a full set of cables which is very handy. See http://www.uniclass.com.tw/eng/products.htm Regards Wolfgang Puelm
-
How can i intercept Escape button in dialog form?Hi, I'm just moving from MFC to .NET. In MFC, I can easily intercept any message with PreTranslateMessage and do whatever i want with a particular msg. This is especially useful if a user presses the Escape button in a dialog. before all input is gone, i can ask the user if he/she really wants to proceed and discard all input. Should be no problem in .NET neither, i thought. But either it'S so obvious i just can't see it or it's not so easy after all(which would be a surprise since this is a frequently occurring scenario). What i do in respect to the Escape Button: it's assigned the DialogResult.Cancel value and the containing form sets this button's variable name as CancelButton. Any suggestions from someone? Thank's in advance! Wolfgang Puelm