<![CDATA[HMGforum.com]]> http://www.hmgforum.com Smartfeed extension for phpBB <![CDATA[HMG General Help :: Re: Print preview in HMG Console mode :: Reply by edk]]> 2024-04-24T16:40:20-05:00 2024-04-24T16:40:20-05:00 http://www.hmgforum.com/viewtopic.php?f=5&t=1633&p=71000#p71000

Code: Select all

#include "hmg.ch"

REQUEST HB_GT_WIN_DEFAULT
*----------------------------------------------------------------------------------*
Function Main
*----------------------------------------------------------------------------------*

DEFINE WINDOW startCons AT 0 , 0 WIDTH 0 HEIGHT 0 TITLE "" MAIN;
   ON INIT Console();
   NOSHOW; 
   NOMINIMIZE; 
   NOMAXIMIZE; 
   NOSIZE; 
   NOSYSMENU; 
   ICON Nil;
   BACKCOLOR Nil;
   NOCAPTION
END WINDOW
ACTIVATE WINDOW startCons
Return Nil

**************************** MAIN *****************************
Procedure Console
Public cons_hwnd := GETCONSOLEWINDOW()
SETCONSOLETITLE ( "New console title" )

SETMODE(25,80)
@0,0 CLEA

DO WHILE .T.
	@2,2 SAY 'PRESS F10 TO CALL FORM 1'
	@4,2 SAY 'PRESS F11 TO HIDE CONSOLE AND CALL FORM 1'
	@6,2 SAY 'PRESS ESC TO EXIT'
	INKEY(0)
	IF LASTKEY()=27
		QUIT
	ENDIF
	IF LASTKEY()=-9
		Form1()
		SetForegroundWindow(cons_hwnd)
	ENDIF
	IF LASTKEY()=-40
		HideConsole(cons_hwnd)
		Form1()
		ShowConsole(cons_hwnd)
	ENDIF
	KEYBOARD ""
ENDDO
RETURN


**********************************************************
FUNCTION Form1()

DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 800 HEIGHT 600 ;
      TITLE 'FORM 1'
      
      ON KEY Escape ACTION ThisWindow.Release
   
    DEFINE TEXTBOX Text_1
        ROW    50
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        VALUE "hello!"
    END TEXTBOX

    DEFINE TEXTBOX Text_2
        ROW    90
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        NUMERIC .T. 
        VALUE 100
    END TEXTBOX

    DEFINE TEXTBOX Text_3
        ROW    130
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        DATE .T. 
        VALUE ctod('01/01/01')
    END TEXTBOX

    DEFINE LABEL Label_1
        ROW    50
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_1"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    DEFINE LABEL Label_2
        ROW    90
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_2"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    DEFINE LABEL Label_3
        ROW    130
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_3"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    DEFINE FRAME Frame_1
        ROW    10
        COL    30
        WIDTH  310
        HEIGHT 170
        FONTNAME "Arial"
        FONTSIZE 9
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        CAPTION "Frame_1"
        BACKCOLOR NIL
        FONTCOLOR NIL
        OPAQUE .T.
    END FRAME

    DEFINE FRAME Frame_2
        ROW    190
        COL    30
        WIDTH  310
        HEIGHT 170
        FONTNAME "Arial"
        FONTSIZE 9
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        CAPTION "Frame_2"
        BACKCOLOR NIL
        FONTCOLOR NIL
        OPAQUE .T.
    END FRAME

    DEFINE TEXTBOX Text_4
        ROW    230
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        VALUE ""
    END TEXTBOX

    DEFINE TEXTBOX Text_5
        ROW    270
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        NUMERIC .T. 
        VALUE Nil
    END TEXTBOX

    DEFINE TEXTBOX Text_6
        ROW    310
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        VALUE ""
    END TEXTBOX

    DEFINE LABEL Label_4
        ROW    230
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_4"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    DEFINE LABEL Label_5
        ROW    270
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_5"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    DEFINE LABEL Label_6
        ROW    310
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_6"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    
END WINDOW

SetForegroundWindow ( Form_1.Handle )

CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1

RETURN

#pragma BEGINDUMP
#include "hbapi.h"
#include "hbapiitm.h"
#include <windows.h>

// doesn't work with win32 function GetConsoleWindow()
HWND GetConWin()
{
HWND hwnd;
AllocConsole();
hwnd = FindWindowA("ConsoleWindowClass",NULL);
return hwnd;
}

HB_FUNC( GETCONSOLEWINDOW )
{
hb_retnl((long) GetConWin() );
}

HB_FUNC(HIDECONSOLE )
{
long h = hb_parnl(1);
if (h==NULL)
	h = GetConWin();
ShowWindow(h,SW_HIDE); // SW_HIDE
}

HB_FUNC(SHOWCONSOLE )
{
long h = hb_parnl(1);
if (h==NULL)
	h = GetConWin();
ShowWindow(h,SW_SHOW); // because 1'st time console stays minimized
ShowWindow(h,SW_RESTORE); //SW_SHOW
SetFocus(h);
SetForegroundWindow(h);
}


HB_FUNC(SETCONSOLETITLE)
{ char * szTitle=hb_parc(1);
SetConsoleTitle(szTitle);
}

#pragma ENDDUMP
]]>

Code: Select all

#include "hmg.ch"

REQUEST HB_GT_WIN_DEFAULT
*----------------------------------------------------------------------------------*
Function Main
*----------------------------------------------------------------------------------*

DEFINE WINDOW startCons AT 0 , 0 WIDTH 0 HEIGHT 0 TITLE "" MAIN;
   ON INIT Console();
   NOSHOW; 
   NOMINIMIZE; 
   NOMAXIMIZE; 
   NOSIZE; 
   NOSYSMENU; 
   ICON Nil;
   BACKCOLOR Nil;
   NOCAPTION
END WINDOW
ACTIVATE WINDOW startCons
Return Nil

**************************** MAIN *****************************
Procedure Console
Public cons_hwnd := GETCONSOLEWINDOW()
SETCONSOLETITLE ( "New console title" )

SETMODE(25,80)
@0,0 CLEA

DO WHILE .T.
	@2,2 SAY 'PRESS F10 TO CALL FORM 1'
	@4,2 SAY 'PRESS F11 TO HIDE CONSOLE AND CALL FORM 1'
	@6,2 SAY 'PRESS ESC TO EXIT'
	INKEY(0)
	IF LASTKEY()=27
		QUIT
	ENDIF
	IF LASTKEY()=-9
		Form1()
		SetForegroundWindow(cons_hwnd)
	ENDIF
	IF LASTKEY()=-40
		HideConsole(cons_hwnd)
		Form1()
		ShowConsole(cons_hwnd)
	ENDIF
	KEYBOARD ""
ENDDO
RETURN


**********************************************************
FUNCTION Form1()

DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 800 HEIGHT 600 ;
      TITLE 'FORM 1'
      
      ON KEY Escape ACTION ThisWindow.Release
   
    DEFINE TEXTBOX Text_1
        ROW    50
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        VALUE "hello!"
    END TEXTBOX

    DEFINE TEXTBOX Text_2
        ROW    90
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        NUMERIC .T. 
        VALUE 100
    END TEXTBOX

    DEFINE TEXTBOX Text_3
        ROW    130
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        DATE .T. 
        VALUE ctod('01/01/01')
    END TEXTBOX

    DEFINE LABEL Label_1
        ROW    50
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_1"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    DEFINE LABEL Label_2
        ROW    90
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_2"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    DEFINE LABEL Label_3
        ROW    130
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_3"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    DEFINE FRAME Frame_1
        ROW    10
        COL    30
        WIDTH  310
        HEIGHT 170
        FONTNAME "Arial"
        FONTSIZE 9
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        CAPTION "Frame_1"
        BACKCOLOR NIL
        FONTCOLOR NIL
        OPAQUE .T.
    END FRAME

    DEFINE FRAME Frame_2
        ROW    190
        COL    30
        WIDTH  310
        HEIGHT 170
        FONTNAME "Arial"
        FONTSIZE 9
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        CAPTION "Frame_2"
        BACKCOLOR NIL
        FONTCOLOR NIL
        OPAQUE .T.
    END FRAME

    DEFINE TEXTBOX Text_4
        ROW    230
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        VALUE ""
    END TEXTBOX

    DEFINE TEXTBOX Text_5
        ROW    270
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        NUMERIC .T. 
        VALUE Nil
    END TEXTBOX

    DEFINE TEXTBOX Text_6
        ROW    310
        COL    190
        WIDTH  120
        HEIGHT 24
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        ONCHANGE Nil
        ONGOTFOCUS Nil
        ONLOSTFOCUS Nil
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONENTER Nil
        HELPID Nil
        TABSTOP .T.
        VISIBLE .T.
        READONLY .F.
        RIGHTALIGN .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
        INPUTMASK Nil
        FORMAT Nil
        VALUE ""
    END TEXTBOX

    DEFINE LABEL Label_4
        ROW    230
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_4"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    DEFINE LABEL Label_5
        ROW    270
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_5"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    DEFINE LABEL Label_6
        ROW    310
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_6"
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        FONTBOLD .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        HELPID Nil
        VISIBLE .T.
        TRANSPARENT .F.
        ACTION Nil
        AUTOSIZE .F.
        BACKCOLOR NIL
        FONTCOLOR NIL
    END LABEL

    
END WINDOW

SetForegroundWindow ( Form_1.Handle )

CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1

RETURN

#pragma BEGINDUMP
#include "hbapi.h"
#include "hbapiitm.h"
#include <windows.h>

// doesn't work with win32 function GetConsoleWindow()
HWND GetConWin()
{
HWND hwnd;
AllocConsole();
hwnd = FindWindowA("ConsoleWindowClass",NULL);
return hwnd;
}

HB_FUNC( GETCONSOLEWINDOW )
{
hb_retnl((long) GetConWin() );
}

HB_FUNC(HIDECONSOLE )
{
long h = hb_parnl(1);
if (h==NULL)
	h = GetConWin();
ShowWindow(h,SW_HIDE); // SW_HIDE
}

HB_FUNC(SHOWCONSOLE )
{
long h = hb_parnl(1);
if (h==NULL)
	h = GetConWin();
ShowWindow(h,SW_SHOW); // because 1'st time console stays minimized
ShowWindow(h,SW_RESTORE); //SW_SHOW
SetFocus(h);
SetForegroundWindow(h);
}


HB_FUNC(SETCONSOLETITLE)
{ char * szTitle=hb_parc(1);
SetConsoleTitle(szTitle);
}

#pragma ENDDUMP
]]>
<![CDATA[HMG General Help :: Re: Print preview in HMG Console mode :: Reply by mol]]> 2024-04-25T01:29:51-05:00 2024-04-25T01:29:51-05:00 http://www.hmgforum.com/viewtopic.php?f=5&t=1633&p=71001#p71001 <![CDATA[HMG General Help :: Re: IMPORT EXCEL FILE TO DBF :: Reply by AUGE_OHR]]> 2024-04-25T01:31:14-05:00 2024-04-25T01:31:14-05:00 http://www.hmgforum.com/viewtopic.php?f=5&t=1155&p=71002#p71002
RPC wrote: Sat Apr 20, 2024 5:56 am Hope nothing serious.
Get well soon.
hi,
I had a stroke, so it was heavy

back again at work

you can download ADO here
Microsoft Access Database Engine 2016 Redistributable
https://www.microsoft.com/en-us/downloa ... x?id=54920

you can read full story in HMG Forum here https://www.hmgforum.com/viewtopic.php?f=5&t=6285
there is a ADORDD for xHarbour here https://github.com/AHFERREIRA/adordd]]>
RPC wrote: Sat Apr 20, 2024 5:56 am Hope nothing serious.
Get well soon.
hi,
I had a stroke, so it was heavy

back again at work

you can download ADO here
Microsoft Access Database Engine 2016 Redistributable
https://www.microsoft.com/en-us/downloa ... x?id=54920

you can read full story in HMG Forum here https://www.hmgforum.com/viewtopic.php?f=5&t=6285
there is a ADORDD for xHarbour here https://github.com/AHFERREIRA/adordd]]>
<![CDATA[HMG General Help :: Re: IMPORT EXCEL FILE TO DBF :: Reply by serge_girard]]> 2024-04-25T02:10:08-05:00 2024-04-25T02:10:08-05:00 http://www.hmgforum.com/viewtopic.php?f=5&t=1155&p=71003#p71003
Stroke is heavy so be careful!

Serge]]>

Stroke is heavy so be careful!

Serge]]>
<![CDATA[HMG General Help :: Re: IMPORT EXCEL FILE TO DBF :: Reply by gfilatov]]> 2024-04-25T02:35:23-05:00 2024-04-25T02:35:23-05:00 http://www.hmgforum.com/viewtopic.php?f=5&t=1155&p=71004#p71004
AUGE_OHR wrote: Thu Apr 25, 2024 6:31 am hi,
I had a stroke, so it was heavy
Hi Jimmy,

I wish you a speedy recovery as soon as possible. :roll:

Thank you for your help on both the HMG and Fivewin forums :!:]]>
AUGE_OHR wrote: Thu Apr 25, 2024 6:31 am hi,
I had a stroke, so it was heavy
Hi Jimmy,

I wish you a speedy recovery as soon as possible. :roll:

Thank you for your help on both the HMG and Fivewin forums :!:]]>
<![CDATA[HMG General Help :: Re: IMPORT EXCEL FILE TO DBF :: Reply by mol]]> 2024-04-25T04:37:13-05:00 2024-04-25T04:37:13-05:00 http://www.hmgforum.com/viewtopic.php?f=5&t=1155&p=71005#p71005 <![CDATA[HMG General Help :: Re: IMPORT EXCEL FILE TO DBF :: Reply by AUGE_OHR]]> 2024-04-25T04:50:57-05:00 2024-04-25T04:50:57-05:00 http://www.hmgforum.com/viewtopic.php?f=5&t=1155&p=71006#p71006 Thank you everyone for the well wishes.

What bothers me most is that I forgot things like passwords]]>
Thank you everyone for the well wishes.

What bothers me most is that I forgot things like passwords]]>
<![CDATA[HMG General Help :: Re: IMPORT EXCEL FILE TO DBF :: Reply by edk]]> 2024-04-25T08:52:41-05:00 2024-04-25T08:52:41-05:00 http://www.hmgforum.com/viewtopic.php?f=5&t=1155&p=71008#p71008 <![CDATA[General :: Re: VOCAL CON TILDE :: Reply by franco]]> 2024-04-24T12:25:11-05:00 2024-04-24T12:25:11-05:00 http://www.hmgforum.com/viewtopic.php?f=24&t=7538&p=70999#p70999 <![CDATA[General :: Re: VOCAL CON TILDE :: Reply by edk]]> 2024-04-25T08:39:54-05:00 2024-04-25T08:39:54-05:00 http://www.hmgforum.com/viewtopic.php?f=24&t=7538&p=71007#p71007

Code: Select all

#include "HMG.CH"


FUNCTION MAIN()

SET CODEPAGE TO UNICODE
SET LANGUAGE TO SPANISH

DEFINE WINDOW UNO AT 0,0 WIDTH 0 HEIGHT 0 BACKCOLOR {0,125,250} NOCAPTION MAIN
   FRASE := "ESA MÁSCARA CAUSA CÁNCER"
   LETRA := { 'A', 'Á' } 			// LETRA A BUSCAR EN LA FRASE Y MOSTRARLA

   LARGO := hb_ULen(ALLTRIM(FRASE))
   X := 1
   Y := 1

DO WHILE LARGO > 0
   LETT := hb_USubStr(FRASE,X,1)		// CADA LETRA
   L1 := 'L'+ALLTRIM(STR(X))		// LABEL PARA MOSTRAR TODAS LAS LETRAS MENOS LA Á (INCLUYE ESPACIOS)
   L2 := 'M'+ALLTRIM(STR(X))		// LABEL PARA LLEVAR NUMERACIÓN DE X
 
   DO CASE
	CASE ASCAN ( LETRA, LETT ) = 2			//LETT = "Á"
		aColor := {   0 , 255 ,   0 }		//GREEN

	CASE ASCAN ( LETRA, LETT ) = 1			//LETT = "A"
		aColor := { 255 , 255 ,   0 }		//YELLOW

	CASE LETT = " "
		LETT := "_"
		aColor := { 128 ,  64 ,  64 }		//BROWN
	OTHER
		aColor := { 255 , 255 , 255 }		//WHITE
   ENDCASE

   @ 099,X*50 LABEL &L1 VALUE LETT WIDTH 99 HEIGHT 70 FONT "TAHOMA" SIZE 48 BOLD FONTCOLOR aColor BACKCOLOR {0,125,250}
   @ 200,X*50 LABEL &L2 VALUE STR(X,2,0) WIDTH 99 HEIGHT 70 FONT "TAHOMA" SIZE 20 BOLD FONTCOLOR aColor BACKCOLOR {0,125,250}

   X++
   Y++
   LARGO--

ENDDO   
ON KEY ESCAPE ACTION UNO.RELEASE
END WINDOW
UNO.MAXIMIZE
UNO.ACTIVATE
RETURN
When operating on strings of characters encoded in Unicode, you should use functions dedicated to this encoding:

https://github.com/Petewg/harbour-core/wiki/Strings

hb_UAt( <cSubString>, <cString>, [<nFrom>], [<nTo>] ) ➜ nAt
Unicode counterpart of 'hb_At()'.

hb_UCode( <cText> ) ➜ nCode
return Unicode value of 1-st character (not byte) in given string. Similar to 'hb_UTF8Asc()'.

hb_ULen( <cText> ) ➜ nChars
returns the length of unicode string <cText>, in characters.

hb_ULeft( <cString>, <nCount> ) ➜ cSubstring
same as 'Left()' but applicable to UTF8 encoded text.

hb_UPadC(<exp>, <nLength>, [<cFillChar>]) ➜ cPaddedString
same as 'PadC()' but Unicode oriented.

hb_UPadL(<exp>, <nLength>, [<cFillChar>]) ➜ cPaddedString same as 'PadL()' but Unicode oriented.

hb_UPadR(<exp>, <nLength>, [<cFillChar>]) ➜ cPaddedString
same as 'PadR()' but Unicode oriented.

hb_UPeek( <cText>, <n> ) ➜ nCode
return unicode value of <n>-th character in given string

hb_UPoke( [@]<cText>, <n>, <nVal> ) ➜ cText
change <n>-th character in given string to unicode <nVal> one and return modified text.

hb_URight( <cString>, <nCount> ) ➜ cSubstring

hb_UStuff( <cString>, <nAt>, <nDel>, <cIns> ) ➜ cResult
Unicode counterpart of 'Staff()'.

hb_USubStr( <cString>, <nStart>, <nCount> ) ➜ cSubstring
Unicode counterpart of 'SubStr()'.

hb_utf8Asc( <cExp> ) ➜ nUTF8CharCode
same as 'Asc()' but applicable to UTF8 encoded text. Similar to 'hb_UCode()'.

hb_utf8At(<...>) ➜ nPos
same as hb_At() but applicable to UTF8 encoded text.

hb_utf8Chr( <n> ) ➜ cUTF8Char
same as 'Chr()' but applicable to UTF8 encoded text.

hb_utf8Left(...) ➜ cString
same as 'Left()' but applicable to UTF8 encoded text.

hb_utf8Len(`' ) ➜ nLen same as 'Len()' but applicable to UTF8 encoded text.

hb_utf8Peek( <cText>, <n> ) ➜ nCode
return UTF8 value of <n>-th character in given string.

hb_utf8Poke( [@]<cText>, <n>, <nVal> ) ➜ cText
replace <n>-th character in given string to UTF8 <nVal> one and return modified text.

hb_utf8RAt() ➜ nPos
same as 'hb_RAt()' but applicable to UTF8 encoded text.

hb_utf8Right() ➜ nPos
same as 'Right()' but applicable to UTF8 encoded text.

hb_utf8StrTran() ➜ cString
same as 'StrTran()' but applicable to UTF8 encoded text.

hb_utf8Stuff() ➜ cString
same as 'Stuff()' but applicable to UTF8 encoded text.

hb_utf8SubStr() ➜ cString
same as 'SubStr()' but applicable to UTF8 encoded text.

hb_utf8ToStr( <cUTF8Str> [, <cCPID>] ) ➜ cStr
it performs "translation" from UTF-8 to <cCPID> Harbour codepage id, f.e.: "EN", "ES", "ESWIN" etc.
<cUTF8Str> supposed to be a UTF-8 encoded string.
When <cCPID> is not given then the default HVM codepage (i.e. that set by hb_cdpSelect()) is used.]]>

Code: Select all

#include "HMG.CH"


FUNCTION MAIN()

SET CODEPAGE TO UNICODE
SET LANGUAGE TO SPANISH

DEFINE WINDOW UNO AT 0,0 WIDTH 0 HEIGHT 0 BACKCOLOR {0,125,250} NOCAPTION MAIN
   FRASE := "ESA MÁSCARA CAUSA CÁNCER"
   LETRA := { 'A', 'Á' } 			// LETRA A BUSCAR EN LA FRASE Y MOSTRARLA

   LARGO := hb_ULen(ALLTRIM(FRASE))
   X := 1
   Y := 1

DO WHILE LARGO > 0
   LETT := hb_USubStr(FRASE,X,1)		// CADA LETRA
   L1 := 'L'+ALLTRIM(STR(X))		// LABEL PARA MOSTRAR TODAS LAS LETRAS MENOS LA Á (INCLUYE ESPACIOS)
   L2 := 'M'+ALLTRIM(STR(X))		// LABEL PARA LLEVAR NUMERACIÓN DE X
 
   DO CASE
	CASE ASCAN ( LETRA, LETT ) = 2			//LETT = "Á"
		aColor := {   0 , 255 ,   0 }		//GREEN

	CASE ASCAN ( LETRA, LETT ) = 1			//LETT = "A"
		aColor := { 255 , 255 ,   0 }		//YELLOW

	CASE LETT = " "
		LETT := "_"
		aColor := { 128 ,  64 ,  64 }		//BROWN
	OTHER
		aColor := { 255 , 255 , 255 }		//WHITE
   ENDCASE

   @ 099,X*50 LABEL &L1 VALUE LETT WIDTH 99 HEIGHT 70 FONT "TAHOMA" SIZE 48 BOLD FONTCOLOR aColor BACKCOLOR {0,125,250}
   @ 200,X*50 LABEL &L2 VALUE STR(X,2,0) WIDTH 99 HEIGHT 70 FONT "TAHOMA" SIZE 20 BOLD FONTCOLOR aColor BACKCOLOR {0,125,250}

   X++
   Y++
   LARGO--

ENDDO   
ON KEY ESCAPE ACTION UNO.RELEASE
END WINDOW
UNO.MAXIMIZE
UNO.ACTIVATE
RETURN
When operating on strings of characters encoded in Unicode, you should use functions dedicated to this encoding:

https://github.com/Petewg/harbour-core/wiki/Strings

hb_UAt( <cSubString>, <cString>, [<nFrom>], [<nTo>] ) ➜ nAt
Unicode counterpart of 'hb_At()'.

hb_UCode( <cText> ) ➜ nCode
return Unicode value of 1-st character (not byte) in given string. Similar to 'hb_UTF8Asc()'.

hb_ULen( <cText> ) ➜ nChars
returns the length of unicode string <cText>, in characters.

hb_ULeft( <cString>, <nCount> ) ➜ cSubstring
same as 'Left()' but applicable to UTF8 encoded text.

hb_UPadC(<exp>, <nLength>, [<cFillChar>]) ➜ cPaddedString
same as 'PadC()' but Unicode oriented.

hb_UPadL(<exp>, <nLength>, [<cFillChar>]) ➜ cPaddedString same as 'PadL()' but Unicode oriented.

hb_UPadR(<exp>, <nLength>, [<cFillChar>]) ➜ cPaddedString
same as 'PadR()' but Unicode oriented.

hb_UPeek( <cText>, <n> ) ➜ nCode
return unicode value of <n>-th character in given string

hb_UPoke( [@]<cText>, <n>, <nVal> ) ➜ cText
change <n>-th character in given string to unicode <nVal> one and return modified text.

hb_URight( <cString>, <nCount> ) ➜ cSubstring

hb_UStuff( <cString>, <nAt>, <nDel>, <cIns> ) ➜ cResult
Unicode counterpart of 'Staff()'.

hb_USubStr( <cString>, <nStart>, <nCount> ) ➜ cSubstring
Unicode counterpart of 'SubStr()'.

hb_utf8Asc( <cExp> ) ➜ nUTF8CharCode
same as 'Asc()' but applicable to UTF8 encoded text. Similar to 'hb_UCode()'.

hb_utf8At(<...>) ➜ nPos
same as hb_At() but applicable to UTF8 encoded text.

hb_utf8Chr( <n> ) ➜ cUTF8Char
same as 'Chr()' but applicable to UTF8 encoded text.

hb_utf8Left(...) ➜ cString
same as 'Left()' but applicable to UTF8 encoded text.

hb_utf8Len(`' ) ➜ nLen same as 'Len()' but applicable to UTF8 encoded text.

hb_utf8Peek( <cText>, <n> ) ➜ nCode
return UTF8 value of <n>-th character in given string.

hb_utf8Poke( [@]<cText>, <n>, <nVal> ) ➜ cText
replace <n>-th character in given string to UTF8 <nVal> one and return modified text.

hb_utf8RAt() ➜ nPos
same as 'hb_RAt()' but applicable to UTF8 encoded text.

hb_utf8Right() ➜ nPos
same as 'Right()' but applicable to UTF8 encoded text.

hb_utf8StrTran() ➜ cString
same as 'StrTran()' but applicable to UTF8 encoded text.

hb_utf8Stuff() ➜ cString
same as 'Stuff()' but applicable to UTF8 encoded text.

hb_utf8SubStr() ➜ cString
same as 'SubStr()' but applicable to UTF8 encoded text.

hb_utf8ToStr( <cUTF8Str> [, <cCPID>] ) ➜ cStr
it performs "translation" from UTF-8 to <cCPID> Harbour codepage id, f.e.: "EN", "ES", "ESWIN" etc.
<cUTF8Str> supposed to be a UTF-8 encoded string.
When <cCPID> is not given then the default HVM codepage (i.e. that set by hb_cdpSelect()) is used.]]>