Sign in to follow this  
Followers 0
Artisan

Help with BitBlt

3 posts in this topic

I'm coding a GUI that using a lot of GDI (not GDI+) output.  I've been manually redrawing things as needed via WM_PAINT.  It's awkward and slow, and it can flicker a lot.  Then I found out about _WinAPI_BitBlt.  I've looked all over the forums here, and all over the internet in general.  I think I understand the basics of it, but I can't get it to work.  I think what I want to do is manipulate $hDCSource and then BitBlt it onto $hDCDest.  Here's my reducer sample:

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global Const $Width = 100, $Height = 100
Global $Left = 50, $Top = 50
Global $hwnd, $hDCDest, $hDCSource, $hPenLil, $hPenFat, $hBrush
Main()

Func Main()

    ; GUI & GDI handles
    $hwnd = GUICreate("BitBlt Test", 300, 300)
    $hDCDest = _WinAPI_GetDC($hwnd)
    $hDCSource = _WinAPI_CreateCompatibleDC($hDCDest)
    $hPenLil = _WinAPI_CreatePen($PS_SOLID, 1, 0xFFFFFF)
    $hPenFat = _WinAPI_CreatePen($PS_SOLID, 3, 0x00FF00)
    $hBrush = _WinAPI_CreateSolidBrush(0xFFFFFF)

    ; Fill white rectangle
    Local $tRect = DllStructCreate($tagRect)
        DllStructSetData($tRect, "Left", $Left)
        DllStructSetData($tRect, "Top", $Top)
        DllStructSetData($tRect, "Right", $Left + $Width)
        DllStructSetData($tRect, "Bottom", $Top + $Height)
    _WinAPI_FillRect($hDCSource, $tRect, $hBrush)

    ; Thick green outline
    _WinAPI_SelectObject($hDCSource, $hPenFat)
    _WinAPI_MoveTo($hDCSource, $Left, $Top)
    _WinAPI_LineTo($hDCSource, $Left + $Width, $Top)
    _WinAPI_LineTo($hDCSource, $Left + $Width, $Top + $Height)
    _WinAPI_LineTo($hDCSource, $Left, $Top + $Height)
    _WinAPI_LineTo($hDCSource, $Left, $Top)

    ; Thin black outline
    _WinAPI_SelectObject($hDCSource, $hPenLil)
    _WinAPI_MoveTo($hDCSource, $Left, $Top)
    _WinAPI_LineTo($hDCSource, $Left + $Width, $Top)
    _WinAPI_LineTo($hDCSource, $Left + $Width, $Top + $Height)
    _WinAPI_LineTo($hDCSource, $Left, $Top + $Height)
    _WinAPI_LineTo($hDCSource, $Left, $Top)

    GUIRegisterMsg($WM_PAINT, "WM_PAINT")
    GUISetState(@SW_SHOW, $hwnd)

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

Func WM_PAINT()
;   _WinAPI_BitBlt($hDCDest, $Left, $Top, $Width, $Height, $hDCSource, $Left, $Top, $BLACKNESS) ; Works
    _WinAPI_BitBlt($hDCDest, $Left, $Top, $Width, $Height, $hDCSource, $Left, $Top, $SRCCOPY)   ; Doesn't work
EndFunc

Func Quit()
    _WinAPI_ReleaseDC($hwnd, $hDCDest)
    _WinAPI_DeleteDC($hDCSource)
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_DeleteObject($hPenLil)
    _WinAPI_DeleteObject($hPenFat)
    GUIDelete($hwnd)
    Exit
EndFunc

What am I doing wrong?

Share this post


Link to post
Share on other sites

You forgot to create the bitmap where you draw your graphics.

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global Const $Width = 100, $Height = 100
Global $Left = 50, $Top = 50
Global $hwnd, $hDCDest, $hDCSource, $hPenLil, $hPenFat, $hBrush, $hHBitmap
Main()

Func Main()

    ; GUI & GDI handles
    $hwnd = GUICreate("BitBlt Test", 300, 300)
    GUISetState(@SW_SHOW, $hwnd)

    $hDCDest = _WinAPI_GetDC($hwnd)
    $hDCSource = _WinAPI_CreateCompatibleDC($hDCDest)
    $hHBitmap = _WinAPI_CreateSolidBitmap($hwnd, 0, 300, 300)
    _WinAPI_SelectObject($hDCSource, $hHBitmap)

    $hPenLil = _WinAPI_CreatePen($PS_SOLID, 1, 0xFFFFFF)
    $hPenFat = _WinAPI_CreatePen($PS_SOLID, 3, 0x00FF00)
    $hBrush = _WinAPI_CreateSolidBrush(0xFFFFFF)

    ; Fill white rectangle
    Local $tRect = DllStructCreate($tagRect)
        DllStructSetData($tRect, "Left", $Left)
        DllStructSetData($tRect, "Top", $Top)
        DllStructSetData($tRect, "Right", $Left + $Width)
        DllStructSetData($tRect, "Bottom", $Top + $Height)

    _WinAPI_SelectObject($hDCSource, $hBrush)
    _WinAPI_FillRect($hDCSource, $tRect, $hBrush)

    ; Thick green outline
    _WinAPI_SelectObject($hDCSource, $hPenFat)
    _WinAPI_MoveTo($hDCSource, $Left, $Top)
    _WinAPI_LineTo($hDCSource, $Left + $Width, $Top)
    _WinAPI_LineTo($hDCSource, $Left + $Width, $Top + $Height)
    _WinAPI_LineTo($hDCSource, $Left, $Top + $Height)
    _WinAPI_LineTo($hDCSource, $Left, $Top)

    ; Thin black outline
    _WinAPI_SelectObject($hDCSource, $hPenLil)
    _WinAPI_MoveTo($hDCSource, $Left, $Top)
    _WinAPI_LineTo($hDCSource, $Left + $Width, $Top)
    _WinAPI_LineTo($hDCSource, $Left + $Width, $Top + $Height)
    _WinAPI_LineTo($hDCSource, $Left, $Top + $Height)
    _WinAPI_LineTo($hDCSource, $Left, $Top)

    GUIRegisterMsg($WM_PAINT, "WM_PAINT")
    _WinAPI_RedrawWindow($hwnd, 0, 0, $RDW_INVALIDATE + $RDW_UPDATENOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Quit()
            Case $GUI_EVENT_RESTORE
                _WinAPI_RedrawWindow($hwnd, 0, 0, $RDW_INVALIDATE + $RDW_UPDATENOW)
        EndSwitch
    WEnd
EndFunc

Func WM_PAINT()
;   _WinAPI_BitBlt($hDCDest, $Left, $Top, $Width, $Height, $hDCSource, $Left, $Top, $BLACKNESS) ; Works
    _WinAPI_BitBlt($hDCDest, $Left, $Top, $Width, $Height, $hDCSource, $Left, $Top, $SRCCOPY)   ; Doesn't work
EndFunc

Func Quit()
    _WinAPI_ReleaseDC($hwnd, $hDCDest)
    _WinAPI_DeleteDC($hDCSource)
    _WinAPI_DeleteObject($hHBitmap)
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_DeleteObject($hPenLil)
    _WinAPI_DeleteObject($hPenFat)
    GUIDelete($hwnd)
    Exit
EndFunc

Br,

UEZ

1 person likes this

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

Thanks again, UEZ!  The helpfile is rather sparse on this topic.  Solved!

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
Sign in to follow this  
Followers 0

  • Similar Content

    • Bilgus
      By Bilgus
      Draw Path Points allows you to make line paths for drawing with gdi
      You can even load an image and trace the outline
      Save and load functionality undo and redo zoom and scale; Don't Forget Rotate!
      ;Draw Path Points BILGUS 2018 ;Includes #include <File.au3> #include <GDIPlus.au3> #include <GUIConstants.au3> #include <GuiEdit.au3> #include <GuiListView.au3> #include <GuiTab.au3> #include <Misc.au3> If OnAutoItExitRegister("_Exit") <> 0 Then _GDIPlus_Startup() ;initialize GDI+ ConsoleWrite("GDI+ Started" & @CRLF) EndIf Opt("MouseCoordMode", 2) ;Relative coords to the client area of the active window Opt("PixelCoordMode", 2) ;Relative coords to the client area of the active window Global $iXScale = 8 Global $iYScale = $iXScale Global $sFileSave = @ScriptDir & "\DrawPath.txt" ;Default Global $b_ClosePath = False Global $b_ShowImage = False Global $sImagefile = "" Global $iUndo_Max = 50 Global $a_sUndo_Files[1] = [""] Global $a_sRedo_Files[1] = [""] Global $aPath_Points[1][2] = [[0, 0]] Global $aPath_Rot_Points Global $Form1 = GUICreate("Draw Path Points", 615, 437, 192, 124) Global $SelSquare = GUICtrlCreateLabel("", 0, 0, 0, 0, $SS_BLACKFRAME, $WS_EX_TOPMOST) GUICtrlSetState(-1, $GUI_HIDE) ;------------------------------------------------------------------------------- Global Enum $eC1_delete, $eC1_del_all, $eC1_update, $eC1_shift_dn, $eC1_shift_up, _ $eC1_closepath, $eC1_showimg, $eC1_lock, $eC1_undo, $eC1_redo, $aCtl1_LAST Global $aCtl1[$aCtl1_LAST] Control_Create_Group1() ;------------------------------------------------------------------------------- Global Enum $eC2_zin, $eC2_zout, $eC2_dgroup, $eC2_decx, $eC2_incx, $eC2_decy, _ $eC2_incy, $eC2_edit_rot, $eC2_rot, $eC2_ud_rot, $eC2_rev, $eC2_toall, $aCtl2_LAST Global $aCtl2[$aCtl2_LAST] Control_Create_Group2() ;------------------------------------------------------------------------------- Global $Btn_load = GUICtrlCreateButton("Load", 5, 1, 35, 20) Global $Btn_save = GUICtrlCreateButton("Save", 40, 1, 35, 20) Global $Btn_arr_disp = GUICtrlCreateButton("Array", 75, 1, 35, 20) Global $Edit_encoded = GUICtrlCreateEdit("", 115, 2, 50, 18, $ES_READONLY + $ES_AUTOHSCROLL, $WS_EX_STATICEDGE + $WS_EX_TRANSPARENT) Global $List1 = GUICtrlCreateListView("#|x|y", 5, 24, 161, 201, $LVS_SHOWSELALWAYS Or $LVS_SINGLESEL) Global $List1_LVN = GUICtrlCreateDummy() ;listview notifications Global $Image1 = GUICtrlCreatePic("", 200, 16, 400, 400, -1, $WS_EX_LAYERED) Global $Tab1 = GUICtrlCreateTab(1, 225, 20, 500, $TCS_VERTICAL) GUICtrlCreateTabItem(" ") GUICtrlSetState(-1, $GUI_SHOW) ; will be display first GUICtrlCreateTabItem(" ") GUICtrlCreateTabItem("") ; end tabitem definition For $i = 0 To UBound($aCtl2) - 1 GUICtrlSetState($aCtl2[$i], $GUI_HIDE) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") List_Update() List_Index() GUISetState(@SW_SHOW) State_Save($aPath_Points) Points_Update($aPath_Points) While 1 $nMsg = GUIGetMsg() If $nMsg > 0 And $nMsg <> $aCtl2[$eC2_ud_rot] And $nMsg <> $aCtl2[$eC2_edit_rot] And GUICtrlRead($aCtl2[$eC2_edit_rot]) <> 0 Then ;ConsoleWrite("Cancel_Rotate? " & $nMsg & @CRLF) If MsgBox($MB_ICONQUESTION + $MB_OKCANCEL + $MB_DEFBUTTON2, "Save?", "Save Rotated Points?", 10) == $IDOK Then _GUICtrlEdit_SetText($aCtl2[$eC2_edit_rot], "0") $aPath_Points = $aPath_Rot_Points State_Save($aPath_Points) List_Update(List_Index()) Else _GUICtrlEdit_SetText($aCtl2[$eC2_edit_rot], "0") Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage, List_Index()) ;, True) EndIf EndIf Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Tab1 Tab1_Select() Case $SelSquare ;ConsoleWrite("SelSquare" & @CRLF) SelSquare_Drag() Case $List1 ;ConsoleWrite("List1 " & $nMsg & @CRLF) Local $iIndex = List_Index() If $iIndex <> -1 Then Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage, $iIndex) _GUICtrlListView_SetItemSelected($List1, $iIndex, True, True) EndIf Case $List1_LVN Point_Selected($aPath_Points, $Image1, List_Index()) Case $List1_LVN Case $Image1 Image1_Clicked() Case $Btn_save Btn_save_Clicked() Case $Btn_load Btn_load_Clicked() Case $Btn_arr_disp _ArrayDisplay($aPath_Points) ;------------------------------------------------------------------- Case $aCtl1[$eC1_shift_up] Local $iIndex = List_Index() Point_Swap($iIndex, -1) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) Case $aCtl1[$eC1_shift_dn] Local $iIndex = List_Index() Point_Swap($iIndex, 1) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) Case $aCtl1[$eC1_del_all] $aPath_Points = 0 Dim $aPath_Points[1][2] = [[0, 0]] List_Update() Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) Case $aCtl1[$eC1_delete] Local $iIndex = List_Index() Point_Delete($iIndex) _GUICtrlListView_ClickItem($List1, $iIndex) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) Case $aCtl1[$eC1_redo] $aPath_Points = State_Restore($aPath_Points, False) List_Update() Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) Case $aCtl1[$eC1_undo] $aPath_Points = State_Restore($aPath_Points, True) List_Update() Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) Case $aCtl1[$eC1_update] List_Update(List_Index()) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) Ascii_Points($aPath_Points) _GUICtrlEdit_SetSel($Edit_encoded, 0, -1) Case $aCtl1[$eC1_closepath] $b_ClosePath = Control_IsChecked($aCtl1[$eC1_closepath]) List_Update(List_Index()) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) If $b_ClosePath Then GUICtrlSetState($aCtl2[$eC2_rev], $GUI_DISABLE) Else GUICtrlSetState($aCtl2[$eC2_rev], $GUI_ENABLE) EndIf Case $aCtl1[$eC1_showimg] If Not $b_ShowImage Then $sImagefile = FileOpenDialog("Select an image", SplitDir($sImagefile), "All Files(*.*)", 0, SplitFileName($sImagefile), $Form1) EndIf $b_ShowImage = Control_IsChecked($aCtl1[$eC1_showimg]) List_Update(List_Index()) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) ;------------------------------------------------------------------- Case $aCtl2[$eC2_zin] If Control_IsChecked($aCtl2[$eC2_toall]) Then Points_Scale(1, 1) Else $iXScale += 1 $iYScale += 1 Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) EndIf _GUICtrlListView_ClickItem($List1, List_Index()) Case $aCtl2[$eC2_zout] If Control_IsChecked($aCtl2[$eC2_toall]) Then Points_Scale(-1, -1) Else $iXScale -= 1 $iYScale -= 1 Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) EndIf _GUICtrlListView_ClickItem($List1, List_Index()) Case $aCtl2[$eC2_rev] Local $iIndex = List_Index() $aPath_Points = Points_Reverse($aPath_Points) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage, $iIndex) ;, True) List_Update($iIndex) Case $aCtl2[$eC2_edit_rot] ;ConsoleWrite("Rotate" & @CRLF) Local $iIndex = List_Index() Local $iDegrees = GUICtrlRead($aCtl2[$eC2_edit_rot]) $aPath_Rot_Points = Points_Rotate($aPath_Points, $iDegrees) Points_Update($aPath_Rot_Points, $b_ClosePath, $b_ShowImage, $iIndex) ;, True) Case $aCtl2[$eC2_incx] Point_Adjust(1, 0, Control_IsChecked($aCtl2[$eC2_toall])) Case $aCtl2[$eC2_decx] Point_Adjust(-1, 0, Control_IsChecked($aCtl2[$eC2_toall])) Case $aCtl2[$eC2_incy] Point_Adjust(0, 1, Control_IsChecked($aCtl2[$eC2_toall])) Case $aCtl2[$eC2_decy] Point_Adjust(0, -1, Control_IsChecked($aCtl2[$eC2_toall])) EndSwitch WEnd ;---------------------------------------------------------------------------------------------------- Func _Exit() _GDIPlus_Shutdown() ConsoleWrite("GDI+ Stopped" & @CRLF) State_Destroy() EndFunc ;==>_Exit Func Ascii_Points($aPts) ;encodes points into an ascii string Local Const $iChrOffset = 33 Local Const $iMaxOffset = 126 - $iChrOffset If Not IsArray($aPts) Then Return Local $sAscEnc = StringFormat("%03i%05i", $iChrOffset, UBound($aPts) * 2 + 8) If _ArrayMin($aPts) >= 0 And (_ArrayMax($aPts) - _ArrayMin($aPts)) <= $iMaxOffset Then For $i = 0 To UBound($aPts) - 1 $sAscEnc = $sAscEnc & Chr($aPts[$i][0] + $iChrOffset) & Chr($aPts[$i][1] + $iChrOffset) Next EndIf _GUICtrlEdit_SetText($Edit_encoded, $sAscEnc) EndFunc ;==>Ascii_Points Func Btn_load_Clicked() ConsoleWrite("Load: " & SplitDir($sFileSave) & @CRLF) $sFileSave = FileOpenDialog("Select a save file", SplitDir($sFileSave), "All Files(*.*)", 0, SplitFileName($sFileSave), $Form1) _FileReadToArray($sFileSave, $aPath_Points, 0, ",") If @error Then Dim $aPath_Points[1][2] = [[0, 0]] Else State_Destroy() State_Save($aPath_Points) EndIf List_Update() Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) EndFunc ;==>Btn_load_Clicked Func Btn_save_Clicked() List_Update(List_Index()) $sFileSave = FileOpenDialog("Select a save file", SplitDir($sFileSave), "All Files(*.*)", 0, SplitFileName($sFileSave), $Form1) _FileWriteFromArray($sFileSave, $aPath_Points, 0, Default, ",") EndFunc ;==>Btn_save_Clicked Func Control_Create_Group1() Local $iX = 30 Local $iY = 225 $aCtl1[$eC1_delete] = GUICtrlCreateButton("Delete", $iX + 0, $iY + 0, 50, 20) $aCtl1[$eC1_shift_dn] = GUICtrlCreateButton("+", $iX + 70, $iY + 0, 20, 20) $aCtl1[$eC1_shift_up] = GUICtrlCreateButton("-", $iX + 95, $iY + 0, 20, 20) $aCtl1[$eC1_del_all] = GUICtrlCreateButton("Delete All", $iX + 0, $iY + 25, 50, 20) $aCtl1[$eC1_update] = GUICtrlCreateButton("Update", $iX + 70, $iY + 25, 50, 20) $aCtl1[$eC1_undo] = GUICtrlCreateButton("Undo", $iX + 0, $iY + 50, 50, 20) $aCtl1[$eC1_redo] = GUICtrlCreateButton("Redo", $iX + 70, $iY + 50, 50, 20) GUICtrlSetState($aCtl1[$eC1_undo], $GUI_DISABLE) GUICtrlSetState($aCtl1[$eC1_redo], $GUI_DISABLE) $aCtl1[$eC1_closepath] = GUICtrlCreateCheckbox("Complete", $iX + 0, $iY + 70, 65, 25) $aCtl1[$eC1_showimg] = GUICtrlCreateCheckbox("Image", $iX + 0, $iY + 90, 65, 25) $aCtl1[$eC1_lock] = GUICtrlCreateCheckbox("Locked", $iX + 0, $iY + 110, 65, 25) EndFunc ;==>Control_Create_Group1 Func Control_Create_Group2() Local $iX = 30 Local $iY = 225 $aCtl2[$eC2_rev] = GUICtrlCreateButton("Reverse", $iX + 0, $iY + 0, 50, 20) $aCtl2[$eC2_edit_rot] = GUICtrlCreateInput("0", $iX + 0, $iY + 25, 40, 20) $aCtl2[$eC2_ud_rot] = GUICtrlCreateUpdown(-1) GUICtrlSetLimit($eC2_ud_rot, 360, -360) $aCtl2[$eC2_rot] = GUICtrlCreateButton("", $iX + 40, $iY + 25, 10, 20) $aCtl2[$eC2_dgroup] = GUICtrlCreateGroup("Coords", 5 + $iX + 70, $iY + 0, 55, 70) $aCtl2[$eC2_decy] = GUICtrlCreateButton("-", 24 + $iX + 70, 16 + $iY + 0, 17, 17) $aCtl2[$eC2_incy] = GUICtrlCreateButton("+", 24 + $iX + 70, 48 + $iY + 0, 17, 17) $aCtl2[$eC2_decx] = GUICtrlCreateButton("-", 8 + $iX + 70, 32 + $iY + 0, 17, 17) $aCtl2[$eC2_incx] = GUICtrlCreateButton("+", 40 + $iX + 70, 32 + $iY + 0, 17, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $aCtl2[$eC2_zout] = GUICtrlCreateButton("Zoom -", $iX + 0, $iY + 75, 50, 20) $aCtl2[$eC2_zin] = GUICtrlCreateButton("Zoom +", $iX + 75, $iY + 75, 50, 20) $aCtl2[$eC2_toall] = GUICtrlCreateCheckbox("Apply to all", $iX + 0, $iY + 100, 80, 25) EndFunc ;==>Control_Create_Group2 Func Control_IsChecked($IdCtrl) Return (BitAND(GUICtrlRead($IdCtrl), $GUI_CHECKED) = $GUI_CHECKED) EndFunc ;==>Control_IsChecked Func GDI_Draw_ArrayPoints(ByRef $aPts, $hImage, $b_ClosePath, $iX, $iY, $sFileName, $iSelected = -1) Local $hWnd = GUICtrlGetHandle($hImage) If UBound($aPts) > 1 Then Local $aPoints = GDI_Points($aPts, $iX, $iY) Else Local $aPoints[1][2] = [[0, 0]] EndIf Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;create a graphics object from a window handle _GDIPlus_GraphicsClear($hGraphics, 0xFFFFFFFF) If FileExists($sFileName) Then Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sFileName) Local Const $iWidth = ScaleX(_GDIPlus_ImageGetWidth($hBitmap)) Local Const $iHeight = ScaleY(_GDIPlus_ImageGetHeight($hBitmap)) Local $hBitmap_Scaled = _GDIPlus_ImageResize($hBitmap, $iWidth, $iHeight) ;resize image _GDIPlus_BitmapDispose($hBitmap) ;Done with initial bitmap _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap_Scaled, 0, 0) _GDIPlus_BitmapDispose($hBitmap_Scaled) EndIf Local $hPen = _GDIPlus_PenCreate(0xFFFF0000, ScaleX(1)) $hEndCap = _GDIPlus_ArrowCapCreate(1, 1) _GDIPlus_PenSetCustomEndCap($hPen, $hEndCap) If $b_ClosePath Then _GDIPlus_GraphicsDrawPolygon($hGraphics, $aPoints, $hPen) Local $iX0, $iY0, $iX1, $iY1 For $i = 1 To $aPoints[0][0] If Not $b_ClosePath And $i < $aPoints[0][0] Then $iX0 = $aPoints[$i][0] $iY0 = $aPoints[$i][1] $iX1 = $aPoints[$i + 1][0] $iY1 = $aPoints[$i + 1][1] _GDIPlus_GraphicsDrawLine($hGraphics, $iX0, $iY0, $iX1, $iY1, $hPen) EndIf Next _GDIPlus_ArrowCapDispose($hEndCap) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphics) Point_Selected($aPts, $hImage, $iSelected) EndFunc ;==>GDI_Draw_ArrayPoints Func GDI_Line_hPath_From_Points($aPts, $iXorig, $iYorig) ;Returns hpath object be sure to delete it when finished Local $hPath = _GDIPlus_PathCreate() ;Create new path object Local $aPoints = GDI_Points($aPts, $iXorig, $iYorig) Local $iX0, $iY0, $iX1, $iY1 If IsArray($aPoints) Then For $i = 1 To $aPoints[0][0] - 1 $iX0 = $aPoints[$i][0] $iY0 = $aPoints[$i][1] $iX1 = $aPoints[$i + 1][0] $iY1 = $aPoints[$i + 1][1] _GDIPlus_PathAddLine($hPath, $iX0, $iY0, $iX1, $iY1) Next EndIf Return $hPath ;_GDIPlus_PathDispose($hPath) EndFunc ;==>GDI_Line_hPath_From_Points Func GDI_Points($aPts, $iXo, $iYO) Local $aGDIPts If IsArray($aPts) And UBound($aPts) > 1 Then Local $aGDIPts[UBound($aPts) + 1][2] $aGDIPts[0][0] = UBound($aPts) For $i = 1 To $aGDIPts[0][0] ;Build points list $aGDIPts[$i][0] = ScaleX($aPts[$i - 1][0]) + $iXo $aGDIPts[$i][1] = ScaleY($aPts[$i - 1][1]) + $iYO Next Else Local $aGDIPts[1][2] = [[0, 0]] EndIf Return $aGDIPts EndFunc ;==>GDI_Points Func Image1_Clicked() If Not Control_IsChecked($aCtl1[$eC1_lock]) Then Local $aCPos = ControlGetPos(GUICtrlGetHandle($Image1), "", 0) Local $aPos = MouseGetPos() If IsArray($aPos) And IsArray($aCPos) Then Local $iXn = Int(($aPos[0] - $aCPos[0] + ScaleX(1) / 2) / ScaleX(1)) Local $iYn = Int(($aPos[1] - $aCPos[1] + ScaleY(1) / 2) / ScaleY(1)) Point_Add(List_Index(), $iXn, $iYn) EndIf Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) Else ToolTip("Locked") Sleep(500) ToolTip("") EndIf EndFunc ;==>Image1_Clicked Func List_Index() Static Local $hWndList1 = GUICtrlGetHandle($List1) Local $iIndex = _GUICtrlListView_GetSelectionMark($hWndList1) If _GUICtrlListView_GetItemSelected($List1, $iIndex) Then Return $iIndex Return -1 EndFunc ;==>List_Index Func List_Update($iIndex = -1) Static $hWnd_List1 = GUICtrlGetHandle($List1) _GUICtrlListView_BeginUpdate($List1) _GUICtrlListView_DeleteAllItems($hWnd_List1) For $i = 0 To UBound($aPath_Points) - 1 GUICtrlCreateListViewItem($i & "|" & $aPath_Points[$i][0] & "|" & $aPath_Points[$i][1], $List1) Next If $iIndex > -1 Then _GUICtrlListView_ClickItem($List1, $iIndex) _GUICtrlListView_EnsureVisible($List1, $iIndex) EndIf _GUICtrlListView_EndUpdate($List1) EndFunc ;==>List_Update Func Point_Add($iIndex, $iX, $iY) If $iIndex <> -1 Then _ArrayInsert($aPath_Points, $iIndex, $iX & "|" & $iY, 0) _GUICtrlListView_InsertItem($List1, $iIndex, $iIndex) _GUICtrlListView_SetItemText($List1, $iIndex, $iX, 1) _GUICtrlListView_SetItemText($List1, $iIndex, $iY, 2) _GUICtrlListView_EnsureVisible($List1, $iIndex) Else _ArrayAdd($aPath_Points, $iX & "|" & $iY, 0) GUICtrlCreateListViewItem(UBound($aPath_Points) - 1 & "|" & $iX & "|" & $iY, $List1) _GUICtrlListView_EnsureVisible($List1, UBound($aPath_Points) - 1) EndIf State_Save($aPath_Points) EndFunc ;==>Point_Add Func Point_Adjust($iX, $iY, $bToAll) If Not $bToAll Then Local $iIndex = List_Index() If $iIndex == -1 And IsArray($aPath_Points) Then $iIndex = UBound($aPath_Points) - 1 If $iIndex == -1 Then Return $aPath_Points[$iIndex][0] += $iX $aPath_Points[$iIndex][1] += $iY _GUICtrlListView_SetItemText($List1, $iIndex, $aPath_Points[$iIndex][0], 1) _GUICtrlListView_SetItemText($List1, $iIndex, $aPath_Points[$iIndex][1], 2) If $iIndex <> UBound($aPath_Points) - 1 Then _GUICtrlListView_ClickItem($List1, $iIndex) Else For $i = 0 To UBound($aPath_Points) - 1 $aPath_Points[$i][0] += $iX $aPath_Points[$i][1] += $iY Next List_Update(List_Index()) EndIf State_Save($aPath_Points) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) EndFunc ;==>Point_Adjust Func Point_Delete($iIndex) If $iIndex <> -1 Then _ArrayDelete($aPath_Points, $iIndex) _GUICtrlListView_DeleteItem($List1, $iIndex) State_Save($aPath_Points) ;List_Update($iIndex) EndIf EndFunc ;==>Point_Delete Func Point_Modify($iIndex, $iX, $iY) If $iIndex <> -1 Then $aPath_Points[$iIndex][0] = $iX $aPath_Points[$iIndex][1] = $iY _GUICtrlListView_SetItemText($List1, $iIndex, $iX, 1) _GUICtrlListView_SetItemText($List1, $iIndex, $iY, 2) _GUICtrlListView_EnsureVisible($List1, $iIndex) State_Save($aPath_Points) EndIf EndFunc ;==>Point_Modify Func Point_Selected($aPts, $hImage, $iIndex) If $iIndex > -1 Then GUICtrlSetState($SelSquare, $GUI_HIDE) Local $hWnd = GUICtrlGetHandle($hImage) Local $aPos = ControlGetPos($hWnd, "", 0) If IsArray($aPos) And IsArray($aPts) Then _WinAPI_RedrawWindow($hWnd, Default, Default, $RDW_ERASENOW) Local $iXs = ScaleX($aPts[$iIndex][0]) + $aPos[0] - ScaleX(1) / 2 Local $iYs = ScaleY($aPts[$iIndex][1]) + $aPos[1] - ScaleY(1) / 2 WinMove(GUICtrlGetHandle($SelSquare), "", $iXs, $iYs, ScaleX(1), ScaleY(1)) GUICtrlSetState($SelSquare, $GUI_SHOW) ;ConsoleWrite("Point_Selected" & @CRLF) Else ConsoleWriteError("Error: Point_Selected" & @CRLF) EndIf EndIf EndFunc ;==>Point_Selected Func Point_Swap($iIndex1, $iNext) _GUICtrlListView_BeginUpdate($List1) Local $iIndex2 If $iIndex1 <> -1 Then $iIndex2 = $iIndex1 + $iNext If $iIndex2 > UBound($aPath_Points) - 1 Then $iIndex2 = 0 ElseIf $iIndex2 < 0 Then $iIndex2 = UBound($aPath_Points) - 1 EndIf _ArraySwap($aPath_Points, $iIndex1, $iIndex2) Local $iX1 = _GUICtrlListView_GetItemText($List1, $iIndex1, 2) Local $iY1 = _GUICtrlListView_GetItemText($List1, $iIndex1, 2) Local $iX2 = _GUICtrlListView_GetItemText($List1, $iIndex2, 2) Local $iY2 = _GUICtrlListView_GetItemText($List1, $iIndex2, 2) _GUICtrlListView_SetItemText($List1, $iIndex1, $iX2, 1) _GUICtrlListView_SetItemText($List1, $iIndex1, $iY2, 2) _GUICtrlListView_SetItemText($List1, $iIndex2, $iX1, 1) _GUICtrlListView_SetItemText($List1, $iIndex2, $iY1, 2) _GUICtrlListView_ClickItem($List1, $iIndex2) _GUICtrlListView_EnsureVisible($List1, $iIndex2) Else ;ConsoleWrite("Array Shift" & @CRLF) If $iNext > 0 Then ;ARRAY SHIFT -- Melba23 Local $iUBound = UBound($aPath_Points) ; Get size of array Local $aTmp = _ArrayExtract($aPath_Points, 0, $iUBound - 2) ; Extract all but last _ArrayInsert($aTmp, 0, _ArrayExtract($aPath_Points, $iUBound - 1, Default)) ; Insert last at top $aPath_Points = $aTmp Else Local $aTmp = _ArrayExtract($aPath_Points, 1, Default) ; Extract all but top row _ArrayAdd($aTmp, _ArrayExtract($aPath_Points, 0, 0)) ; Add top row at bottom $aPath_Points = $aTmp EndIf List_Update(List_Index()) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) EndIf State_Save($aPath_Points) _GUICtrlListView_EndUpdate($List1) EndFunc ;==>Point_Swap Func Points_Reverse($aPts) Local $hPath = GDI_Line_hPath_From_Points($aPts, 0, 0) ;_GDIPlus_PathFlatten($hPath) _GDIPlus_PathReverse($hPath) $aPoints = _GDIPlus_PathGetPoints($hPath) _GDIPlus_PathDispose($hPath) If IsArray($aPoints) Then ;ConsoleWrite("Flipped_Points" & @CRLF) Dim $aPts_Rev[$aPoints[0][0]][2] For $i = 1 To $aPoints[0][0] $aPts_Rev[$i - 1][0] = Int($aPoints[$i][0] / ScaleX(1)) $aPts_Rev[$i - 1][1] = Int($aPoints[$i][1] / ScaleY(1)) Next Return $aPts_Rev Else Return $aPts EndIf EndFunc ;==>Points_Reverse Func Points_Rotate($aPts, $iDegrees) Local $hPath = GDI_Line_hPath_From_Points($aPts, 0, 0) ;_GDIPlus_PathFlatten($hPath) Local $hPen = _GDIPlus_PenCreate(0x0, ScaleX(1)) Local $aBounds = _GDIPlus_PathGetWorldBounds($hPath, 0, $hPen) _GDIPlus_PenDispose($hPen) If IsArray($aBounds) Then $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $aBounds[0] + $aBounds[2] / 2, $aBounds[1] + $aBounds[3] / 2) _GDIPlus_MatrixRotate($hMatrix, $iDegrees) _GDIPlus_MatrixTranslate($hMatrix, -($aBounds[0] + $aBounds[2] / 2), -($aBounds[1] + $aBounds[3] / 2)) _GDIPlus_PathTransform($hPath, $hMatrix) _GDIPlus_MatrixDispose($hMatrix) EndIf Local $aPoints = _GDIPlus_PathGetPoints($hPath) _GDIPlus_PathDispose($hPath) If IsArray($aPoints) Then ;ConsoleWrite("Rotate_Points" & @CRLF) Dim $aPts_Rev[$aPoints[0][0]][2] For $i = 1 To $aPoints[0][0] $aPts_Rev[$i - 1][0] = Int($aPoints[$i][0] / ScaleX(1)) $aPts_Rev[$i - 1][1] = Int($aPoints[$i][1] / ScaleY(1)) Next Return $aPts_Rev Else Return $aPts EndIf EndFunc ;==>Points_Rotate Func Points_Scale($iScaleX, $iScaleY) For $i = 0 To UBound($aPath_Points) - 1 If $iScaleX > 0 Then $aPath_Points[$i][0] *= 2 Else $aPath_Points[$i][0] /= 2 EndIf If $iScaleY > 0 Then $aPath_Points[$i][1] *= 2 Else $aPath_Points[$i][1] /= 2 EndIf Next State_Save($aPath_Points) List_Update(List_Index()) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage) EndFunc ;==>Points_Scale Func Points_Update($aPts, $b_ClosePath = False, $b_Show_Image = True, $iSelected = -1) Local $_Image_File = $sImagefile If Not $b_Show_Image Then $_Image_File = "" GDI_Draw_ArrayPoints($aPts, $Image1, $b_ClosePath, 0, 0, $_Image_File, $iSelected) EndFunc ;==>Points_Update Func ScaleX($iX) Local $iXs = $iXScale If $iXs == 0 Then $iXs = -1 If $iXs > 0 Then $iX = $iX * $iXs Else $iX = $iX / Abs($iXs) EndIf Return $iX EndFunc ;==>ScaleX Func ScaleY($iY) Local $iYs = $iYScale If $iYs == 0 Then $iYs = -1 If $iYs > 0 Then $iY = $iY * $iYs Else $iY = $iY / Abs($iYs) EndIf Return $iY EndFunc ;==>ScaleY Func SelSquare_Drag() Local $iIndex = List_Index() If $iIndex <> -1 Then Local $cInfo = GUIGetCursorInfo($Form1) Local $aPosSelOrig = ControlGetPos($Form1, "", $SelSquare) If IsArray($aPosSelOrig) Then Local $iSubtractX = $cInfo[0] - $aPosSelOrig[0] Local $iSubtractY = $cInfo[1] - $aPosSelOrig[1] EndIf If IsArray($cInfo) Then Do $cInfo = GUIGetCursorInfo($Form1) ControlMove($Form1, "", $SelSquare, $cInfo[0] - $iSubtractX, $cInfo[1] - $iSubtractY) Until Not $cInfo[2] EndIf Local $aPosSelNew = ControlGetPos($Form1, "", $SelSquare) If IsArray($aPosSelNew) And IsArray($aPosSelOrig) Then Local $iXm = $aPath_Points[$iIndex][0] + Int(($aPosSelNew[0] - $aPosSelOrig[0]) / ScaleX(1)) Local $iYm = $aPath_Points[$iIndex][1] + Int(($aPosSelNew[1] - $aPosSelOrig[1]) / ScaleY(1)) Point_Modify($iIndex, $iXm, $iYm) Points_Update($aPath_Points, $b_ClosePath, $b_ShowImage, $iIndex) EndIf EndIf EndFunc ;==>SelSquare_Drag Func SplitDir($FullPath) Local $sDrive, $sDir, $sDummy _PathSplit($FullPath, $sDrive, $sDir, $sDummy, $sDummy) Return $sDrive & $sDir EndFunc ;==>SplitDir Func SplitFileName($FullPath) Local $sDummy, $sFileName, $sExt _PathSplit($FullPath, $sDummy, $sDummy, $sFileName, $sExt) Return $sFileName & "" & $sExt EndFunc ;==>SplitFileName Func State_Cleanup(ByRef $a1) If (UBound($a1) > $iUndo_Max + 2) Then Local $a1Rem = _ArrayExtract($a1, 1, Default) $a1Rem[0] = $a1[0] Local $sTmp = $a1[1] If $sTmp <> "" And FileExists($sTmp) Then FileDelete($sTmp) ;ConsoleWrite("Cleanup Delete (UnD) " & $sTmp & @CRLF) EndIf $a1 = $a1Rem EndIf EndFunc ;==>State_Cleanup Func State_Destroy($bRedo_Only = False) Local $sTmp While (UBound($a_sRedo_Files) > 1) $sTmp = _ArrayPop($a_sRedo_Files) If $sTmp <> "" And FileExists($sTmp) Then FileDelete($sTmp) ;ConsoleWrite(", Delete (ReD) " & $sTmp) If @error Then ConsoleWriteError("Failed to Delete " & $sTmp) EndIf WEnd GUICtrlSetState($aCtl1[$eC1_redo], $GUI_DISABLE) If $bRedo_Only Then Return While (UBound($a_sUndo_Files) > 1) $sTmp = _ArrayPop($a_sUndo_Files) If $sTmp <> "" And FileExists($sTmp) Then FileDelete($sTmp) ;ConsoleWrite(", Delete (UnD)" & $sTmp) If @error Then ConsoleWriteError("Failed to Delete " & $sTmp) EndIf WEnd GUICtrlSetState($aCtl1[$eC1_undo], $GUI_DISABLE) EndFunc ;==>State_Destroy Func State_Is_Diff(ByRef $a1, ByRef $a2) Local $bIsDiff = True If UBound($a1) = UBound($a2) Then $bIsDiff = False For $i = UBound($a1) - 1 To 0 Step -1 If $a1[$i][0] == $a2[$i][0] And $a1[$i][1] == $a2[$i][1] Then ContinueLoop Else ;ConsoleWrite("Diff " & $i & @CRLF) $bIsDiff = True ExitLoop EndIf Next Else ;ConsoleWrite("Diff " & @CRLF) EndIf Return $bIsDiff EndFunc ;==>State_Is_Diff Func State_Restore(ByRef $aPts, $bUndo) Local $sTmp = "" Local $aRes If $bUndo Then $sTmp = _ArrayPop($a_sUndo_Files) ;ConsoleWrite(", Restore (UnD)" & $sTmp) If $sTmp <> "" And FileExists($sTmp) Then _ArrayAdd($a_sRedo_Files, $sTmp) _FileReadToArray($sTmp, $aRes, 0, ",") If UBound($a_sUndo_Files) < 2 Then GUICtrlSetState($aCtl1[$eC1_undo], $GUI_DISABLE) If UBound($a_sRedo_Files) > 2 Then GUICtrlSetState($aCtl1[$eC1_redo], $GUI_ENABLE) If UBound($a_sUndo_Files) > 1 And Not State_Is_Diff($aPts, $aRes) Then Return State_Restore($aPts, $bUndo) If Not @error Then Return $aRes Else ConsoleWriteError("Failed to Restore " & $sTmp) EndIf Else $sTmp = _ArrayPop($a_sRedo_Files) ;ConsoleWrite(", Restore (ReD) " & $sTmp) If $sTmp <> "" And FileExists($sTmp) Then _ArrayAdd($a_sUndo_Files, $sTmp) _FileReadToArray($sTmp, $aRes, 0, ",") If UBound($a_sRedo_Files) < 2 Then GUICtrlSetState($aCtl1[$eC1_redo], $GUI_DISABLE) If UBound($a_sUndo_Files) > 2 Then GUICtrlSetState($aCtl1[$eC1_undo], $GUI_ENABLE) If UBound($a_sRedo_Files) > 1 And Not State_Is_Diff($aPts, $aRes) Then Return State_Restore($aPts, $bUndo) If Not @error Then Return $aRes Else ConsoleWriteError("Failed to Restore " & $sTmp) EndIf EndIf Return $aPts EndFunc ;==>State_Restore Func State_Save($aPts, $bClean = True) If $iUndo_Max < 1 Then Return Local $bFileDiff = True Local $sTmp = _TempFile(@TempDir, "DPP_") If UBound($a_sRedo_Files) > 2 Then _ArrayAdd($a_sUndo_Files, _ArrayPop($a_sRedo_Files)) _ArrayAdd($a_sUndo_Files, $sTmp) _FileWriteFromArray($sTmp, $aPath_Points, 0, Default, ",") If UBound($a_sRedo_Files) > 2 Then State_Destroy(True) State_Cleanup($a_sUndo_Files) ;ConsoleWrite("Save State " & UBound($a_sUndo_Files) & " " & $sTmp & @CRLF) If UBound($a_sUndo_Files) > 2 Then GUICtrlSetState($aCtl1[$eC1_undo], $GUI_ENABLE) If @error Then MsgBox(0, @ScriptName & " Error", "Unable to create undo file " & $sTmp) GUICtrlSetState($aCtl1[$eC1_undo], $GUI_DISABLE) GUICtrlSetState($aCtl1[$eC1_redo], $GUI_DISABLE) $iUndo_Max = 0 EndIf EndFunc ;==>State_Save Func Tab1_Select() Local $iStateCtl1, $iStateCtl2 Local $tabindex = GUICtrlRead($Tab1) ;ConsoleWrite("tab" & $tabindex + 1 & "_selected" & @CRLF) Select Case $tabindex = 0 $iStateCtl1 = $GUI_SHOW $iStateCtl2 = $GUI_HIDE Case $tabindex = 1 $iStateCtl1 = $GUI_HIDE $iStateCtl2 = $GUI_SHOW Case Else _GUICtrlTab_ActivateTab($Tab1, 0) Return EndSelect For $i = 0 To UBound($aCtl1) - 1 GUICtrlSetState($aCtl1[$i], $iStateCtl1) Next For $i = 0 To UBound($aCtl2) - 1 GUICtrlSetState($aCtl2[$i], $iStateCtl2) Next EndFunc ;==>Tab1_Select Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Static Local $hWndList1 = GUICtrlGetHandle($List1) If Not IsHWnd($hWndList1) Then $hWndList1 = GUICtrlGetHandle($List1) If @error Then Return $GUI_RUNDEFMSG If $wParam = $List1 Then Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $iCode = DllStructGetData($tNMHDR, "Code") Switch DllStructGetData($tNMHDR, "Code") Case $LVN_KEYDOWN, $NM_CLICK GUICtrlSendToDummy($List1_LVN, $lParam) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY  


    • computergroove
      By computergroove
      I've made a form in Koda where I make a list of 3 user definable elements that I want to be able to replicate with a button press so a user can add data that can be used as part of the program. 
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=D:\Carbonite Important\0 - Programing\Scite and Autoit\Koda 1.7.3.0\Forms\Mileage Estimator.kxf $Form1 = GUICreate("Save Project", 614, 1126, 298, 141) $Location = GUICtrlCreateInput("Location", 40, 112, 345, 21) $Distance = GUICtrlCreateInput("Distance", 400, 112, 89, 21) $AddLocation = GUICtrlCreateButton("AddLocation", 288, 80, 97, 25) $Label1 = GUICtrlCreateLabel("Location", 40, 88, 45, 17) $Label2 = GUICtrlCreateLabel("Distance", 400, 88, 46, 17) $HomeBase = GUICtrlCreateInput("HomeBase", 312, 32, 121, 21) $LeapYear = GUICtrlCreateCheckbox("LeapYear", 464, 32, 17, 17) $Label3 = GUICtrlCreateLabel("Leap Year?", 488, 32, 59, 17) $Variance = GUICtrlCreateInput("Variance", 504, 112, 81, 21) $Label4 = GUICtrlCreateLabel("Variance", 504, 88, 46, 17) $Label5 = GUICtrlCreateLabel("Home Base", 312, 8, 59, 17) $Button1 = GUICtrlCreateButton("Button1", 144, 56, 1, 57) $Save = GUICtrlCreateButton("Save Project", 40, 16, 121, 25) $Load = GUICtrlCreateButton("Load Project", 176, 16, 121, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Form1 Case $AddLocation EndSwitch WEnd I want to press the "add location" button and have the fields {Location, Distance and variance} create a new blank record located under the existing 3 input boxes. Since the fields can number over 30 locations in some examples I am thinking about having these items in a scrolling window. What is the best way to do this and can auto it add a variable while running by pressing a button?
    • XaelloNegative
      By XaelloNegative
      Hi,
      I made a small blunder with my code. I created the GUI under 1920x1080 resolution however, my user is configured to ONLY 1080x720 and cannot go any further than that.
      What do you guys think is the best way to correct this one? Resolution mathematics is something that came to mind however I do not have access to his PC to check  from time to time if  my estimation is correct and the resolution on my PC doesn't go down to 1080x720.
      Please help.
      ~XN~
    • fenhanxue
      By fenhanxue
      i want to copy a picture file to clipboard, so that i can paste the picture through ctrl+V
      this is my code ,but it dosen't work :
      #AutoIt3Wrapper_UseX64 = n #Include <Clipboard.au3> #include <GDIPlus.au3> _GDIPlus_Startup() $hClipboard_Bitmap = _GDIPlus_BitmapCreateFromFile('C:\1.jpg') _ClipBoard_Open(0) _ClipBoard_SetDataEx($hClipboard_Bitmap,$CF_BITMAP) _ClipBoard_Close() _GDIPlus_Shutdown() can you help me
    • davidacrozier
      By davidacrozier
      Hello all ~
      I am running an autoit script on Windows 10 inside VMware Workstation 12 Pro version 12.5.2.  Technically I am remoting into ESXi which has a Domain Controller (DC), WebServer, FilServer, Windows 10, etc.  Using the GUI (i.e. running explorer.exe) I am able to open several different folders successfully.  The desktop, documents, USB external all open without issue.  The network share opening gives me issues.  Whenever I attempt to open \\filserver\users\user\sharedfolder I get the documents folder instead.  I understand that the documents folder is the default for explorer.  I have also attempted to use the letter drive mapped to the network share (Z:) and receive the same result.  When I run this script on Windows 10 alone without  the VM or the ESXi I am able to open the network share without problems.  I have tried to use the net use command to designate a letter M: to the network share folder prior to running the script.  This did not work for me.  
      One additional avenue I think might work is to use the systreeview321 and _GUICtrlTreeView_FindItem to step through the tree looking for the network share.  Once found,  double click on it and see if that opens the shared network folder.  I can click inside the VM with my mouse on the network share and it opens just fine.  Not sure if running up against GUI issues, or permission issues, or what?
      Thanks in advance,
      Davida Crozier
      TestNetworkShare.au3
      This script is a subset of a much larger program, but it illustrates what I am dealing with.