Jump to content
mutleey

Form printing with good quality

Recommended Posts

mutleey

Hello everybody, I have a problem here ... I need to generate a form of sale and print quality using the form I could do is not getting good, I created a window without borders with the fields I need, then use the function _ScreenCapture_CaptureWnd () to generate a print of this window and send the image to the printer using the UDF printMGv2.au3, the problem is that to get a good quality I would have to create a huge window to get the print, any suggestions to print this form with a good quality?
thank you...

example of the form it takes:

 

ImgTemp.jpg

Share this post


Link to post
Share on other sites
l3ill

Hi,

I can imagine when printing a form via PrtScr you are not going to get the best quality..

Is there a possibility to go a different route, like creating a PDF or using excel to create a form?

I personally use excel to build forms as it allows for simpler form filling automation ...

Bill

Share this post


Link to post
Share on other sites
mutleey

Thank you, to start the window was what I thought best, most had not considered the possibility of a PDF or Excel.

Still not getting good results with these methods mentioned, I think the best way would be to create the image (bmp or jpg) with GDI + however I'm picking up a lot ... maybe an experienced member in GDI + as the UEZ can shed some light.

Edited by mutleey

Share this post


Link to post
Share on other sites
UEZ

Your uploaded image has a dim. of 624 x 796 pixels (96 dpi) -> 16.5 x 21.0 cm; 6.48 x 8.28 inches. On a DIN A4 paper and portrait format it takes approx. 66% of the paper.

When you print that image from an ext. program such as IrfanView for example, how is the print out quality?

 

From https://www.prepressure.com/library/paper-size/din-a4:

Quote

At 300 ppi (pixels per inch) the image needs to be 2480 x 3508 pixels. This is the required resolution for quality offset printing that will be viewed from a short distance (such as books, brochures, magazines, calenders,…). For photo books it is also the optimum resolution but a somewhat lower pixel count (250 dpi) is acceptable for great looking photographs.

At 150 ppi the image needs to be 1240 x 1754 pixels. This is the minimum resolution for newspapers or posters viewed from a fairly short distance.

 

 

Edited by UEZ
  • Like 1

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
mutleey

Even using IrfanView printing is too bad, as I mentioned above I created a GUI with the fields needed and used the _ScreenCapture_CaptureWnd() function to generate the bmp image and then sent to the printer, to be good like you even mentioned I would have create a huge window more thought into creating bmp using GDI + for then would have set a large image 2480 x 3508 pixels perhaps ... the problem is that I could not add the rectangles in the image created.

thanks for the answer.

Edited by mutleey

Share this post


Link to post
Share on other sites
kylomas

mutleey,

Are you sure it is the document and not printer settings?

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
mutleey

kylomas,

Yes, as the UEZ comments the way I did the image is low resolution, and the way that I would have to create a huge GUI to get good results.

Share this post


Link to post
Share on other sites
UEZ

Did you print the image with modifying the print size (e.g. best fit, stretch, ...) in the printer settings? 


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
AndyG

...it is not depending on printer settings...

THIS

example printer.jpg

is the "original" picture-quality sended to the printer. Which printer in the world makes gold from shi* ???

If you want a more "clearer" (printable) Screenshot, try to change your windows settings of the font/cleartype. What looks "good" onto screen (cleartype) is not implicitly a good printout.

Share this post


Link to post
Share on other sites
mutleey

UEZ yes I used the stretch to fill the entire sheet so the image lost the quality, the window that generated the printscreen has 624x796 pixels.

AndyG yes is not the printer to determine the quality and the image already has a low resolution.

 

I do not have much experience with GDI+ one more push already help, for example create this GUI with these rectangles and labels.

 

ex.jpg

Edited by mutleey

Share this post


Link to post
Share on other sites
UEZ

Can you post the test GUI code from post #1?

 

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
AndyG

@ mutleey, did you read what i wrote? CLEARTYPE is the problem! It makes the font which you see onto your monitor/screen "smoother" and generates those "subpixels" where are responsible of the bad printout! Try to disable cleartype and show us the result.

http://www.thewindowsclub.com/disable-font-smoothing-windows

http://superuser.com/questions/297455/toggle-cleartype-windows-7

Share this post


Link to post
Share on other sites
Luigi

@Mutley, não é exatamente o que você queria, mas é disso que estou falando...

Criar uma imagem de fundo, e adicionar os controles necessários, esse exemplo é básico, mas pode ser o início de uma solução.

Após a composição da imagem, você pode imprimir normalmente.

A melhor ideia seria criar uma imagem pronta, com o formulário vazio, e imprimir na imagem apenas as informações, assim fica mais rápido também.

 

This example it is a toy, to create, move, resize, delete and set color to many Contols.

In this example, it work with GuiCtrlCreateLabel, but can be adapted to any control.

The Mod()'s function it's a attempt to move a Control to 8 to 8 pixels only, for example, not 1 to 1.

If you not want this way/recurse, only comment delete the lines have Mod() function.

If you want to improve this function, it's is welcome.

Use Secondary mouse button, to Add, Delete, Set Color and export to PNG.

Use Primary over the control to Move or Resize.

 

 

;~ #AutoIt3Wrapper_AU3Check_Parameters= -q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
;~ #Tidy_Parameters=/sf
; #FUNCTION# ====================================================================================================================
; Name ..........: No name
; Description ...: Allow create, move, resize, delete and set color a GuiCtrlCreateLabel and export to PNG image
; Syntax ........: 
; Parameters ....: 
; Return values .: 
; Author ........: Luigi
; Example .......: 
; ===============================================================================================================================
#include-once
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <File.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
#include <GuiMenu.au3>
#include <WinAPIGdi.au3>
#include <Misc.au3>
#include <GDIPlus.au3>

OnAutoItExitRegister("OnExit")

Opt("GUIOnEventMode", 1)
Opt("GUIEventOptions", 1)
Opt("MustDeclareVars", 1)


Global $aGuiSize[2] = [800, 600]
Global $sGuiTitle = "GuiTitle"
Global $hGui
Global $hUm, $hDois
Global $aCursor, $aMouse[5], $aMove[6], $arr, $size
Global $iLimit = 6
Global $aCursor2, $aMouse2[5]
Global $SUM, $DX, $DY
Global $hDummy, $hDummyContext, $hDummyContextMenu
Global $focus

_GDIPlus_Startup()
Global $hBitmap
Global $hContext
Global $hBrush = _GDIPlus_BrushCreateSolid()
Global $hFormat, $hFamily, $hFont, $tLayout, $aInfo


Global $hPen
$hPen = _GDIPlus_PenCreate()



Global Const $UP = 1, $RIGHT = 2, $DOWN = 4, $LEFT = 8
Global Const $UP_RIGHT = $UP + $RIGHT, $UP_LEFT = $UP + $LEFT, $DOWN_RIGHT = $DOWN + $RIGHT, $DOWN_LEFT = $DOWN + $LEFT

$hGui = GUICreate($sGuiTitle, $aGuiSize[0], $aGuiSize[1], -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetBkColor(0xFFFFFF, $hGui)

_CreateDummy($hDummy, $hDummyContext, $hDummyContextMenu, "Add=Context_Add;Del=Context_Del;Color=Context_Color;Image=Context_CreateImage")

Global $aNode[1] = [0]
Global $SID = IniRead("label.ini", "config", "id", 1)

Global $NODES = IniReadSection("label.ini", "objetos")
If IsArray($NODES) Then
    ReDim $NODES[UBound($NODES, 1)][3]
Else
    Global $NODES[1][3] = [[0]]
EndIf

If IsArray($NODES) Then
    For $ii = 1 To $NODES[0][0]
        NewObj($NODES[$ii][0], $NODES[$ii][1], $ii)
    Next
EndIf

Func NewObj($ID = 0, $input = 0, $ii = 0)
    If $ID Then
        $input = StringSplit($input, ",", 2)
        $NODES[$ii][2] = GUICtrlCreateLabel($ID, $input[0], $input[1], $input[2], $input[3], $SS_SUNKEN)
        GUICtrlSetBkColor($NODES[$ii][2], Number($input[4]))
    Else
        Local $color = NewColor()
        $aCursor = GUIGetCursorInfo($hGui)

        $aCursor[0] -= Mod($aCursor[0], 20) + 10
        $aCursor[1] -= Mod($aCursor[1], 20) + 10


        Local $new = GUICtrlCreateLabel($SID, $aCursor[0], $aCursor[1], 40, 40, $SS_SUNKEN)
        GUICtrlSetBkColor($new, $color)
        $SID += 1
        IniWrite("label.ini", "config", "id", $SID)
        IniWrite("label.ini", "objetos", $SID, ",,,," & $color)
        _ArrayAdd2d($NODES, $SID, "", $new)
    EndIf
EndFunc   ;==>NewObj

Func NewColor()
    Return "0x" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)
EndFunc   ;==>NewColor

Func _ArrayAdd2d(ByRef $arr, $mOpt0 = Default, $mOpt1 = Default, $mOpt2 = Default, $mOpt3 = Default, $mOpt4 = Default, $mOpt5 = Default, $mOpt6 = Default, $mOpt7 = Default)
    $arr[0][0] = UBound($arr, 1)
    Local $iCol = UBound($arr, 2)
    ReDim $arr[$arr[0][0] + 1][$iCol]
    If @NumParams - 1 < $iCol Then $iCol = @NumParams - 1
    For $ii = 0 To $iCol - 1
        $arr[$arr[0][0]][$ii] = Eval("mOpt" & $ii)
    Next
EndFunc   ;==>_ArrayAdd2d

GUICtrlSetState($hUm, $GUI_ONTOP)
;~ _WinAPI_BringWindowToTop(GUICtrlGetHandle($hUm))

GUICtrlSetBkColor($hUm, 0x336633)
GUICtrlSetBkColor($hDois, 0x996633)

GUISetState(@SW_SHOW, $hGui)


While Sleep(25)
    $aCursor = GUIGetCursorInfo($hGui)
    If IsArray($aCursor) Then
        If $aCursor[3] Then
            _GUICtrlMenu_TrackPopupMenu($hDummyContextMenu, $hGui)
        EndIf
        $focus = $aCursor[4] ? $aCursor[4] : 0
        If $aCursor[2] Then
            If $aCursor[4] Then
                $aMouse[4] = $aCursor[4]
                $arr = ControlGetPos($hGui, "", $aCursor[4])
                $aMove[0] = $arr[0] - $aCursor[0]
                ConsoleWrite("[" & $aMove[0] & "] [" & $arr[0] & "] [" & $aCursor[0] & "]" & @LF)
                $aMove[1] = $arr[1] - $aCursor[1]

                $aCursor2 = GUIGetCursorInfo($hGui)

                Switch $SUM
                    Case $DOWN
                        GUISetCursor(11, 1, $hGui)
                        $DX = $aCursor2[1] - $arr[3]
                        While IsArray($aCursor2) And $aCursor2[2]
                            $aCursor2 = GUIGetCursorInfo($hGui)
                            If ($aCursor2[1] <> $aMouse2[1]) Then
                                ControlMove($hGui, "", $aCursor[4], $arr[0], $arr[1], $arr[2], $aCursor2[1] - $DX)
                                $aMouse2[1] = $aCursor2[1]
                                _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_INVALIDATE)
                            EndIf
                        WEnd
                    Case $UP
                        GUISetCursor(11, 1, $hGui)
                        $aMouse2[1] = $aCursor2[1]
                        While IsArray($aCursor2) And $aCursor2[2]
                            $aCursor2 = GUIGetCursorInfo($hGui)
                            If ($aCursor2[1] <> $aMouse2[1]) Then
                                $size = $aMouse2[1] - $aCursor2[1]
                                $arr[1] -= $size
                                $arr[3] += $size
                                ControlMove($hGui, "", $aCursor[4], $arr[0], $arr[1], $arr[2], $arr[3])
                                $aMouse2[1] = $aCursor2[1]
                                _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_INVALIDATE)
                            EndIf
                        WEnd
                    Case $RIGHT
                        GUISetCursor(13, 1, $hGui)
                        $DY = $aCursor2[0] - $arr[2]
                        While IsArray($aCursor2) And $aCursor2[2]
                            $aCursor2 = GUIGetCursorInfo($hGui)
                            If ($aCursor2[0] <> $aMouse2[0]) Then
                                ControlMove($hGui, "", $aCursor[4], $arr[0], $arr[1], $aCursor2[0] - $DY, $arr[3])
                                $aMouse2[0] = $aCursor2[0]
                                _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_INVALIDATE)
                            EndIf
                        WEnd
                    Case $LEFT
                        GUISetCursor(13, 1, $hGui)
                        $aMouse2[0] = $aCursor2[0]
                        While IsArray($aCursor2) And $aCursor2[2]
                            $aCursor2 = GUIGetCursorInfo($hGui)
                            If ($aCursor2[0] <> $aMouse2[0]) Then
                                $size = $aMouse2[0] - $aCursor2[0]
                                $arr[0] -= $size
                                $arr[2] += $size
                                ControlMove($hGui, "", $aCursor[4], $arr[0], $arr[1], $arr[2], $arr[3])
                                $aMouse2[0] = $aCursor2[0]
                                _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_INVALIDATE)
                            EndIf
                        WEnd
                    Case $UP_RIGHT
                        GUISetCursor(10, 1, $hGui)
                        $aMouse2[1] = $aCursor2[1]
                        $DY = $aCursor2[0] - $arr[2]
                        While IsArray($aCursor2) And $aCursor2[2]
                            $aCursor2 = GUIGetCursorInfo($hGui)
                            If ($aCursor2[1] <> $aMouse2[1]) Or ($aCursor2[0] <> $aMouse2[0]) Then
                                $size = $aMouse2[1] - $aCursor2[1]
                                $arr[1] -= $size
                                $arr[3] += $size
                                $arr[2] = $aCursor2[0] - $DY
                                ControlMove($hGui, "", $aCursor[4], $arr[0], $arr[1], $arr[2], $arr[3])
                                $aMouse2[0] = $aCursor2[0]
                                $aMouse2[1] = $aCursor2[1]
                                _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_INVALIDATE)
                            EndIf
                        WEnd
                    Case $DOWN_RIGHT
                        GUISetCursor(12, 1, $hGui)
                        $DY = $aCursor2[0] - $arr[2]
                        $DX = $aCursor2[1] - $arr[3]
                        While IsArray($aCursor2) And $aCursor2[2]
                            $aCursor2 = GUIGetCursorInfo($hGui)
                            If ($aCursor2[0] <> $aMouse2[0]) Or ($aCursor2[1] <> $aMouse2[1]) Then
                                $arr[2] = $aCursor2[0] - $DY
                                ControlMove($hGui, "", $aCursor[4], $arr[0], $arr[1], $arr[2], $aCursor2[1] - $DX)
                                $aMouse2[0] = $aCursor2[0]
                                $aMouse2[1] = $aCursor2[1]
                                _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_INVALIDATE)
                            EndIf
                        WEnd
                    Case $UP_LEFT
                        GUISetCursor(12, 1, $hGui)
                        $aMouse2[0] = $aCursor2[0]
                        $aMouse2[1] = $aCursor2[1]
                        While IsArray($aCursor2) And $aCursor2[2]
                            $aCursor2 = GUIGetCursorInfo($hGui)
                            If ($aCursor2[0] <> $aMouse2[0]) Or ($aCursor2[1] <> $aMouse2[1]) Then
                                $size = $aMouse2[1] - $aCursor2[1]
                                $arr[1] -= $size
                                $arr[3] += $size
                                $size = $aMouse2[0] - $aCursor2[0]
                                $arr[0] -= $size
                                $arr[2] += $size
                                ControlMove($hGui, "", $aCursor[4], $arr[0], $arr[1], $arr[2], $arr[3])
                                $aMouse2[0] = $aCursor2[0]
                                $aMouse2[1] = $aCursor2[1]
                                _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_INVALIDATE)
                            EndIf
                        WEnd
                    Case $DOWN_LEFT
                        GUISetCursor(10, 1, $hGui)
                        $aMouse2[0] = $aCursor2[0]
                        $DX = $aCursor2[1] - $arr[3]
                        While IsArray($aCursor2) And $aCursor2[2]
                            $aCursor2 = GUIGetCursorInfo($hGui)
                            If ($aCursor2[0] <> $aMouse2[0]) Or ($aCursor2[1] <> $aMouse2[1]) Then
                                $size = $aMouse2[0] - $aCursor2[0]
                                $arr[0] -= $size
                                $arr[2] += $size
                                ControlMove($hGui, "", $aCursor[4], $arr[0], $arr[1], $arr[2], $aCursor2[1] - $DX)
                                $aMouse2[0] = $aCursor2[0]
                                $aMouse2[1] = $aCursor2[1]
                                _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_INVALIDATE)
                            EndIf
                        WEnd
                    Case Else
                        GUISetCursor(9, 1, $hGui)
                        While IsArray($aCursor2) And $aCursor2[2]
                            $aCursor2 = GUIGetCursorInfo($hGui)
                            If ($aCursor2[0] <> $aMouse2[0]) Or ($aCursor2[1] <> $aMouse2[1]) Then
                                $aCursor2[0] = $aCursor2[0] - Mod($aCursor2[0], 20) ;+ $aMove[0]
                                ConsoleWrite("[" & $aCursor2[0] & "] [" & $aMove[0] & "] [" & $aCursor2[0] - Mod($aCursor2[0], 20) & "]" & @LF)
                                $aCursor2[1] = $aCursor2[1] - Mod($aCursor2[1], 20); + $aMove[1]
                                $aMouse2[0] = $aCursor2[0]
                                $aMouse2[1] = $aCursor2[1]

                                ControlMove($hGui, "", $aCursor[4], $aCursor2[0], $aCursor2[1], $arr[2], $arr[3])
                                _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_INVALIDATE)
                            EndIf
                        WEnd
                EndSwitch

                GUISetCursor(6, 1, $hGui)
            Else

            EndIf
        Else
            If $aCursor[4] Then
                $arr = ControlGetPos($hGui, "", $aCursor[4])
                $aMove[0] = $arr[0] - $aCursor[0]
                $aMove[1] = $arr[1] - $aCursor[1]
                $SUM = 0

                If $aMove[0] <= 0 And $aMove[0] > -$iLimit Then $SUM += $LEFT
                If $aMove[0] <= -($arr[2] - $iLimit) And $aMove[0] >= -$arr[2] Then $SUM += $RIGHT
                If $aMove[1] <= 0 And $aMove[1] > -$iLimit Then $SUM += $UP
                If $aMove[1] <= -($arr[3] - $iLimit) And $aMove[1] >= -$arr[3] Then $SUM += $DOWN

                Switch $SUM
                    Case $UP
                        GUISetCursor(11, 1, $hGui)
                    Case $DOWN
                        GUISetCursor(11, 1, $hGui)
                    Case $RIGHT
                        GUISetCursor(13, 1, $hGui)
                    Case $UP_RIGHT
                        GUISetCursor(10, 1, $hGui)
                    Case $DOWN_RIGHT
                        GUISetCursor(12, 1, $hGui)
                    Case $LEFT
                        GUISetCursor(13, 1, $hGui)
                    Case $UP_LEFT
                        GUISetCursor(12, 1, $hGui)
                    Case $DOWN_LEFT
                        GUISetCursor(10, 1, $hGui)
                    Case Else
                        GUISetCursor(6, 1, $hGui)
                EndSwitch
            Else
                GUISetCursor(6, 1, $hGui)
            EndIf
        EndIf


    EndIf
WEnd

Func OnExit()
    For $ii = 1 To $NODES[0][0]
        IniWrite("label.ini", "objetos", $NODES[$ii][0], _ArrayToString(ControlGetPos($hGui, "", $NODES[$ii][2]), ",") & "," & GUICtrlGetBkColor($NODES[$ii][2]))
    Next
    _GDIPlus_GraphicsDispose($hContext)
    _GDIPlus_BitmapDispose($hBitmap)

    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)



    _GDIPlus_Shutdown()
    GUISetState($hGui, @SW_HIDE)
    GUIDelete($hGui)
EndFunc   ;==>OnExit

Func Quit()
    Exit
EndFunc   ;==>Quit


Func _CreateDummy(ByRef $dummy, ByRef $context, ByRef $menu, $cmd)
    Local $aDummy[1][3]
    _ArrayAdd($aDummy, $cmd, Default, "=", ";")
    $dummy = GUICtrlCreateDummy()
    $context = GUICtrlCreateContextMenu($dummy)
    $menu = GUICtrlGetHandle($context)
    For $ii = 1 To UBound($aDummy, 1) - 1
        $aDummy[$ii][2] = GUICtrlCreateMenuItem($aDummy[$ii][0], $context)
        If $aDummy[$ii][1] Then GUICtrlSetOnEvent($aDummy[$ii][2], $aDummy[$ii][1])
    Next
EndFunc   ;==>_CreateDummy

Func Context_Add()
    NewObj()
EndFunc   ;==>Context_Add

Func _box($hToGraphic, $iXX, $iYY, $iWW, $iHH, $iColor = 0, $bFill = False)
    ; _box3
    _GDIPlus_BrushSetSolidColor($hBrush, $iColor)
    If $iWW = 1 And $iHH = 1 Then
        If $iColor Then
            _GDIPlus_GraphicsFillRect($hToGraphic, $iXX, $iYY, $iWW, $iHH, $hBrush)
        Else
            _GDIPlus_GraphicsFillRect($hToGraphic, $iXX, $iYY, $iWW, $iHH)
        EndIf
    Else
        Local $aBox[5][2]
        $aBox[0][0] = 4
        $aBox[1][0] = $iXX
        $aBox[1][1] = $iYY
        $aBox[2][0] = $iXX + $iWW - 1
        $aBox[2][1] = $iYY
        $aBox[3][0] = $iXX + $iWW - 1
        $aBox[3][1] = $iYY + $iHH - 1
        $aBox[4][0] = $iXX
        $aBox[4][1] = $iYY + $iHH - 1
        If $iColor Then
            _GDIPlus_PenSetColor($hPen, $iColor)
            _GDIPlus_GraphicsFillPolygon($hToGraphic, $aBox, $hBrush)
            _GDIPlus_GraphicsDrawPolygon($hToGraphic, $aBox, $hPen)
        Else
            _GDIPlus_GraphicsDrawPolygon($hToGraphic, $aBox)
        EndIf
    EndIf
EndFunc   ;==>_box

Func _Text($hToGraphic, $sFont, $sText, $iSize, $iXX, $iYY, $iWW, $iHH, $iColor)
    _GDIPlus_BrushSetSolidColor($hBrush, $iColor)
    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate($sFont)
    $hFont = _GDIPlus_FontCreate($hFamily, $iSize, 0)
    $tLayout = _GDIPlus_RectFCreate($iXX, $iYY, $iWW, $iHH)
    $aInfo = _GDIPlus_GraphicsMeasureString($hToGraphic, $sText, $hFont, $tLayout, $hFormat)
    _GDIPlus_GraphicsDrawStringEx($hToGraphic, $sText, $hFont, $aInfo[0], $hFormat, $hBrush)

EndFunc   ;==>_Text

Func Context_CreateImage()
    ConsoleWrite("Context_CreateImage()" & @LF)
    Local $aControlGetPos, $iColor, $sText
    Local $iR, $iG, $iB
    $hBitmap = _GDIPlus_BitmapCreateFromScan0($aGuiSize[0], $aGuiSize[1])
    $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)

    _GDIPlus_GraphicsSetSmoothingMode($hContext, 0)
    _GDIPlus_GraphicsClear($hContext, 0xFFFFFFFF)

    For $ii = 1 To $NODES[0][0]
        $aControlGetPos = ControlGetPos($hGui, "", $NODES[$ii][2])
        $iColor = GUICtrlGetBkColor($NODES[$ii][2])
        $iR = _WinAPI_GetRValue($iColor)
        $iG = _WinAPI_GetGValue($iColor)
        $iB = _WinAPI_GetBValue($iColor)
        $iColor = "0x99" & Hex(_WinAPI_RGB($iR, $iG, $iB), 6)
        _box($hContext, $aControlGetPos[0], $aControlGetPos[1], $aControlGetPos[2], $aControlGetPos[3], $iColor, True)
        $sText = GUICtrlRead($NODES[$ii][2])
        _Text($hContext, "Courier New", $sText, 10, $aControlGetPos[0], $aControlGetPos[1], $aControlGetPos[2], $aControlGetPos[3], 0xFF000000)
    Next

    Local $sFile = @TempDir & "\Test.png"
    FileDelete($sFile)
    _GDIPlus_ImageSaveToFile($hBitmap, $sFile) ;save bitmap to disk
    ShellExecute($sFile)
EndFunc   ;==>Context_CreateImage

Func Context_Del()
    Local $find = _ArraySearch($NODES, $focus, 1, Default, 0, 0, 0, 2)
    ConsoleWrite("$focus[" & $focus & "] $find[" & $find & "]" & @LF)
    If $find >= 0 Then
        GUICtrlDelete($focus)
        IniDelete("label.ini", "objetos", $NODES[$find][0])
        _ArrayDelete($NODES, $find)
        $aCursor = GUIGetCursorInfo($hGui)
    EndIf
    $NODES[0][0] = UBound($NODES, 1) - 1
EndFunc   ;==>Context_Del

Func Context_Color()
    If Not $focus Then Return
    Local $color = GUICtrlGetBkColor($focus)
    Local $NewColor = _ChooseColor(2, $color, 2, $hGui)
    If $NewColor = -1 Then Return
    GUICtrlSetBkColor($focus, $NewColor)
EndFunc   ;==>Context_Color

; #FUNCTION# ====================================================================================================================
; Name ..........: GUICtrlGetBkColor
; Description ...: Retrieves the RGB value of the control background.
; Syntax ........: GUICtrlGetBkColor($hWnd)
; Parameters ....: $hWnd                - Control ID/Handle to the control
; Return values .: Success - RGB value
;                  Failure - 0
; Author ........: guinness
; Example .......: Yes
; ===============================================================================================================================
Func GUICtrlGetBkColor($hWnd)
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
    Local $hDC = _WinAPI_GetDC($hWnd)
    Local $iColor = _WinAPI_GetPixel($hDC, 0, 0)
    _WinAPI_ReleaseDC($hWnd, $hDC)
    Return $iColor
EndFunc   ;==>GUICtrlGetBkColor

 

Edited by Luigi
  • Like 1

Visit my repository

Share this post


Link to post
Share on other sites
mutleey
4 hours ago, UEZ said:

Can you post the test GUI code from post #1?

 

#include <ScreenCapture.au3>
#include <GUIConstantsEx.au3>
#include 'printMGv2.au3'

ImprimePedido("Steve Jobs", "2350.20")

Func ImprimePedido($Str1, $Str2)
    Local $WS_POPUP = 0x80000000 ; Creates a pop-up window. This style cannot be used with the WS_CHILD style.
    Local $SS_CENTER = 0x01 ; Specifies a simple rectangle and centers the error value text in the rectangle. The control automatically wraps words that extend past the end of a line to the beginning of the next centered line.
    Local $Branco = 0xFFFFFF, $Cinza2 = 0xCCCCCC
    Local $rCli = FileReadToArray(@AppDataDir & "\GJA\Cli\" & $Str1)
    If @error Then Return

    Global $GuiPedido = GUICreate("Descrição de Pedidos", 624, 796, -1, -1, $WS_POPUP)
    GUISetBkColor($Branco)

    GUICtrlCreateLabel("Sales Description", 24, 34, 380, 34)
    GUICtrlSetFont(-1, 16, 400, 0, "Arial Black")

    GUICtrlCreateGroup(" Date ", 512, 42, 89, 33)
    GUICtrlCreateLabel(@MDAY & "/" & @MON & "/" & @YEAR, 518, 56, 80, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "", 5)

    GUICtrlCreateGroup(" Name ", 24, 82, 385, 33)
    GUICtrlCreateLabel($Str1, 30, 96, 372, 16)
    GUICtrlSetFont(-1, 10, 400, 2, "", 5)

    GUICtrlCreateGroup(" CPF/CNPJ ", 416, 82, 185, 33)
    If $rCli[29] = "none" Then $rCli[29] = ""
    GUICtrlCreateLabel($rCli[29], 422, 96, 172, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "", 5)

    GUICtrlCreateGroup(" Adddress ", 24, 122, 297, 33)

    Local $EndNum
    Select
        Case $rCli[0] <> "none" And $rCli[1] <> "none"
            $EndNum = $rCli[0] & ", " & $rCli[1]
        Case $rCli[0] <> "none" And $rCli[1] = "none"
            $EndNum = $rCli[0] & ", SN"
        Case Else
            $EndNum = ""
    EndSelect
    GUICtrlCreateLabel($EndNum, 30, 136, 284, 16)
    GUICtrlSetFont(-1, 10, 400, 2, "", 5)

    GUICtrlCreateGroup(" District ", 328, 122, 169, 33)
    If $rCli[2] = "none" Then $rCli[2] = ""
    GUICtrlCreateLabel($rCli[2], 332, 136, 160, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "", 5)

    GUICtrlCreateGroup(" Zip ", 504, 122, 97, 33)
    If $rCli[5] = "none" Then $rCli[5] = ""
    GUICtrlCreateLabel($rCli[5], 508, 136, 88, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "", 5)

    GUICtrlCreateGroup(" County ", 24, 162, 185, 33)
    If $rCli[3] = "none" Then $rCli[3] = ""
    GUICtrlCreateLabel($rCli[3], 30, 176, 174, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "", 5)

    GUICtrlCreateGroup(" UF ", 216, 162, 49, 33)
    If $rCli[4] = "none" Then $rCli[4] = ""
    GUICtrlCreateLabel($rCli[4], 220, 176, 40, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "", 5)

    GUICtrlCreateGroup(" Phone ", 272, 162, 129, 33)
    If $rCli[18] = "none" Then $rCli[18] = "    "
    If $rCli[19] = "none" Then $rCli[19] = "                  "
    GUICtrlCreateLabel("(" & $rCli[18] & ")" & "  " & $rCli[19], 276, 176, 120, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "", 5)

    GUICtrlCreateGroup(" State Registration ", 408, 162, 193, 33)
    GUICtrlSetFont(-1, 10, 400, 2, "", 5)

    GUICtrlCreateLabel("Quantity", 24, 234, 72, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 9, 400, 0, "Calibri", 5)
    GUICtrlSetbkColor(-1, $Cinza2)

    GUICtrlCreateLabel("Weight", 102, 234, 55, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 9, 400, 0, "Calibri", 5)
    GUICtrlSetbkColor(-1, $Cinza2)

    GUICtrlCreateLabel("Unit", 163, 234, 55, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 9, 400, 0, "Calibri", 5)
    GUICtrlSetbkColor(-1, $Cinza2)

    GUICtrlCreateLabel("Description", 224, 234, 206, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 9, 400, 0, "Calibri", 5)
    GUICtrlSetbkColor(-1, $Cinza2)

    GUICtrlCreateLabel("Unitary Value", 436, 234, 81, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 9, 400, 0, "Calibri", 5)
    GUICtrlSetbkColor(-1, $Cinza2)

    GUICtrlCreateLabel("Total", 522, 234, 78, 16, $SS_CENTER)
    GUICtrlSetFont(-1, 9, 400, 0, "Calibri", 5)
    GUICtrlSetbkColor(-1, $Cinza2)

    GUICtrlCreateGroup("", 24, 248, 73, 444)
    GUICtrlCreateGroup("", 102, 248, 56, 444)
    GUICtrlCreateGroup("", 163, 248, 56, 444)
    GUICtrlCreateGroup("", 224, 248, 207, 444)
    GUICtrlCreateGroup("", 436, 248, 81, 444)
    GUICtrlCreateGroup("", 522, 248, 79, 444)
    GUICtrlCreateGroup("", 456, 704, 125, 33)

    GUICtrlCreateLabel("Value", 370, 715, 80, 17)
    GUICtrlSetFont(-1, 10, 600, 0, "Calibri", 5)
    GUICtrlCreateLabel("R$ " & StringFormat("%.2f", $Str2), 460, 714, 116, 17, $SS_CENTER)
    GUICtrlSetFont(-1, 10, 600, 0, "Calibri", 5)

    GUISetState(@SW_SHOW)
    Imprimir_Pedido()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUIDelete()
                ExitLoop
        EndSwitch
    WEnd
EndFunc

; Captura o print da janela
Func Imprimir_Pedido()
    ; Variáveis usadas na impressão
    Local $hPrinter
    Local $Jpg = @ScriptDir & "\NotaIMG.jpg"
    Global $hDll = @ScriptDir & "\PrintMG.dll"; abre a DLL
    Local $pgwd = 2020; ; Largura da imagem
    Local $pght = 2880; Altura da imagem

    ; Capture window
    _ScreenCapture_CaptureWnd($Jpg, $GuiPedido, 0, 0, -1, -1, False)

    $hPrinter = _PrintDllStart($hDll); abre as funções da DLL em $hPrinter

    _PrintPageOrientation($hPrinter, 1) ; Define 0 horizontal ou 1 vertical
    _PrintStartPrint($hPrinter) ; Inicia a impressão
    _PrintImage($hPrinter, $Jpg, 0, 0, $pgwd, $pght) ; Imprime a imagem
    _PrintEndPrint($hPrinter) ; Finaliza a impressão
EndFunc

@Luigi Very good your example, it is basically what I do the same ... I will take a study in code. thank you.

 

@AndyG yes cleartype used in labels, did not know it was generating subpixels in the sources :(

Share this post


Link to post
Share on other sites
UEZ

The example is not running. I assume because of missing files.

Local $rCli = FileReadToArray(@AppDataDir & "\GJA\Cli\" & $Str1)

 


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • AndyS19
      By AndyS19
      The _WinAPI_TextOut() function requires a x/y point.  In a rectangle enclosing a text character, where is the x/y point, upper left or lower left?  I'm trying to setup a function to print a header, then normal text lines, and I want the header to be at the top of the printable area on a page..  I use _WinAPI_GetDeviceCaps() to get the start of the printable area.  Then at the start of each page, I want to print a header, then text lines.
      $iLeftMargin_X = _WinAPI_GetDeviceCaps($hDC, $PHYSICALOFFSETX) ; returns 151 $iTopMargin_Y = _WinAPI_GetDeviceCaps($hDC, $PHYSICALOFFSETY) ; returns 70 ; print the header: $x = $iLeftMargin_X $y = $iTopMargin_Y WinAPI_TextOut($hDC, $x , $y, "header text") ; print the first text line $y += 22 WinAPI_TextOut($hDC, $x , $y, "The first text line") Will the header text be at the physical top of the printable area or will it be 1 text line lower.  It all depends on whether $iTopMargin_Y refers to the top of the text or the bottom of the text.
    • jasontj
      By jasontj
      Hello.  I'm working on converting another script from IE to Firefox.  I can't seem to get a handle on the field "Defendant" to fill in a last, first name on this page:
      http://www.hcdistrictclerk.com/Edocs/Public/Search.aspx?Tab=tabCriminal
      I also can't seem to submit the form.   I've tried the code below... stuff may be commented out that I have tested.
       
          _FFOpenUrl("http://www.hcdistrictclerk.com/Edocs/Public/Search.aspx?Tab=tabCriminal")    
          _FFLoadWait()
          $oTextFN = _FSObjGet("ctl00_ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_ContentPlaceHolder2_tabSearch_tabCriminal_txtCrimDefendant", "ID")
          
          _FFObj($oTextFN, "value", "Smith, John")    
          $subButton = _FFObjGet("ctl00$ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$ContentPlaceHolder2$btnSearch", "name")
          _FFClick($subButton)
          _FFLoadWait()
          
      ;    _FFFormSubmit()
      ;    _FFLoadWait()
       
      Any help from the experts on here would be greatly appreciated.  
       
      Jason
       
       
       
       
    • argumentum
      By argumentum
      by  eltorro Posted April 26, 2010
      Most print preview solutions use the MFC Doc/View architecture which limits it usefulness outside of c++. I found an article where a Delphi programmer used Enhanced Meta Files wrapped in a custom header and packaged together to create a print preview control. After a little more searching, It looks like using EMFs is a solution that would work.
      Some people suggest to create the document in Word or HTML and use Word or a browser to view it. Indeed, I have rendered documents to HTML and used the IE UDF to display the contents and/or print them. Not quite as ideal as one would like.
      Using GRS's printwin.au3 as a start, I came up with a print preview solution which others may be able to expand upon
    • Gowrisankar
      By Gowrisankar
      Hello everyone,
      I'm trying to pass values to elements in a website.
      The elements are present within a table, which is again present within a table, which is inside a form.
      I tried to read the form, tables, etc., but with no results. It appears to me that the elements, tables, form, etc., were not read at all.
      The following is what I tried. Please guide me.
      ;I tried the following to read the tables into arrays #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate() _IENavigate($oIE, "---- URL HERE ----") _IELoadWait($oIE) $o_Table = _IETableGetCollection ($oIE) $i_NumTables = @extended For $i = 0 To $i_NumTables - 1 Step 1 $o_Table_Temp2 = _IETableGetCollection ($oIE, $i) $a_TableData = _IETableWriteToArray ($o_Table_Temp2) _ArrayDisplay($a_TableData) Next  
      ;I tried the following code to pass value to the field #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate() _IENavigate($oIE, "---- URL HERE ----", 0) _IELoadWait($oIE) Local $oForm = _IEFormGetObjByName($oIE, "default") Local $oField = _IEFormElementGetObjByName($oForm, "tGroup") _IEFormElementSetValue($oField, "---- VALUE HERE ----")  
      The following is the html view of the website and the highlighted field is the one that I want to pass values to. Since this is an official website, I can't share the exact url.

    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening guys ( almost good night here in Italy )  
      How are you? Hop you're fine  
      I'm trying to do a Login Form ( I did, but I'm missing something in the management ), that allows the user to login when the script is launched, and, when the main GUI is opened, the user can Logout and Login with another username and password.
      The username and password "checking" I do is done by a text file, which in there are username and password, crypted through _Crypt_EncryptData().
      The "issue" I'm having at the moment, is to manage the Login form when the user hasn't already done the login, and so, the main GUI is not visible, but is created...
      I create the main GUI after the Login form... I tried with WinActive, WinGetState, but nothing changed ( even at the first Login, the script says ( through a MsgBox ) that the Win does exists ( or is active... ) and, as I want, it is not shown again...

      I really don't know If I missed something, or, I don't know...
      I'm going crazy for this thing...
      If someone could help me, I'd really appreaciate it!
      Thanks for the reading
      #Region ### START Koda GUI section ### Form=C:\Users\Portatile-60\Documents\Documenti Lavoro\AutoIt\Gestione_Magazzino_v2\form_Login.kxf Global $form_Login = GUICreate("Effettua il Login per continuare:", 405, 120, @DesktopWidth/2 - 202.5, @DesktopHeight/2 - 150) ; 302, 218 GUISetOnEvent($GUI_EVENT_CLOSE, "GUIDeleteLogin") Global $combo_Username = GUICtrlCreateCombo("Di Muro Francesco", 104, 64, 217, 25) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetData($combo_Username, "somedata") Global $input_Password = GUICtrlCreateInput("", 104, 89, 217, 25, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") $button_VerificaDati = GUICtrlCreateButton("", 328, 66, 42, 42, $BS_ICON) GUICtrlSetImage(-1, "C:\Users\Portatile-60\Documents\Documenti Lavoro\AutoIt\Gestione_Magazzino_v2\Icone\icon_check.ico", -1) GUICtrlSetOnEvent($button_VerificaDati, "CheckLogin") $label_Titolo = GUICtrlCreateLabel("Login", 167, 14, 71, 33) GUICtrlSetFont(-1, 18, 800, 0, "Arial") $label_Username = GUICtrlCreateLabel("Username :", 24, 64, 76, 20) GUICtrlSetFont(-1, 10, 800, 0, "Arial") $label_Password = GUICtrlCreateLabel("Password :", 24, 89, 73, 20) GUICtrlSetFont(-1, 10, 800, 0, "Arial") #EndRegion ### END Koda GUI section ### Func CheckLogin() Local $sUsername = GUICtrlRead($combo_Username) Local $sPassword = GUICtrlRead($input_Password) MsgBox($MB_ICONINFORMATION, "", "Username: " & $sUsername & @CRLF & "Password: " & $sPassword) Local $sFileUtenti = @ScriptDir & "\utenti.txt" If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la lettura del file!") Exit Else Local $hFileUtenti = FileOpen($sFileUtenti, $FO_READ) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'apertura del file " & $sFileUtenti & "." & @CRLF & "Errore: " & @error) Else Local $sDatiUtente, $aDatiUtente Local $bUtenteTrovato = False Local $iLinea = 1 Local $sControlloWin = "" Local $sWin = WinGetState($form_GestioneMagazzino) MsgBox($MB_ICONINFORMATION, "", $sWin) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la verifica della GUI attiva." & @CRLF & "Errore: " & @error) EndIf If($sWin == 5) Then MsgBox($MB_ICONINFORMATION, "", "La GUI esiste!") Do $sDatiUtente = FileReadLine($hFileUtenti, $iLinea) $aDatiUtente = StringSplit($sDatiUtente, "|", $STR_NOCOUNT) If(BinaryToString(_Crypt_DecryptData($aDatiUtente[0], "CRYPT", $CALG_RC4)) = $sUsername And BinaryToString(_Crypt_DecryptData($aDatiUtente[1], "CRYPT", $CALG_RC4)) = $sPassword) Then $sControlloWin = "ESISTE" $bUtenteTrovato = True ExitLoop Else $iLinea+=1 If($sDatiUtente = "" And $bUtenteTrovato = False) Then MsgBox($MB_ICONWARNING, "Attenzione!", "Username o Password errati.") ExitLoop EndIf EndIf Until $bUtenteTrovato = True Else MsgBox($MB_ICONINFORMATION, "", "La GUI esiste!") Do $sDatiUtente = FileReadLine($hFileUtenti, $iLinea) $aDatiUtente = StringSplit($sDatiUtente, "|", $STR_NOCOUNT) If(BinaryToString(_Crypt_DecryptData($aDatiUtente[0], "CRYPT", $CALG_RC4)) = $sUsername And BinaryToString(_Crypt_DecryptData($aDatiUtente[1], "CRYPT", $CALG_RC4)) = $sPassword) Then $sControlloWin = "NON ESISTE" $bUtenteTrovato = True ExitLoop Else $iLinea+=1 If($sDatiUtente = "" And $bUtenteTrovato = False) Then MsgBox($MB_ICONWARNING, "Attenzione!", "Username o Password errati.") ExitLoop EndIf EndIf Until $bUtenteTrovato = True EndIf If($sControlloWin = "ESISTE") Then MsgBox($MB_ICONINFORMATION, "Login effettuato!", "Hai effettuato l'accesso come: " & @CRLF & $sUsername & ".") ; Setta come "non-cliccabile" il bottone di Login GUICtrlSetState($button_Login, $GUI_DISABLE) GUICtrlSetState($button_VisualizzaGiacenze, $GUI_ENABLE) GUICtrlSetState($button_AggiungiProdotto, $GUI_ENABLE) GUICtrlSetState($button_PrelevaProdotto, $GUI_ENABLE) GUICtrlSetState($button_RicercaProdotto, $GUI_ENABLE) GUICtrlSetState($button_CreaDDT, $GUI_ENABLE) GUICtrlSetState($button_MostraGiacenzeAZero, $GUI_ENABLE) GUICtrlSetState($combo_Magazzino, $GUI_ENABLE) GUICtrlSetState($button_Logout, $GUI_ENABLE) ; Setta come "non-cliccabile" il bottone di Login GUICtrlSetState($button_Login, $GUI_DISABLE) ; Setta l'utente che ha effettuato l'accesso nella label $label_CaptionUtente GUICtrlSetData($label_CaptionUtente, $sUsername) ; "Distruggi" la GUI Login GUIDelete($form_Login) FileClose($hFileUtenti) Else MsgBox($MB_ICONINFORMATION, "", "La GUI non esiste!") MsgBox($MB_ICONINFORMATION, "Login effettuato!", "Hai effettuato l'accesso come: " & @CRLF & $sUsername & ".") ; Mostra la GUI Principale GUISetState(@SW_SHOW, $form_GestioneMagazzino) ; Setta come "non-cliccabile" il bottone di Login GUICtrlSetState($button_Login, $GUI_DISABLE) ; Setta l'utente che ha effettuato l'accesso nella label $label_CaptionUtente GUICtrlSetData($label_CaptionUtente, $sUsername) ; "Distruggi" la GUI Login GUIDelete($form_Login) FileClose($hFileUtenti) EndIf EndIf EndIf EndFunc Func Logout() GUICtrlSetData($label_CaptionUtente, "") MsgBox($MB_ICONINFORMATION, "Logout effettuato!", "Effettua nuovamente il Login per utilizzare il programma.") ; Disabilita tutti i bottoni della GUI Principale GUICtrlSetState($button_VisualizzaGiacenze, $GUI_DISABLE) GUICtrlSetState($button_AggiungiProdotto, $GUI_DISABLE) GUICtrlSetState($button_PrelevaProdotto, $GUI_DISABLE) GUICtrlSetState($button_RicercaProdotto, $GUI_DISABLE) GUICtrlSetState($button_CreaDDT, $GUI_DISABLE) GUICtrlSetState($button_MostraGiacenzeAZero, $GUI_DISABLE) GUICtrlSetState($combo_Magazzino, $GUI_DISABLE) GUICtrlSetState($button_Logout, $GUI_DISABLE) ; Abilita il Login GUICtrlSetState($button_Login, $GUI_ENABLE) EndFunc EDIT:
      Solved, making an "integrated" Login form... 
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.