- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I would like to add a bitmap (changed during runtime) inside an win32 application. This bitmap should be part of a dialog. A call of xUpdateWindow (invalidaterect) should not need a additional include of a xCreateBitmap and xPlaceBitmap.
The second step is a change of the Bitmap-file during runtime.
Is there any chance to do this?
As may seen before I use XEffort (ver 1.2.21).
IVF ver 10.0.026 and MS VS2003/2005 German
Thanks in advance
Frank
I would like to add a bitmap (changed during runtime) inside an win32 application. This bitmap should be part of a dialog. A call of xUpdateWindow (invalidaterect) should not need a additional include of a xCreateBitmap and xPlaceBitmap.
The second step is a change of the Bitmap-file during runtime.
Is there any chance to do this?
As may seen before I use XEffort (ver 1.2.21).
IVF ver 10.0.026 and MS VS2003/2005 German
Thanks in advance
Frank
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you looking for XCtlSet(CTL_BITMAP)? XUpdateWindow is necessary only for owner-drawn controls, while "bitmap" controls (static, buttons) are capable of presenting only the bitmap; they just have to have an appropriate style (SS_BITMAP, BS_BITMAP).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Jugoslav,
I am using xGetBitmap and xSaveBitmap to create a bitmap-file within the program.
Mostly I use xUpdateWindow to redraw the dialog. If I use xPlaceBitmap the Bitmap is not included inside the common Update of the dialog (it was in IVF 9.0.xxx; but is not working inside 9.1 and 10.0).
I need a workaround. My idea was to include the Bitmap via a picture control into the dialog.
Any idea?
Thanks in advance
Frank
I am using xGetBitmap and xSaveBitmap to create a bitmap-file within the program.
Mostly I use xUpdateWindow to redraw the dialog. If I use xPlaceBitmap the Bitmap is not included inside the common Update of the dialog (it was in IVF 9.0.xxx; but is not working inside 9.1 and 10.0).
I need a workaround. My idea was to include the Bitmap via a picture control into the dialog.
Any idea?
Thanks in advance
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, you can give it a try (i.e. using a picture control rather than owner-drawn one and calling XCtlSet(CTL_BITMAP)). I'd like to see your source, because VF version shouldn't affect the behavior of XUpdateWindow -- it might be a hidden bug in Xeffort or something unrelated; however, I'm terribly busy these days. Do you see the updated bitmap when you minimize & restore (or obscure & reveal) the dialog?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have attached a sample file. This is extracted from an old project which was sucessfully compiled using VS2003 IVF 9.0.25 xEffort 1.2.20. (I dont have this environment any more)
What is this programm doing and step to do it.
- select menu item start dialog / dialog
- press button draw
Then it draws a bitmap and will place the bitmap on the dialog. The Bitmap itself is saved in the local temp directory of the current user.
Both subroutines (xView_OnPaint and xXnd_OnDrawStatic) are using xPlaceBitmap to place the saved bitmap on the dialog.
But under the current environment (VS 2005, IVF 10.0.26,xEffort 1.1.21) it is not working.
Any help will be appreciated.
Thanks in advance
Frank
I have attached a sample file. This is extracted from an old project which was sucessfully compiled using VS2003 IVF 9.0.25 xEffort 1.2.20. (I dont have this environment any more)
What is this programm doing and step to do it.
- select menu item start dialog / dialog
- press button draw
Then it draws a bitmap and will place the bitmap on the dialog. The Bitmap itself is saved in the local temp directory of the current user.
Both subroutines (xView_OnPaint and xXnd_OnDrawStatic) are using xPlaceBitmap to place the saved bitmap on the dialog.
But under the current environment (VS 2005, IVF 10.0.26,xEffort 1.1.21) it is not working.
Any help will be appreciated.
Thanks in advance
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I didn't look too carefully into your code, but removing XDeleteBitmap here and there appears to have solved the problem. I must admit that I didn't think what I was doing too deeply, so the commenting out was a "black magic" attempt that worked. Please review my changes using a diff tool. (e.g. WinMerge)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the fast help!!!
It works.
But allow a question beyound the fast help. As far as I have understoud I have to delete a structure to keep the used number of items low. If I use xCreateBitmap quite often and do not an xDeleteBitmap what happens?
Frank
It works.
But allow a question beyound the fast help. As far as I have understoud I have to delete a structure to keep the used number of items low. If I use xCreateBitmap quite often and do not an xDeleteBitmap what happens?
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You get a GDI memory leak -- ultimately, it might deplore the system out of resources, with strange effects all over the screen. Under Win9x it was visible pretty quickly, under NT/XP series it would take some time. You can detect it if you select "GDI objects" column in Task Manager (View/Select columns).
The problem was that you created a bitmap in xDlg_Zeichnen, but immediately deleted it at the end; when xWnd_OnDrawStatic was entered, it has already gone. Taking a look at my modifications, it seems that they did create a GDI leak though.
You should apply some redesign, because:
* In order to be displayed, the xBmp has to be alive in every given moment, so that xWnd_OnDrawStatic and frame window's OnPaint can display it
* However, you have to take care to create it only once, or destroy the old one before you recreate it.
A simple solution would be to insert XDeleteBitmap somewhere at the beginning on xDlg_Zeichnen (or whenever you're about to call XGetBitmap), so that you ensure you deleted whatever was there, and start afresh. There's probably some nicer method, which I can't think of at the moment.
The problem was that you created a bitmap in xDlg_Zeichnen, but immediately deleted it at the end; when xWnd_OnDrawStatic was entered, it has already gone. Taking a look at my modifications, it seems that they did create a GDI leak though.
You should apply some redesign, because:
* In order to be displayed, the xBmp has to be alive in every given moment, so that xWnd_OnDrawStatic and frame window's OnPaint can display it
* However, you have to take care to create it only once, or destroy the old one before you recreate it.
A simple solution would be to insert XDeleteBitmap somewhere at the beginning on xDlg_Zeichnen (or whenever you're about to call XGetBitmap), so that you ensure you deleted whatever was there, and start afresh. There's probably some nicer method, which I can't think of at the moment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On retrospect...
The entire design could be greatly simplified if you get rid of the X_BITMAP; actually, you don't need it at all: it just complicates the issues because you have to add management code about its creation and destruction.
Instead, just having a simple, persistent, offscreen DC where you perform the drawing would be a simpler route. Instead of XPlaceBitmap, just do XBitCopy from that DC to the target screen DCs. The only place where you need to make a bitmap is when saving it -- for that, simple XGetBitmap/XSaveBitmap/XDeleteBitmap will do.
The entire design could be greatly simplified if you get rid of the X_BITMAP; actually, you don't need it at all: it just complicates the issues because you have to add management code about its creation and destruction.
Instead, just having a simple, persistent, offscreen DC where you perform the drawing would be a simpler route. Instead of XPlaceBitmap, just do XBitCopy from that DC to the target screen DCs. The only place where you need to make a bitmap is when saving it -- for that, simple XGetBitmap/XSaveBitmap/XDeleteBitmap will do.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page