15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


bitmaps not displayed on win32s 1.3

Gregory Paul -- gpaul@procd.com
Tuesday, August 13, 1996


Environment:  VC 4.1, Win 3.1, Windows 95

i can't get a 16-color bitmap 117x226 pixels to display in win3.1.  it   
works fine on win95, but the same exe doesn't display the bitmap in a   
dialog where every other control shows up ok.  the dialog is a property   
page within a property sheet with wizard mode turned on.  the wizard is a   
series of 15 or so dialogs, sharing 8 bitmaps (each page shows one large   
bitmap to the left like installshield).

i use four resource files combined through the rc2 file of the main app.   
 i tried moving the dialogs and bitmaps to the "main" app resource file,   
but had no different results.

does the bitmap resource ID have to be within a specific range (e.g.   
bytes rather than ints or longs) for win32s?

any help is greatly appreciated.

thanks,
/greg

 ---------------

in the header the bitmap resource is defined as...

#define IDB_WIZARD                      1502

in the RC file...(note the 1502 id of the control)

IDD_PIECE_DIMENSIONS DIALOG DISCARDABLE  0, 0, 257, 154
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Presort"
FONT 8, "MS Sans Serif"
BEGIN
    EDITTEXT        IDC_PIECE_HEIGHT_EB,145,52,40,14,ES_AUTOHSCROLL
    EDITTEXT        IDC_PIECE_WIDTH_EB,145,76,40,14,ES_AUTOHSCROLL
    LTEXT           "Height:",IDC_STATIC,113,54,22,8
    LTEXT           "Width:",IDC_STATIC,113,78,20,8
    LTEXT           "Enter the height and width (in inches) of the mail   
piece you wish to send:",
                    IDC_STATIC,99,20,144,21
    CONTROL         1502,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN |
                    WS_BORDER,7,7,78,139
    CONTROL         "This mailing consists of postcards",IDC_POSTCARD,
                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,122,121,10
END







Kostya Sebov -- sebov@is.kiev.ua
Thursday, August 15, 1996

[Mini-digest: 3 responses]

>
>   Environment:  VC 4.1, Win 3.1, Windows 95
>
>   i can't get a 16-color bitmap 117x226 pixels to display in win3.1.  it
>   works fine on win95, but the same exe doesn't display the bitmap in a
>   dialog where every other control shows up ok.  the dialog is a property
>   page within a property sheet with wizard mode turned on.  the wizard is a
>   series of 15 or so dialogs, sharing 8 bitmaps (each page shows one large
>   bitmap to the left like installshield).
>
>   i use four resource files combined through the rc2 file of the main app.
>    i tried moving the dialogs and bitmaps to the "main" app resource file,
>   but had no different results.
>
>   does the bitmap resource ID have to be within a specific range (e.g.
>   bytes rather than ints or longs) for win32s?
>
>   any help is greatly appreciated.
>
>   thanks,
>   /greg
>
>    ---------------
>
>   in the header the bitmap resource is defined as...
>
>   #define IDB_WIZARD                      1502
>
>   in the RC file...(note the 1502 id of the control)
>
>   IDD_PIECE_DIMENSIONS DIALOG DISCARDABLE  0, 0, 257, 154
>   STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
>   CAPTION "Presort"
>   FONT 8, "MS Sans Serif"
>   BEGIN
>       EDITTEXT        IDC_PIECE_HEIGHT_EB,145,52,40,14,ES_AUTOHSCROLL
>       EDITTEXT        IDC_PIECE_WIDTH_EB,145,76,40,14,ES_AUTOHSCROLL
>       LTEXT           "Height:",IDC_STATIC,113,54,22,8
>       LTEXT           "Width:",IDC_STATIC,113,78,20,8
>       LTEXT           "Enter the height and width (in inches) of the mail
>   piece you wish to send:",
>                       IDC_STATIC,99,20,144,21
>       CONTROL         1502,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN |
>                       WS_BORDER,7,7,78,139
>       CONTROL         "This mailing consists of postcards",IDC_POSTCARD,
>                       "Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,122,121,10
>   END
>
>
I'm affraid static controls do not support SS_BITMAP style. I also boubt they
support SS_SUNKEN (do not miz up with CTL3DV2.DLL stuff). Remember all controls
are Windows 3.1 USER.EXE's windows.
--- 
Kostya Sebov. 
----------------------------------------------------------------------------
Tel: (38 044) 266-6387 | Fax: (38 044) 266-6195 | E-mail: sebov@is.kiev.ua
-----From: Kevin Bryan 

I beleive that the resources need to be compiled under Win16 for them to
work both places unless the Win3.1 machine has Win32s 1.2+.  This was a
problem for the 32-bit version of mIRC, it's toolbar would display static on
older versions of Win32s, so you had to use the 16-bit version.  This was
fixed when I upgraded to version 1.2+ (I think this is it, if not, just get
the most recent one).  If you compile the resources for Win16, however Win95
will display them correctly (Backwards compatible, and all that).  Hope this
helps.

-----From: gpaul@procd.com (Gregory Paul)

so i couldn't wait and had to call microsoft (for a fee).  here's the   
solution (workaround):

/greg

SS_BITMAP is NOT supported on win32s.  you have to draw it yourself
(one way is with BitBlt)

check out with a query Q107765 or S14421 in the MSDEV/MSDN help:
"Sample Draws a Bitmap in a Foundation Class Dialog Box".

here's the code they give you.  create an OnPaint member function to
your dialog/property page:

void CMyDlg::OnPaint()
{
     CPaintDC dc(this); // device context for painting

    CBitmap bmp, *poldbmp;
    CDC memdc;
   

    // Load the bitmap resource
    bmp.LoadBitmap( nID );
   

    // Create a compatible memory DC
    memdc.CreateCompatibleDC( &dc );
   

    // Select the bitmap into the DC
    poldbmp = memdc.SelectObject( &bmp );
   

    // Copy (BitBlt) bitmap from memory DC to screen DC
    dc.BitBlt( 10, 10, 117, 226, &memdc, 0, 0, SRCCOPY );
   

    memdc.SelectObject( poldbmp );
   

   // do not call CDialog::OnPaint() for painting messages
}




| Вернуться в корень Архива |