FUNCTION Main()
LOCAL oBrush, oFont
oApp := TApplication():New()
IF !Main_Configure()
RETURN
ENDIF
IF !Acceso()
Main_Close()
RETURN
ENDIF
DEFINE BRUSH oBrush NAME "BM_FONDO2"
?oBrush:hBrush // fwh xhb return zero, i verify what bitmap "BM_FONDO2" is include in the exe
DEFINE FONT oFont NAME GetDefaultFontName() SIZE 0, GetDefaultFontHeight()
DEFINE WINDOW oApp:oMainWnd ;
FROM 1, 1 TO 600, 800 ;
TITLE "Sistema de control - CREDICOM, version 1.1a" ;
ICON GetIcon() ;
BRUSH oBrush
DEFINE MSGBAR oApp:oMsgBar OF oApp:oMainWnd PROMPT "KDSoft(c), Managua, Agosto 2011" 2010
DEFINE MSGITEM oApp:aoItemsMsgBar[ IMB_INFO_CONN ] OF oApp:oMsgBar PROMPT oApp:InfoConn() SIZE 330 COLOR CLR_BLUE, NIL
DEFINE MSGITEM oApp:aoItemsMsgBar[ IMB_INFO_UTYPE ] OF oApp:oMsgBar PROMPT oUser:cUserType SIZE 080 COLOR CLR_BLUE, NIL
DEFINE MSGITEM oApp:aoItemsMsgBar[ IMB_INFO_UID ] OF oApp:oMsgBar PROMPT oUser:cUserAlias SIZE 100 COLOR CLR_BLUE, NIL
oApp:oMsgBar:KeybOn()
oApp:oMainWnd:bInit := {|| oApp:oMainWnd:SetFont( oFont ), ShowMenu() }
ACTIVATE WINDOW oApp:oMainWnd MAXIMIZED VALID MsgNoYes( "Desea salir de la aplicación?", "Seleccione" )
Main_Close()
RETURN NIL
/*-------------------------------------------------------------------------------------------------*/
#include "credicom.ch"
/*-------------------------------------------------------------------------------------------------*/
GLOBAL EXTERNAL oApp, oUser
STATIC nIntentos
/*-------------------------------------------------------------------------------------------------*/
FUNCTION Acceso()
LOCAL oDlg
LOCAL oFnt1
LOCAL lAcceso
PRIVATE cAlias, cContrasena
#ifdef __PRUEBA__
cAlias := PadR( LOGIN_USERDEV, 10 )
cContrasena := PadR( LOGIN_PASSDEV, 10 )
#else
cAlias := Space( 10 )
cContrasena := Space( 10 )
#endif
lAcceso := FALSE
nIntentos := 0
DBSELECT "USUA"
USUA->( OrdSetFocus( "ALIAS" ), DBGoTop() )
DEFINE FONT oFnt1 NAME "Tahoma" SIZE 0,-12
DEFINE DIALOG oDlg NAME "DLG_ACCESO" ICON GetIcon() FONT oFnt1
REDEFINE BITMAP ID 301 OF oDlg NAME "BM_ACCESO" //this bitmap is not show in dialog, i verify what bitmap "BM_ACCESO" is included in the exe
REDEFINE GET cAlias ID 101 OF oDlg PICTURE "@!"
REDEFINE GET cContrasena ID 102 OF oDlg
REDEFINE BUTTON ID 201 OF oDlg ACTION IIf( lAcceso := Acceso_Validar( oDlg ), oDlg:END(), NIL )
REDEFINE BUTTON ID 202 OF oDlg ACTION oDlg:END() CANCEL
ACTIVATE DIALOG oDlg CENTER
LimpiarAreas()
RELEASE FONT oFnt1
RELEASE cAlias, cContrasena
RETURN lAcceso
/*-------------------------------------------------------------------------------------------------*/
HB_FUNC( LOADBITMAP )
{
#ifndef UNICODE
#ifndef _WIN64
HBITMAP hBmp = LoadBitmap( ( HINSTANCE ) hb_parnl( 1 ),
IF( HB_ISCHAR( 2 ), hb_parc( 2 ),
( LPSTR ) MAKEINTRESOURCE( hb_parnl( 2 ) ) ) );
#else
HBITMAP hBmp = LoadBitmap( ( HINSTANCE ) hb_parnll( 1 ),
IF( HB_ISCHAR( 2 ), hb_parc( 2 ),
( LPSTR ) MAKEINTRESOURCE( hb_parnl( 2 ) ) ) );
#endif
#else
LPWSTR pW = AnsiToWide( ( char * ) hb_parc( 2 ) );
HBITMAP hBmp = LoadBitmap( ( HINSTANCE ) hb_parnl( 1 ),
IF( HB_ISCHAR( 2 ), pW,
( LPWSTR ) MAKEINTRESOURCE( hb_parnl( 2 ) ) ) );
_xfree( pW );
#endif
RegisterResource( hBmp, "BMP" );
hb_retnl( ( unsigned long ) hBmp );
}
HB_FUNC( PALBMPLOAD ) // ( cResourceName )
{
#ifndef UNICODE
HRSRC hRes = FindResource( ( HMODULE ) GetResources(),
IF( HB_ISCHAR( 1 ), hb_parc( 1 ), MAKEINTRESOURCE( hb_parni( 1 ) ) ),
RT_BITMAP );
#else
LPWSTR pW = AnsiToWide( ( char * ) hb_parc( 1 ) );
HRSRC hRes = FindResource( ( HMODULE ) GetResources(),
IF( HB_ISCHAR( 1 ), pW, MAKEINTRESOURCE( hb_parni( 1 ) ) ),
RT_BITMAP );
#endif
HANDLE hResource = IF( hRes, LoadResource( GetResources(), hRes ), 0 );
#ifdef UNICODE
_xfree( pW );
#endif
if( hRes )
{
#ifndef __FLAT__
hb_reta( 2 );
hb_stornl( ( LONG ) hPalBitmapNew( 0, (LPBITMAPINFO) GlobalLock( hResource ) ), -1, 1 );
hb_stornl( ( LONG ) hPalette, -1, 2 );
GlobalUnlock( hResource );
#else
hb_reta( 2 );
hb_storvnl( ( LONG ) hPalBitmapNew( 0, ( struct tagBITMAPINFO * ) hResource ), -1, 1 );
hb_storvnl( ( LONG ) hPalette, -1, 2 );
#endif
#ifndef UNICODE
FreeResource( hResource );
#endif
}
else
{
hb_reta( 2 );
hb_storvnl( 0, -1, 1 );
hb_storvnl( 0, -1, 2 );
}
}
case cBmpRes != nil
::hBitmap = LoadBitmap( GetResources(), cBmpRes )
MsgInfo( GetErrMsg() )
?ProcName(),cBmpRes, GetResources(),::hBitmap
MsgInfo( GetErrMsg() )
::hBrush = If( ::hBitmap != 0, CreatePatternBrush( ::hBitmap ),)
MsgInfo( GetErrMsg() )
TBRUSH:NEW
BM_FONDO2
4194304
0
retorno de GetErrMsg es: El nombre de recurso especificado no se encuentra en el archivo de imagen.
METHOD LoadImage( cResName, cBmpFile ) CLASS TBitmap
local lChanged := .f.
local hBmpOld := ::hBitmap
local hPalOld := ::hPalette
local aBmpPal
DEFAULT cResName := ::cResName, cBmpFile := ::cBmpFile
if ! Empty( cResName )
?cBmpRes, GetResources()
aBmpPal = PalBmpLoad( cResName )
MsgInfo( GetErrMsg() )
::hBitmap = aBmpPal[ 1 ]
::hPalette = aBmpPal[ 2 ]
lChanged := .t.
cBmpFile := nil
TBITMAP:LOADIMAGE
BM_ACCESO
4194304
2
0
0
aca MsgInfo( GetErrMsg() ) indica operacion realizada correctamente, lo que pasa es que los valores del array son 0
#ifndef UNICODE
HRSRC hRes = FindResource( ( HMODULE ) GetResources(),
IF( HB_ISCHAR( 1 ), hb_parc( 1 ), MAKEINTRESOURCE( hb_parni( 1 ) ) ),
RT_BITMAP );
#else
HB_FUNC( FINDRESOURCE ) // ( hResources, cResourceName, nResType )
{
OutputDebugStringA("FindResource\n"); //esto nunca se llega amostrar en el depurador
#ifndef UNICODE
#ifndef _WIN64
hb_retnl( ( LONG ) FindResource( ( HINSTANCE ) hb_parnl( 1 ),
hb_parc( 2 ), MAKEINTRESOURCE( hb_parni( 3 ) ) ) );
#else
hb_retnl( ( LONG ) FindResource( ( HINSTANCE ) hb_parnll( 1 ),
hb_parc( 2 ), MAKEINTRESOURCE( hb_parni( 3 ) ) ) );
#endif
#else
LPWSTR pW = AnsiToWide( ( char * ) hb_parc( 2 ) );
hb_retnl( ( LONG ) FindResource( ( HINSTANCE ) hb_parnl( 1 ),
pW, MAKEINTRESOURCE( hb_parni( 3 ) ) ) );
_xfree( pW );
#endif
}
DEFINE DIALOG oDlg NAME "DLG_ACCESO" ICON GetIcon() FONT oFnt1
REDEFINE BITMAP ID 301 OF oDlg NAME "BM_ACCESO"
DEFINE DIALOG oDlg NAME "DLG_ACCESO" ICON GetIcon() FONT oFnt1
REDEFINE BITMAP ID 301 OF oDlg NAME "TB_DELETE"
TB_DELETE BITMAP ".\\bitmaps\\form_delete.bmp"
BM_ACCESO BITMAP ".\\bitmaps\\logo_acceso.bmp"
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 75 guests