Null Style problem with Windows Vista

Null Style problem with Windows Vista

Postby dutch » Sun Aug 10, 2008 1:41 am

Dear All,

The login screen is work perfect in Windows XP (without anything in each corner) but it shows incorrect in Windows Vista as picture (not show round corner).
- LOGIN1.BMP
Image
- LOGIN2.BMP
Image
- Login XP
Image
- Login Vista
Image

Code: Select all  Expand view  RUN
    DEFINE BITMAP oBmp1 FILE 'BMP\LOGIN1.BMP' OF oDlg
    DEFINE BITMAP oBmp2 FILE 'BMP\LOGIN2.BMP' OF oDlg
   
    DEFINE BRUSH oBrush STYLE NULL  // FILENAME 'HOME.BMP'

    DEFINE DIALOG oDlg;
           BRUSH oBrush ;
           STYLE WS_POPUP ; // nOr( DS_MODALFRAME, WS_POPUP, WS_DLGFRAME, WS_SYSMENU, 4 ) ;
           FONT oFnt0 ;
           PIXEL FROM 0, 0 TO 415, 470 ;
           TITLE "EASYFO"

....             

    ACTIVATE DIALOG oDlg CENTER ;  // ON INIT SETTRANSP( oDlg ) ;
              ON PAINT ( PalBmpDraw( oDlg:hDC, 0, 0, oBmp2:hBitmap, 0, 0, 0, SRCPAINT ),;
                         PalBmpDraw( oDlg:hDC, 0, 0, oBmp1:hBitmap, 0, 0, 0, SRCAND ))


Thanks in advance,
Dutch
Last edited by dutch on Sat Aug 23, 2008 10:12 am, edited 1 time in total.
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Sat Aug 16, 2008 8:00 pm

Dutch,

BRUSH null does not behave the same in Vista as in XP.

You have to do it in a different way
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Null Style Problem

Postby dutch » Sat Aug 23, 2008 10:06 am

Dear Antonio,

Null Style is my big problem for Vista. Because it shows incorrect in many screens as following sample. How can I fix it?

Code: Select all  Expand view  RUN
   DEFINE BRUSH oBrush STYLE NULL
   
   DEFINE DIALOG oDlg RESOURCE 'RMASSIGN' ;
          BRUSH oBrush ;
          FONT MEMVAR->oFont

   REDEFINE BTNGET oGet VAR cRmsNo ID 101 ;
            UPDATE ;
            VALID  (VacantRm(oGet,cRmsNo,TBL->TBL_RMTY,TBL->TBL_ARR,TBL->TBL_DEP,,TBL->TBL_SHRNO)) ;
            ACTION (VacantRm(oGet,cRmsNo,TBL->TBL_RMTY,TBL->TBL_ARR,TBL->TBL_DEP,,TBL->TBL_SHRNO,,.T.),oDlg:End())

   bInit := {|| oDlg:Move( aDim[ 1 ]+MEMVAR->TopWin+nTop, aDim[ 2 ]+MEMVAR->LeftWin+4, aDim[3], aDim[4] ) }

   ACTIVATE DIALOG oDlg ON INIT Eval( bInit )  RESIZE16


Image

Thanks&regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Sat Aug 23, 2008 10:57 am

Dutch,

This is a modified version of fwh\samples\newhelp.prg. Please test it and see that the transparency works fine in Vista. (It is based on an Enrico's posted code with some modifications):

Please note the use of CLR_BLUE. Please use a color that it is not used in your bitmap!

samples\NewHelp.prg
Code: Select all  Expand view  RUN
// Sample showing how to work with new help techniques from FiveWin.

#include "FiveWin.ch"
#include "NewHelp.ch"
#include "Inkey.ch"

#define SRCPAINT   15597702   // 0xEE0086
#define SRCAND      8913094

#define GWW_ID          -12

static oBmp1, oBmp2, oFont

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oBtn, oCursor
   local cName := "Hello        " // Space( 30 )
   local cAddress := "World!      " // Space( 30 )

   SET _3DLOOK ON

   SetKey( VK_F1, { | nKey | MsgInfo( 'Help on: "' + ;
                             GetWindowText( GetActiveWindow() ) + '"' + ;
                             CRLF + "Control ID: " + ;
                             Str( GetWindowWord( GetFocus(), GWW_ID ) ) ) } )

   DEFINE CURSOR oCursor RESOURCE "Help"

   DEFINE BITMAP oBmp1 RESOURCE "Genie1"
   DEFINE BITMAP oBmp2 RESOURCE "Genie2"

   DEFINE FONT oFont NAME "Arial" SIZE 0, -9

   DEFINE DIALOG oDlg RESOURCE "Test"

   REDEFINE GET cName    ID ID_NAME    OF oDlg HELPID ID_NAME
   REDEFINE GET cAddress ID ID_ADDRESS OF oDlg

   REDEFINE BUTTON oBtn ID ID_HELP OF oDlg ;
      ACTION ( oBtn:Capture(),;
               oBtn:oCursor   := oCursor,;
               oBtn:bLClicked := { | nRow, nCol | ShowHelp( oBtn, nRow, nCol ),;
                                                  ReleaseCapture(),;
                                                  oBtn:oCursor   := nil,;
                                                  oBtn:bLClicked := nil, 0 } )

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE OBJECTS oCursor, oBmp1, oBmp2, oFont

return nil

//----------------------------------------------------------------------------//

function ShowHelp( oBtn, nRow, nCol )

   local aPoint   := { nRow, nCol }
   local hCtl, nID
   local cMsg

   #ifndef __CLIPPER__
      nRow = 65535 - nRow
      nCol = 65535 - nCol
   #endif
     
   aPoint = ClientToScreen( oBtn:hWnd, aPoint )

   #ifndef __CLIPPER__
      aPoint[ 1 ] = aPoint[ 1 ] - 65535
      aPoint[ 2 ] = aPoint[ 2 ] - 65535
   #endif

   hCtl = WindowFromPoint( aPoint[ 2 ], aPoint[ 1 ] )
   
   #ifdef __CLIPPER__
      nID  = GetWindowWord( hCtl, -12 )
   #else
      nID  = GetWindowLong( hCtl, -12 )
   #endif   

   REDEFINE cMsg AS CHARACTER RESOURCE nID

   MsgFancy( If( Empty( cMsg ), "Sorry, I am a very limited Genius...", cMsg ) )

return nil

//----------------------------------------------------------------------------//

function MsgFancy( cMsg )

   local oDlg, oBrush

   DEFINE BRUSH oBrush COLOR CLR_BLUE // STYLE NULL             // Transparent painting !

   DEFINE DIALOG oDlg ;
      FROM 2, 2 TO 20, 60 ;
      STYLE WS_POPUP ;
      BRUSH oBrush ;

   ACTIVATE DIALOG oDlg CENTERED ;
      ON PAINT ( PalBmpDraw( oDlg:hDC, 0, 0, oBmp2:hBitmap, 0, 0, 0, SRCPAINT ),;
                 PalBmpDraw( oDlg:hDC, 0, 0, oBmp1:hBitmap, 0, 0, 0, SRCAND ),;
                 oDlg:Say( 3.7, 10, cMsg,,, oFont ) ) ;
      ON LEFT CLICK oDlg:End() ;
      ON INIT SetTransparent( oDlg )

return nil

//----------------------------------------------------------------------------//

#define LWA_COLORKEY  1
#define GWL_EXSTYLE   -20
#define WS_EX_LAYERED 524288


STATIC FUNCTION SETTRANSPARENT( oDlg )

   SETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE, NOR( GETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) )

   SETLAYEREDWINDOWATTRIBUTES( oDlg:hWnd, CLR_BLUE,, LWA_COLORKEY )

RETURN NIL
   
//----------------------------------------------------------------------------//   
Last edited by Antonio Linares on Sat Aug 23, 2008 11:04 am, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sat Aug 23, 2008 11:00 am

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby dutch » Sat Aug 23, 2008 3:56 pm

Dear Antonio,

It works almost perfectly but it has a problem. The SAY with ::lTransparent is through the bitmap to background under bitmap as following. Can it transparent only SAY BACKGROUND (do not pass BITMAP)?

Code: Select all  Expand view  RUN
     @ 80,45 SAY oSay[1] PROMPT "Login Name" COLOR CLR_WHITE SIZE 50,12 PIXEL
             oSay[1]:lTransparent := .T.

     @ 93,45 GET oGet[1] VAR cLogin PICTURE '@!' COLOR CLR_BLUE, CLR_WHITE SIZE 140, 14 PIXEL ;
             VALID ((!empty(cLogin).and.if(lChk := ChkUser(@cLogin,@cLang), ( oCbx:Refresh(), .T. ), (oGet[1]:Refresh(),.F.) )).or.oBtn:lMouseOver)

     @ 108,45 SAY oSay[2] PROMPT "Password" COLOR CLR_WHITE SIZE 50,12 PIXEL
              oSay[2]:lTransparent := .T.

     @ 121,45 GET oGet[2] VAR cPass PICTURE '@!' COLOR CLR_BLUE, CLR_WHITE SIZE 140, 14 PASSWORD PIXEL ;
              FONT oFnt2 ;
              VALID (oBtn:lMouseOver.or.(!empty(cPass).and.iif(lChk := ChkPass(@cPass),(oBtn:SetFocus(),.T.),(oGet[2]:Refresh(),.F.))))     


Image

Thanks&regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Sat Aug 23, 2008 6:15 pm

What color are you using as the transparent one ?

In this call:
SETLAYEREDWINDOWATTRIBUTES( oDlg:hWnd, CLR_BLUE,, LWA_COLORKEY )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby dutch » Sat Aug 23, 2008 6:29 pm

Dear Antonio,

I use CLR_GREEN. If I remark :lTransparent and put BACKGROUND text as CLR_GREEN. The SAY BACKGROUND will be invisible (Transparent through background of BITAMP.

Regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Sat Aug 23, 2008 7:23 pm

Dutch,

Could you please provide a small and self contained example to test it here ? thanks,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sat Aug 23, 2008 7:25 pm

Dutch,

You don't have to keep using the BRUSH NULL.

Thats why I ask you for an example. I don't know for sure how you are doing it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby dutch » Sun Aug 24, 2008 12:51 am

Dear Antonio,

This is a sample and Bitmap files.

http://www.sendspace.com/file/ugiteh

Code: Select all  Expand view  RUN
#include 'FiveWin.ch'

#define LWA_COLORKEY  1

#define LWA_ALPHA 3
#define GWL_EXSTYLE  -20
#define WS_EX_LAYERED 524288
#define SRCPAINT   15597702   // 0xEE0086
#define SRCAND      8913094


Function Main()
local old_sel := select()
local oDlg, oBmp1, oBmp2, oBtn, oBtn2, oGet[2], cWndText  // , oSay
local cLogin, cPass, lChk
local nMail, lOldWrk := .F.

LOCAL nFactor := 230, btnmais, btnmenos, btnloops
LOCAL oBrush, oSay[4], oFnt0, oFnt2, oFnt1, oFnt3, oFnt4, oFnt5, oCbx, oHeaderDlg
LOCAL cLang := 'English '


   cLogin := space(10)
   cPass  := space(10)

    DEFINE FONT oFnt0 NAME "Tahoma" SIZE 0, -16 BOLD
    DEFINE FONT oFnt1 NAME "Tahoma" SIZE 0, -12 BOLD
    DEFINE FONT oFnt2 NAME "Tahoma" SIZE 0, -18 BOLD
    DEFINE FONT oFnt3 NAME "Umbra-Normal" SIZE 0, -40 BOLD
    DEFINE FONT oFnt4 NAME "Tahoma" SIZE 0, -18 BOLD
    DEFINE FONT oFnt5 NAME "Tahoma" SIZE 0, -12

    DEFINE BITMAP oBmp1 FILE 'LOGIN1.BMP' OF oDlg
    DEFINE BITMAP oBmp2 FILE 'LOGIN2.BMP' OF oDlg
   
    DEFINE BRUSH oBrush COLOR CLR_GREEN // STYLE NULL

    DEFINE DIALOG oDlg;
           BRUSH oBrush ;
           STYLE WS_POPUP ; // nOr( DS_MODALFRAME, WS_POPUP, WS_DLGFRAME, WS_SYSMENU, 4 ) ;
           FONT oFnt0 ;
           PIXEL FROM 0, 0 TO 415, 470 ;
           TITLE "EASYFO"
             
     @  18, 70 SAY oSay[3] PROMPT 'EASYFO' COLOR CLR_WHITE SIZE 70, 25 FONT oFnt3 PIXEL
                oSay[3]:lTransparent := .T.

     @  45, 70 SAY oSay[3] PROMPT 'Hotel Management System' COLOR CLR_HRED SIZE 130, 13 FONT oFnt4 PIXEL
                oSay[3]:lTransparent := .T.

     @  80, 45 SAY oSay[1] PROMPT "Login Name" COLOR CLR_WHITE SIZE 50,12 PIXEL
                oSay[1]:lTransparent := .T.
             
     @ 108, 45 SAY oSay[2] PROMPT "Password" COLOR CLR_WHITE SIZE 50,12 PIXEL
                 oSay[2]:lTransparent := .T.

     @ 150, 45 SAY oSay[4] PROMPT 'Language' OF oDlg COLOR CLR_WHITE SIZE 30, 12 PIXEL FONT oFnt1
               oSay[4]:lTransparent := .T.

     @ 93,45 GET oGet[1] VAR cLogin PICTURE '@!' COLOR CLR_BLUE, CLR_WHITE SIZE 140, 14 PIXEL
*             VALID ((!empty(cLogin).and.if(lChk := ChkUser(@cLogin,@cLang), ( oCbx:Refresh(), .T. ), (oGet[1]:Refresh(),.F.) )).or.oBtn:lMouseOver)

     @ 121,45 GET oGet[2] VAR cPass PICTURE '@!' COLOR CLR_BLUE, CLR_WHITE SIZE 140, 14 PASSWORD PIXEL ;
              FONT oFnt2
*              VALID (oBtn:lMouseOver.or.(!empty(cPass).and.iif(lChk := ChkPass(@cPass),(oBtn:SetFocus(),.T.),(oGet[2]:Refresh(),.F.))))     

     @ 157, 120 BUTTON oBtn ;  //                FILE 'BMP\UNLOCK.BMP','BMP\LOCK.BMP','BMP\LOCK.BMP','BMP\UNLOCK.BMP'  ;
                PROMPT 'LogIn' ;
                WHEN  (!empty(cLogin) .and. !empty(cPass)) ;
                SIZE 45, 16 PIXEL ; 
                FONT oFnt1 ;  //                TEXT ON_RIGHT ;  //                XP ;
                ACTION ( lChk := .T. ,oDlg:End())

     @ 157, 170 BUTTON oBtn2 ;  //                FILE 'BMP\EXIT.BMP' ;
                PROMPT 'Exit' ;
                SIZE 45, 16 PIXEL ; 
                FONT oFnt1 ;    //                TEXT ON_RIGHT ;  //                XP ;
                ACTION ( lChk := .F. ,oDlg:End())

     @ 160, 45 COMBOBOX oCbx VAR cLang ITEMS {'Thai    ','English '} OF oDlg SIZE 60, 150 PIXEL FONT oFnt5

    ACTIVATE DIALOG oDlg CENTER ON INIT SetTransparent( oDlg ) ;   // SETTRANSP( oDlg ) ;
              ON PAINT ( PalBmpDraw( oDlg:hDC, 0, 0, oBmp2:hBitmap, 0, 0, 0, SRCPAINT ),;
                         PalBmpDraw( oDlg:hDC, 0, 0, oBmp1:hBitmap, 0, 0, 0, SRCAND ))
   oFnt0:End()
   oFnt1:End()
   oFnt2:End()
   oFnt3:End()
   oFnt4:End()
   oFnt5:End()
return

STATIC FUNCTION SETTRANSPARENT( oDlg )

   SETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE, NOR( GETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) )

   SETLAYEREDWINDOWATTRIBUTES( oDlg:hWnd, CLR_GREEN,, LWA_COLORKEY )  // CLR_BLUE

RETURN NIL


Regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby dutch » Mon Aug 25, 2008 9:16 am

Dear Antonio,

I try to change color and many parameter but the resault is the same.

Regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Mon Aug 25, 2008 10:05 am

Dutch,

Why don't you paint those SAYs as part of the bitmap ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Aug 25, 2008 10:29 am

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby dutch » Mon Aug 25, 2008 11:09 am

Dear Antonio,

I did but need to know how to do ::lTransparent of this case if any?

Regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 78 guests