wbonner@eecs.wsu.edu (Wim Bonner) (12/17/90)
I am having a problem programming some graphics in Pm. I have a series of things to do in a switch statement depending on what message comes in. On most of the options, the action is taken care of in the case statement, but in one case I am calling an external routine caller "fire". One of the parameters that is being passed to it is an HWND type, as I thought this should allow me to call WinBeginPaint on that space and draw in it, but I can't seem to get anything to show up on the window. I have a beep in the routine, so I know that it is getting to the routine. Anything obvoious that I may be doing wrong? Wim. -- | wbonner@yoda.eecs.wsu.edu | | 27313853@wsuvm1.csc.wsu.edu | | 27313853@Wsuvm1.BITNET | | 72561.3135@CompuServe.com |
wbonner@eecs.wsu.edu (Wim Bonner) (12/18/90)
>HWND type, as I thought this should allow me to call WinBeginPaint on >that space and draw in it, but I can't seem to get anything to show up >on the window. I have a beep in the routine, so I know that it is Well, I got an answer to my problem. It seems that I am supposed to use WinGetPS instead of WinBeginPaint. Now that portion works. Thanks.. I tried to cancel my old post in rn, but it wouldn't let me, saying that I could only cancel posts that I had made. I can't figure that error out. Wim. -- | wbonner@yoda.eecs.wsu.edu | | 27313853@wsuvm1.csc.wsu.edu | | 27313853@Wsuvm1.BITNET | | 72561.3135@CompuServe.com |
db3l@ibm.com (David Bolen) (12/19/90)
In article <1990Dec16.233203.20196@eecs.wsu.edu> wbonner@eecs.wsu.edu (Wim Bonner) writes: > One of the parameters that is being passed to it is an >HWND type, as I thought this should allow me to call WinBeginPaint on >that space and draw in it, but I can't seem to get anything to show up >on the window. I have a beep in the routine, so I know that it is >getting to the routine. Well, it depends on whether you have any invalid region in your window. WinBeginPaint will give you back a cached micro presentation space, but it will also set the clipping region of the PS to the portion of the window that is invalid. It's designed to be used during a WM_PAINT message, so that PM only has to do the graphics operations requested in the portion of the window that has been exposed/changed/etc.. If you just call WinBeginPaint at a random point in your application, you'll get the PS, but the odds are no portion of your window will be "invalid", so the clipping region will be empty and nothing you do will actually show up in the window. If you want to do graphics in a window at an arbitrary time, use WinGetPS, which gives you the same sort of PS as WinBeginPaint, but only sets the clipping region around child windows (depending on the window style of the current window), giving you full access to your window's client area. Of course, you may need to refresh this at any time, so to be proper, anything you draw you should also be able to redraw as the response to a WM_PAINT message. Oh, and if you want to, you can go lower and use the GpiCreatePS call to create your own PS, but unless you need to create a normal (rather than micro) PS (if perhaps, you need retained segments), it's not really worth the effort for output to a window. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen / | Laboratory Automation, IBM Thomas J. Watson Research Center | / P.O. Box 218, Yorktown Heights, NY 10598 \ | - - - - - - - - - - - - M i t h r a n d i r - - - - - - - - - - - - | | Internet : db3l@ibm.com | Bitnet : db3l@yktvmv | | Usenet : uunet!bywater!arnor!larios!db3l | Phone : (914) 945-1940 | \-----------------------------------------------------------------------/
rimola@solrac.metaphor.com (Carlos Alberto Rimola) (12/22/90)
In article <1990Dec16.233203.20196@eecs.wsu.edu> wbonner@eecs.wsu.edu (Wim Bonner) writes:
-I am having a problem programming some graphics in Pm.
-
-I have a series of things to do in a switch statement depending on what
-message comes in. On most of the options, the action is taken care of
-in the case statement, but in one case I am calling an external routine
-caller "fire". One of the parameters that is being passed to it is an
-HWND type, as I thought this should allow me to call WinBeginPaint on
-that space and draw in it, but I can't seem to get anything to show up
-on the window. I have a beep in the routine, so I know that it is
-getting to the routine.
-
-Anything obvoious that I may be doing wrong?
-
-Wim.
---
-| wbonner@yoda.eecs.wsu.edu |
-| 27313853@wsuvm1.csc.wsu.edu |
-| 27313853@Wsuvm1.BITNET |
-| 72561.3135@CompuServe.com |
I am not a PM expert but I am fairly certain that unless you are dealing
with a WM_PAINT message you can/should not use WinBeginPaint/WinEndPaint to
draw on a presentation space. Instead, you should use WinGetPS/WinReleasePS
to get the handle to the PS and use that in your drawing calls. I have
used this method during WM_TIMER messages without any problems.