Hello Byron,
the Screenshots of my Tests :
started with 1152 x 864
switching to Application Screen-resolution 1024 x 768,
the Application stopps.
Maybe it is a Dialog and not a Window ?
The Main-prgstructure :
FUNCTION MAIN()
LOCAL oWndMain
LOCAL nScrwidth := GetSysmetrics( 0 )
LOCAL nScrheight := GetSysmetrics( 1 )
LOCAL cRestart := "NO"
...
...聽
SetBalloon( .T. ) // Balloon shape required for tooltips
c_path := CURDRIVE() + ":\" + GETCURDIR() 聽
IF nScrwidth <> 1024 .and. nScrheight <> 768
聽 聽 cRestart := "YES"
ENDIF
oFont1 := TFont():New( "Arial", 0, 16,.F.,.T., 聽0, 聽0, 聽0,.F.,.F.)
DEFINE BITMAP oAlpha FILENAME c_Path + "\bitmaps\LOGO2.bmp"
DEFINE DIALOG oWndMain FROM 聽0, 0 TO 260, 400 PIXEL TRANSPARENT ;
STYLE WS_POPUP | WS_VISIBLE | WS_DLGFRAME | WS_THICKFRAME
...
...
@ 90, 125 BTNBMP oBtn5 OF oWndMain 聽;
SIZE 40, 40 ;
TOP NOBORDER ;
FILE c_path + "\Bitmaps\32Screen.bmp" ; 聽 聽 聽
PROMPT " &Screen" ;
FONT oFont1 ;
ACTION ( TEST_SCR(oWndMain) )
oBtn5:cTooltip := 聽{ "New" + CRLF + ;
聽 聽 聽 "Screen-resolution 1024 x 768","Screen", 1, CLR_BLACK, 14089979 }
oBtn5:lTransparent := .T.
oBtn5:l2007 := .F.
oBtn5:SetColor( 16312263 )
...
...
ACTIVATE DIALOG oWndMain CENTERED ;
ON INIT GRADBRU1(oWndMain, 0.8, 8388608, 14853684, .T.) ;
ON PAINT ABPaint( hDC, 50, 10, oAlpha:hBitmap, 255 ) 聽// Horiz / Vertical
oFont1:End() 聽
// Back to different Screen-resolution RESET
IF cRestart = "YES"
聽 聽 CHANGE_SCR( nScrwidth, nScrheight, .T.)
ENDIF
RETURN NIL 聽
// --------- Use 1024 x 768 if Screenresolution is different ------------
FUNCTION TEST_SCR(oWndMain)
IF cRestart = "YES"
聽 聽IF CHANGE_SCR(1024, 768, .T.) = .F.
聽 聽 聽 MsgAlert( "Cannot change Screen-resolution !","Attention")
聽 聽ENDIF
ELSE
聽 聽 MsgAlert( "No Screen-resolution-change needed !","Attention" )
ENDIF
RETURN NIL
Added to Sample : Testbtn.prg
I got the same Result. After changing the Screen-resolution
Message : Testbtn.exe doesn't work anymore ....
// Defining ButtonBar buttons which uses Bitmaps files from disk
#include "FiveWin.ch"
static oWnd
//----------------------------------------------------------------------------//
function Main()
聽 聽local oBar
聽 聽local oBrush
聽 聽local oPopup
聽 聽DEFINE BRUSH oBrush COLOR nRGB( 12, 129, 87 )
聽 聽DEFINE WINDOW oWnd FROM 1, 10 TO 20, 60 ;
聽 聽 聽 TITLE "Testing Buttons from disk" ;
聽 聽 聽 BRUSH oBrush
聽 聽DEFINE BUTTONBAR oBar OF oWnd _3D
聽 聽DEFINE BUTTON OF oBar FILE "..\bitmaps\16x16\exit.bmp" ;
聽 聽 聽 ACTION MsgInfo( CHANGE_SCR( 1152, 864, .T.) ) ;
聽 聽 聽 MESSAGE "You can place..."
聽 聽MENU oPopup POPUP
聽 聽 聽 MENUITEM "Test" WHEN .f.
聽 聽 聽 MENUITEM "Test" ACTION MsgInfo( "Any action" )
聽 聽 聽 MENU
聽 聽 聽 聽 聽MENUITEM "Another" WHEN .f.
聽 聽 聽 聽 聽MENUITEM "More..."
聽 聽 聽 ENDMENU
聽 聽ENDMENU
聽 聽DEFINE BUTTON OF oBar FILE "..\bitmaps\16x16\Open.bmp" GROUP ;
聽 聽 聽 ACTION MsgInfo( FWVERSION ) ;
聽 聽 聽 MESSAGE "Any BMP File here..." ;
聽 聽 聽 MENU oPopup
聽 聽DEFINE BUTTON OF oBar FILE "..\bitmaps\16x16\Cut.bmp" ;
聽 聽 聽 ACTION MsgInfo( FWVERSION ) ;
聽 聽 聽 MESSAGE "Reading it from disk !!!"
聽 聽SET MESSAGE OF oWnd TO FWVERSION + " " + FWCOPYRIGHT
聽 聽ACTIVATE WINDOW oWnd
return nil
///////////////////////////////////////////////////////////////////
/// FUNCION CamReso
/// CAMBIA RESOLUCION DE PANTALLA TEMPORALMENTE
/// Manuel Valdenebro 2008
/// Adaptaci贸n ChangeRes() Marcelo Gomes/Yuri Marcelino
/// <!-- m --><a class="postlink" href="http://www.fivewin.com.br/forum/topic.a">http://www.fivewin.com.br/forum/topic.a</a><!-- m --> ... C_ID=10465
/// ---------------------------------------
// nAncho ancho pantalla
// nAlto alto pantalla
// lPreguntar si pregunta antes de realizar el cambio
///////////////////////////////////////////////////////////////////
#Include "dll.ch"
#Include "Struct.ch"
Function CHANGE_SCR(nScrwidth, nScrheight, lChange)
Local DM_PELSWIDTH := nHex("80000")
Local DM_PELSHEIGHT := nHex("100000")
Local oDevMode
Local lPosible
Local cBuffer
Local lScrReso := .f.
*DEFAULT lPreguntar := .t.
*DEFAULT nScrwidth := GetSysMetrics(1) // Width
*DEFAULT nScrheight := GetSysMetrics(0) // Height
STRUCT oDevMode
MEMBER cDevName AS STRING LEN 32
MEMBER nSpecVer AS WORD
MEMBER nDrvVer AS WORD
MEMBER nSize AS WORD
MEMBER nDrvExtra AS WORD
MEMBER nFields AS DWORD
MEMBER nOrientat AS WORD
MEMBER nPaperSiz AS WORD
MEMBER nPaperLen AS WORD
MEMBER nPaperWid AS WORD
MEMBER nScale AS WORD
MEMBER nCopies AS WORD
MEMBER nDefSrc AS WORD
MEMBER nPrnQlty AS WORD
MEMBER nColor AS WORD
MEMBER nDuplex AS WORD
MEMBER nYResolut AS WORD
MEMBER nTTOpt AS WORD
MEMBER nCollate AS WORD
MEMBER cFormName AS STRING LEN 32
MEMBER nUnusePad AS WORD
MEMBER nBitsPPel AS DWORD
MEMBER nPelWidth AS DWORD
MEMBER nPelHeigh AS DWORD
MEMBER nDisFlags AS DWORD
MEMBER nDisFreq AS DWORD
ENDSTRUCT
cBuffer := oDevMode:cBuffer
// Comprueba si es posible cambiar la resoluci贸n
lPosible := EnumDisplaySettings(0, 0, @cBuffer)
// Change if possible
IF lPosible
聽 聽 IF lChange
聽 聽 聽 聽 IF MsgYesNo("Do You want to change the Resolution ?", "Attention")
聽 聽 聽 聽 ELSE
聽 聽 聽 聽 聽 聽 RETURN lScrReso
聽 聽 聽 聽 ENDIF
聽 聽 ENDIF
聽 聽 oDevMode:nFields := nOr(DM_PELSWIDTH, DM_PELSHEIGHT )
聽 聽 oDevMode:nPelWidth := nScrwidth
聽 聽 oDevMode:nPelHeigh := nScrheight
聽 聽 cBuffer:=oDevMode:cBuffer
聽 聽 TRY
聽 聽 聽 聽 ChangeDisplaySettings(@cBuffer, 4)
聽 聽 聽 聽 lScrReso := .T.
聽 聽 CATCH
聽 聽 聽 聽 MsgAlert("Modo no soportado", "Error" )
聽 聽 END
ELSE
聽 聽 MsgAlert("Modo no soportado", "Error" )
ENDIF
RETURN lScrReso
//----------------------------------------------------------------------------//
DLL32 FUNCTION EnumDisplaySettings(lpszDeviceName AS DWORD,;
iModeNum AS DWORD, ;
@lpDevMode AS LPSTR) AS BOOL PASCAL;
FROM "EnumDisplaySettingsA" LIB "User32.dll"
DLL32 FUNCTION ChangeDisplaySettings(@lpDevMode AS LPSTR,;
dwFlags AS DWORD) AS DWORD;
FROM "ChangeDisplaySettingsA" LIB "User32.dll"
DLL32 FUNCTION ExitWindowsEx(uFlags AS DWORD,;
dwReserved AS DWORD) AS DWORD PASCAL;
LIB "user32.dll"
Best Regards
Uwe
