Sign in to follow this  
Followers 0
misterDee

include error

25 posts in this topic

#1 ·  Posted (edited)

Hi,

Ive got a little question, every time if i want include a file i get this error:

C:\Program Files (x86)\AutoIt3\Include\WinAPIError.au3 (29) : ==> "Func" statement has no matching "EndFunc".:

Func _WinAPI_GetLastError($curErr=@error, $curExt=@extended)

im not using a WinAPIError.au3-include or something, if a weird error (the include is in the same map...)

;   Techniektool gemaakt door Dennis 
;   in opdracht voor Technofarm
;   Versie 1.0

#include <GUIConstants.au3> 
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

; Variables
$userlogin="admin"
$passlogin="1"

; GUI 
$gui=GUICreate("Technofarm Login ", 200, 180, 330, 200, -1, BitOR($WS_EX_RIGHT,$WS_EX_APPWINDOW, $WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic(@scriptdir &"\images\logo.jpg", 90, 0, 100, 90)
GUICtrlCreateLabel("Gebruikersnaam", 0, 65)
$username=GUICtrlCreateInput("", 0, 80, 120, 20)
GUICtrlCreateLabel("Wachtwoord", 0, 105)
$password=GUICtrlCreateInput("", 0, 120, 120, 20, 0x0020)
$loginbtn=GUICtrlCreateButton("Login", 70, 150, 50, 23)

;DB connect
$FULL_MDB_FILE_NAME = @ScriptDir & "\database\db.mdb"
$dbpass="xyz"
$CONN = ObjCreate("ADODB.Connection")
$CONN.Open('Driver={Microsoft Access Driver (*.mdb)};Dbq=' & $FULL_MDB_FILE_NAME & ";PWD=" & $dbpass& ';')
$RecordSet = ObjCreate("ADODB.Recordset")

; Loop
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $loginbtn
            _userlogin()
    EndSwitch
WEnd

func _userlogin()
    $readusername=GUICtrlRead($username)
    $readpassword=GUICtrlRead($password)
    $gebruikers=$conn.Execute("SELECT * FROM gebruikers WHERE gebruikersnaam='"& $readusername &"';")
    With $gebruikers
        While NOT .EOF
        $db_gebruikersnaam=.fields("gebruikersnaam").value
        $db_wachtwoord=.fields("wachtwoord").value
        $db_locatie=.fields("locatie").value
        $db_rechten=.fields("rechten").value
        .movenext
                if $readusername = $db_gebruikersnaam and $readpassword = $db_wachtwoord and $db_rechten = "Beheerder" Then
                    GUIDelete($gui) 
                    #include <beheerder.au3>
                Else            
            GUICtrlCreateIcon("Shell32.dll", -132, 130, 123, 15, 15)
            msgbox(16, "Fout!", "Foutief wachtwoord")
            GUICtrlSetData($password, "")
        EndIf
WEnd
EndWith 
EndFunc

can someone help me out!

thnx! :)

Edited by Jos
removed pw

Share this post


Link to post
Share on other sites



Put all of your #include statements at the beginning of the script. Also, you can't add an include file by a condition statement, they'll all be added no matter where they are in the script or how you place them in code. The files you include will be added into your script at the spot that the program finds the #include statement so that is why they must be at the top of the script.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Yes i know, even if i put them on top of my script i still get errors..

then i get errors in the added include.. but there nothing wrong with..

Share this post


Link to post
Share on other sites

Yes i know, even if i put them on top of my script i still get errors..

then i get errors in the added include.. but there nothing wrong with..

In some file you have a coding error so can only assume that there is something wrong in beheerder.au3.

Jos :)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

In some file you have a coding error so can only assume that there is something wrong in beheerder.au3.

Jos :)

Hmm.. i can start the script witout problems even if i check it with ctrl+f5 no errors found :)

Share this post


Link to post
Share on other sites

Hmm.. i can start the script witout problems even if i check it with ctrl+f5 no errors found :)

You just said that you got another error when you put it at the top... so how can you run it?

What is the error you get when you have the include at the top?

Maybe post the beheerder.au3 as well so we can have a look?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Perhaps you could share the contents of beheerder.au3 with us. (edit out sensitive data if needed, but leave the logic intact) It looks like the file should be moved to the top of the script. (as it containst function declarations), but there might be parts that should be moved to where the include line is now.

Without knowing the contents of beheerder.au3 all I can say is to never put an include file anywhere but at the top of the script. (even though in some cases it would work in other places)

It might be worth noting that the way includes work, is that basically the entire contents of the file is copy/pasted to the location of the include line. This means that you are declaring the functions in the file from inside another function (also a With, While and If) which you can't do.

Share this post


Link to post
Share on other sites

You just said that you got another error when you put it at the top... so how can you run it?

What is the error you get when you have the include at the top?

Maybe post the beheerder.au3 as well so we can have a look?

Jos

Here is beheerder.au3

#include <misc.au3>
#include <File.au3>
#include <GuiComboBox.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListviewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <GuiListView.au3>
#Include <GuiTab.au3>

;Globalizeren
global $db_artikelcode
global $db_omschrijving
global $db_bestelnummer
global $db_inkoopprijs
global $db_aantal
global $db_opmerking
global $db_klant
global $db_aanmelder
global $db_status

Global $aListView[3]

;DB connect
$FULL_MDB_FILE_NAME = @ScriptDir & "\database\db.mdb"
$dbpass="1"
$CONN = ObjCreate("ADODB.Connection")
$CONN.Open('Driver={Microsoft Access Driver (*.mdb)};Dbq=' & $FULL_MDB_FILE_NAME & ";PWD=" & $dbpass& ';')
$RecordSet = ObjCreate("ADODB.Recordset")

; We use ESC to exit the temporary Combo
Opt("GUICloseOnESC", 0)
; Set flag to indicate double click in ListView
Global $fDblClk = False, $hListView = 0
; Declare global variables
Global $aLV_Click_Info, $hTmp_Combo = 0
; Open DLL for _IsPressed
$dll = DllOpen("user32.dll")

;Gui
$GUI=GUICreate("Technofarm BETA v0.99 - Ingelogd als: Ter Aar ", 790, 700, 134, 10, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_APPWINDOW, $WS_MINIMIZEBOX, $WS_EX_RIGHT, $WS_EX_WINDOWEDGE))
GUICtrlCreatePic(@ScriptDir & "\images\main_bg_top.jpg", 0, 0, 790, 78)
GUICtrlCreatePic(@ScriptDir & "\images\main_bg_bottom.jpg", 0, 666, 790, 35)
GUISetBkColor(0xFFFFFF)
$TAB=GUICtrlCreateTab(0, 76, 800, 700)
GUICtrlCreateTabItem("Dashboard")
;Bodegraven
GUICtrlCreateTabItem("Bestellingenlijst Bodegraven")
$updatebtn_bg=Guictrlcreatebutton("Update statussen", 10, 640, 100, 20)
$listview_bg=_GUICtrlListView_Create($GUI, "Artikelcode | Artikelomschrijving | Bestelnummer | Inkoopprijs | Aantal | Opmerking | Klantgegevens | Aanmelder | Status", 0, 110, 791, 527)
_GUICtrlListView_SetExtendedListViewStyle($listview_bg, $LVS_EX_GRIDLINES)
$bestellingen=$conn.Execute("SELECT * FROM bestellingen_bodegraven") 
With $bestellingen
    While NOT .EOF
        $db_artikelcode=.fields("artikelcode").value
        $db_omschrijving=.fields("artikelomschrijving").value
        $db_bestelnummer=.fields("bestelnummer").value
        $db_inkoopprijs=.fields("inkoopprijs").value
        $db_aantal=.fields("aantal").value
        $db_opmerking=.fields("opmerking").value
        $db_klant=.fields("klant").value
        $db_aanmelder=.fields("aanmelder").value
        $db_status=.fields("status").value
        
Local $Name[9]
        $Name[0] = $db_artikelcode 
        $name[1] = $db_omschrijving
        $name[2] = $db_bestelnummer
        $name[3] = $db_inkoopprijs
        $name[4] = $db_aantal
        $name[5] = $db_opmerking
        $name[6] = $db_klant
        $name[7] = $db_aanmelder
        $name[8] = $db_status
        
        $index = _GUICtrlListView_AddItem($ListView_bg, $Name[0], 0)
        _GUICtrlListView_AddSubItem($ListView_bg, $index, $Name[1], 1)
        _GUICtrlListView_AddSubItem($ListView_bg, $index, $Name[2], 2)
        _GUICtrlListView_AddSubItem($ListView_bg, $index, $Name[3], 3)
        _GUICtrlListView_AddSubItem($ListView_bg, $index, $Name[4], 4)
        _GUICtrlListView_AddSubItem($ListView_bg, $index, $Name[5], 5)
        _GUICtrlListView_AddSubItem($ListView_bg, $index, $Name[6], 6)
        _GUICtrlListView_AddSubItem($ListView_bg, $index, $Name[7], 7)
        _GUICtrlListView_AddSubItem($ListView_bg, $index, $Name[8], 8)
        .Movenext
WEnd
EndWith
ControlHide($GUI, "", $listview_bg)
$aListView[0] = $listview_bg ; Put handles into an array

;Ter Aar
GUICtrlCreateTabItem("Bestellingenlijst Ter Aar")
$updatebtn_ta=Guictrlcreatebutton("Update statussen", 10, 640, 100, 20)
$listview_ta=_GUICtrlListView_Create($GUI, "Artikelcode | Artikelomschrijving | Bestelnummer | Inkoopprijs | Aantal | Opmerking | Klantgegevens | Aanmelder | Status", 0, 110, 791, 527)
_GUICtrlListView_SetExtendedListViewStyle($listview_ta, $LVS_EX_GRIDLINES)
$bestellingen=$conn.Execute("SELECT * FROM bestellingen_teraar") 
With $bestellingen
    While NOT .EOF
        $db_artikelcode=.fields("artikelcode").value
        $db_omschrijving=.fields("artikelomschrijving").value
        $db_bestelnummer=.fields("bestelnummer").value
        $db_inkoopprijs=.fields("inkoopprijs").value
        $db_aantal=.fields("aantal").value
        $db_opmerking=.fields("opmerking").value
        $db_klant=.fields("klant").value
        $db_aanmelder=.fields("aanmelder").value
        $db_status=.fields("status").value
        
Local $Name[9]
        $Name[0] = $db_artikelcode 
        $name[1] = $db_omschrijving
        $name[2] = $db_bestelnummer
        $name[3] = $db_inkoopprijs
        $name[4] = $db_aantal
        $name[5] = $db_opmerking
        $name[6] = $db_klant
        $name[7] = $db_aanmelder
        $name[8] = $db_status
        
        $index = _GUICtrlListView_AddItem($ListView_ta, $Name[0], 0)
        _GUICtrlListView_AddSubItem($ListView_ta, $index, $Name[1], 1)
        _GUICtrlListView_AddSubItem($ListView_ta, $index, $Name[2], 2)
        _GUICtrlListView_AddSubItem($ListView_ta, $index, $Name[3], 3)
        _GUICtrlListView_AddSubItem($ListView_ta, $index, $Name[4], 4)
        _GUICtrlListView_AddSubItem($ListView_ta, $index, $Name[5], 5)
        _GUICtrlListView_AddSubItem($ListView_ta, $index, $Name[6], 6)
        _GUICtrlListView_AddSubItem($ListView_ta, $index, $Name[7], 7)
        _GUICtrlListView_AddSubItem($ListView_ta, $index, $Name[8], 8)
        .Movenext
WEnd
EndWith     
ControlHide($GUI, "", $listview_ta)
$aListView[1] = $listview_ta ; Put handles into an array

GUICtrlCreateTabItem("Bestellingenlijst Leimuiden")
$updatebtn_lm=Guictrlcreatebutton("Update statussen", 10, 640, 100, 20)
$listview_lm=_GUICtrlListView_Create($GUI, "Artikelcode | Artikelomschrijving | Bestelnummer | Inkoopprijs | Aantal | Opmerking | Klantgegevens | Aanmelder | Status", 0, 110, 791, 527)
_GUICtrlListView_SetExtendedListViewStyle($listview_lm, $LVS_EX_GRIDLINES)
$bestellingen=$conn.Execute("SELECT * FROM bestellingen_leimuiden") 
With $bestellingen
    While NOT .EOF
        $db_artikelcode=.fields("artikelcode").value
        $db_omschrijving=.fields("artikelomschrijving").value
        $db_bestelnummer=.fields("bestelnummer").value
        $db_inkoopprijs=.fields("inkoopprijs").value
        $db_aantal=.fields("aantal").value
        $db_opmerking=.fields("opmerking").value
        $db_klant=.fields("klant").value
        $db_aanmelder=.fields("aanmelder").value
        $db_status=.fields("status").value
        
Local $Name[9]
        $Name[0] = $db_artikelcode 
        $name[1] = $db_omschrijving
        $name[2] = $db_bestelnummer
        $name[3] = $db_inkoopprijs
        $name[4] = $db_aantal
        $name[5] = $db_opmerking
        $name[6] = $db_klant
        $name[7] = $db_aanmelder
        $name[8] = $db_status
        
        $index = _GUICtrlListView_AddItem($ListView_lm, $Name[0], 0)
        _GUICtrlListView_AddSubItem($ListView_lm, $index, $Name[1], 1)
        _GUICtrlListView_AddSubItem($ListView_lm, $index, $Name[2], 2)
        _GUICtrlListView_AddSubItem($ListView_lm, $index, $Name[3], 3)
        _GUICtrlListView_AddSubItem($ListView_lm, $index, $Name[4], 4)
        _GUICtrlListView_AddSubItem($ListView_lm, $index, $Name[5], 5)
        _GUICtrlListView_AddSubItem($ListView_lm, $index, $Name[6], 6)
        _GUICtrlListView_AddSubItem($ListView_lm, $index, $Name[7], 7)
        _GUICtrlListView_AddSubItem($ListView_lm, $index, $Name[8], 8)
        .Movenext
WEnd
EndWith 
ControlHide($GUI, "", $listview_lm)
$aListView[2] = $listview_lm ; Put handles into an array
GUICtrlCreateTabItem("Gebruikersoverzicht")
$listview_go=GUICtrlCreateListView("Gebruikersnaam | Locatie | Gebruikersrechten", 0, 340, 791, 295, "", $LVS_EX_GRIDLINES)
$admin_toevoegen=Guictrlcreatebutton("Account aanmaken", 325, 305, 120, 20)
$admin_verwijderen=Guictrlcreatebutton("Account verwijderen", 10, 640, 120, 20)
GUICtrlCreatePic(@ScriptDir & "\images\logo.jpg", 240, 135, 150, 150)

$gebruikers=$conn.Execute("SELECT * FROM gebruikers") 
    With $gebruikers
    While NOT .EOF
        $db_gebruikersnaam=.fields("gebruikersnaam").value
        $db_locatie=.fields("locatie").value
        $db_rechten=.fields("rechten").value
            Guictrlcreatelistviewitem($db_gebruikersnaam &"|"& $db_locatie &"|"& $db_rechten, $listview_go)
    .Movenext
WEnd
EndWith 

;Gebruikersnaam
GUICtrlCreateLabel("Gebruikersnaam:", 20, 125)
$admin_gebruikersnaam=GUICtrlCreateInput("", 20, 145, 150, 20)
;Wachtwoord
GUICtrlCreateLabel("Wachtwoord:", 20, 175)
$admin_wachtwoord=GUICtrlCreateInput("", 20, 195, 150, 20)
;Locatie
GUICtrlCreateLabel("Locatie:", 20, 225)
$admin_locatie=Guictrlcreatecombo("Bodegraven", 20, 245, 120, 20)
GUICtrlSetData(-1, "Ter Aar" &"|"& "Leimuiden") 
;Rechten
GUICtrlCreateLabel("Gebruikersrechten:", 20, 275)
$admin_rechten=Guictrlcreatecombo("Gebruiker", 20, 295, 120, 20)
GUICtrlSetData(-1, "Beheerder") 

GUICtrlCreateGroup("", 10, 110, 440, 220)
GUICtrlCreateTabItem("")

; Look for double clicks
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$iLastTab = 0
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        DllClose($dll)
            Exit
        Case $updatebtn_bg
            _updatestatus_bg()
        Case $updatebtn_ta
            _updatestatus_ta()
        Case $updatebtn_lm
            _updatestatus_lm()  
        Case $admin_toevoegen
            _admin_toevoegen()
        Case $admin_verwijderen
            _admin_verwijderen()
    EndSwitch

    ; Check which Tab is active
    $iCurrTab = _GUICtrlTab_GetCurFocus($TAB)
    ; If the Tab has changed
    If $iCurrTab <> $iLastTab Then
        ; Store the value for future comparisons
        $iLastTab = $iCurrTab
        ; Show/Hide controls as required
        Switch $iCurrTab
            Case 0, 4
                ControlHide($GUI, "", $listview_bg)
                ControlHide($GUI, "", $listview_ta)
                ControlHide($GUI, "", $listview_lm)
            Case 1
                ControlHide($GUI, "", $listview_ta)
                ControlHide($GUI, "", $listview_lm)
                ControlShow($GUI, "", $listview_bg)
             Case 2
                ControlHide($GUI, "", $listview_bg)
                ControlHide($GUI, "", $listview_lm)
                ControlShow($GUI, "", $listview_ta)
            Case 3
                ControlHide($GUI, "", $listview_bg)
                ControlHide($GUI, "", $listview_ta)
                ControlShow($GUI, "", $listview_lm)
        EndSwitch
    EndIf
;#ce

    ; If a temporary combo exists
    If $hTmp_Combo <> 0 Then
        ; If ENTER pressed
        If _IsPressed("0D", $dll) Then
            ; Set label to edit content
            $sText = GUICtrlRead($hTmp_Combo)
            _GUICtrlListView_SetItemText($hListView, $aLV_Click_Info[0], $sText, $aLV_Click_Info[1])
            ; Delete temporary combo
            GUICtrlDelete($hTmp_combo)
            $hTmp_Combo = 0
            GUICtrlSetState($hListView, $GUI_ENABLE)    
        EndIf
        ; If ESC pressed
        If _IsPressed("1B", $dll) Then
            ; Delete temporary combo
            GUICtrlDelete($hTmp_Combo)
            $hTmp_Combo = 0
            GUICtrlSetState($hListView, $GUI_ENABLE)
        EndIf
    EndIf

    ; If an item was double clicked
    If $fDblClk Then
        ; Set clicked listview handle as passed in $fDblClk
        $hListView = $fDblClk
        $fDblClk = False
        ; Delete an existing temporary combo
        GUICtrlDelete($hTmp_Combo)
        ; Get label position
        Switch $aLV_Click_Info[1]
            Case 0 ; On Item
                $aLV_Rect_Info = _GUICtrlListView_GetItemRect($hListView, $aLV_Click_Info[0], 2)
            Case Else ; On SubItem
                $aLV_Rect_Info = _GUICtrlListView_GetSubItemRect($hListView, $aLV_Click_Info[0], $aLV_Click_Info[1])
        EndSwitch
        ; Create temporary combo
        $hTmp_Combo = GUICtrlCreateCombo("", $aLV_Rect_Info[0] + 0, $aLV_Rect_Info[1] + 110, 100, $aLV_Rect_Info[3] - $aLV_Rect_Info[1])
        GUICtrlSetData($hTmp_Combo, "In behandeling|Afgehandeld|In backorder")
        GUICtrlSetState($hListView, $GUI_DISABLE)
        GUICtrlSetState($hTmp_Combo, BitOR($GUI_FOCUS, $GUI_ONTOP))
    EndIf

WEnd

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)

    ; If a combo exists, return immediately
    If $hTmp_Combo <> 0 Then Return $GUI_RUNDEFMSG

    Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    
    ; Check the listviews
    For $i = 0 To 2
        If HWnd(DllStructGetData($tNMHDR, "hWndFrom")) = $aListView[$i] Then

            If DllStructGetData($tNMHDR, "Code") = $NM_DBLCLK Then

                $aLV_Click_Info = _GUICtrlListView_SubItemHitTest($aListView[$i])
                ; As long as the click was on the ListView
                If $aLV_Click_Info[0] <> -1 Then
                    ; Check it was in Col 2
                    If $aLV_Click_Info[1] = 8 Then $fDblClk = $aListView[$i] ; return the handle of the Listview that was doubleclicked
                EndIf
            EndIf
        EndIf
    Next
    Return $GUI_RUNDEFMSG
EndFunc

Func _updatestatus_bg()
    $ItemsCount= _GUICtrlListView_GetItemCount($listview_bg)
    For $i = 0 To $ItemsCount Step 1 
        $update_artikelcode=_GUICtrlListView_GetItemText($listview_bg, $i, 0)
        $update_omschrijving=_GUICtrlListView_GetItemText($listview_bg, $i, 1)
        $update_aantal=_GUICtrlListView_GetItemText($listview_bg, $i, 4)
        $update_status=_GUICtrlListView_GetItemText($listview_bg, $i, 8)
    $conn.Execute("UPDATE bestellingen_bodegraven SET Status = '"&$update_status&"' WHERE Artikelcode = '"&$update_artikelcode&"' AND Artikelomschrijving = '"&$update_omschrijving&"' AND Aantal = '"&$update_aantal&"'")
Next
EndFunc   

Func _updatestatus_ta()
    $ItemsCount= _GUICtrlListView_GetItemCount($listview_ta)
    For $i = 0 To $ItemsCount Step 1 
        $update_artikelcode=_GUICtrlListView_GetItemText($listview_ta, $i, 0)
        $update_omschrijving=_GUICtrlListView_GetItemText($listview_ta, $i, 1)
        $update_aantal=_GUICtrlListView_GetItemText($listview_ta, $i, 4)
        $update_status=_GUICtrlListView_GetItemText($listview_ta, $i, 8)
    $conn.Execute("UPDATE bestellingen_teraar SET Status = '"&$update_status&"' WHERE Artikelcode = '"&$update_artikelcode&"' AND Artikelomschrijving = '"&$update_omschrijving&"' AND Aantal = '"&$update_aantal&"'")
Next
EndFunc   

Func _updatestatus_lm()
    $ItemsCount= _GUICtrlListView_GetItemCount($listview_lm)
    For $i = 0 To $ItemsCount Step 1 
        $update_artikelcode=_GUICtrlListView_GetItemText($listview_lm, $i, 0)
        $update_omschrijving=_GUICtrlListView_GetItemText($listview_lm, $i, 1)
        $update_aantal=_GUICtrlListView_GetItemText($listview_lm, $i, 4)
        $update_status=_GUICtrlListView_GetItemText($listview_lm, $i, 8)
    $conn.Execute("UPDATE bestellingen_leimuiden SET Status = '"&$update_status&"' WHERE Artikelcode = '"&$update_artikelcode&"' AND Artikelomschrijving = '"&$update_omschrijving&"' AND Aantal = '"&$update_aantal&"'")
Next
EndFunc   

Func _admin_toevoegen()
    $read_gebruikersnaam=Guictrlread($admin_gebruikersnaam)
    $read_wachtwoord=Guictrlread($admin_wachtwoord)
    $read_locatie=Guictrlread($admin_locatie)
    $read_rechten=Guictrlread($admin_rechten)
        GUICtrlCreateListViewItem($read_gebruikersnaam &"|"& $read_locatie &"|"& $read_rechten, $listview_go)
        $CONN.Execute("INSERT into gebruikers (Gebruikersnaam, Wachtwoord, Locatie, Rechten) values ('"&$read_gebruikersnaam&"', '"&$read_wachtwoord&"', '"&$read_locatie&"', '"&$read_rechten&"')")
EndFunc     

Func _admin_verwijderen()
    $read_gebruikersnaam=Guictrlread($admin_gebruikersnaam)
    $read_locatie=Guictrlread($admin_locatie)
    $read_rechten=Guictrlread($admin_rechten)
    if _GUICtrlListView_GetItemText($listview_go, 0, 0) = _GUICtrlListView_GetItemSelected($listview_go, 0) Then
            $conn.Execute("DELETE FROM gebruikers WHERE Gebruikersnaam = '"&$read_gebruikersnaam&"' AND Locatie = '"&$read_locatie&"' AND Rechten = '"&$read_rechten&"'")
    EndIf   
EndFunc

Share this post


Link to post
Share on other sites

This include is ready a script file on it self in stead of Func's to be used in the main script.

So, what is the problem you are having because you forgot to answer that question :) (Ja ik weet het: nooit meer dan 1 vraag per keer stellen :) )

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

This include is ready a script file on it self in stead of Func's to be used in the main script.

So, what is the problem you are having because you forgot to answer that question :) (Ja ik weet het: nooit meer dan 1 vraag per keer stellen :) )

Jos

haha, is there a way to solf that?

ps. dutch? :P

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

haha, is there a way to solf that?

When you just want to use some of the Func's from the beheerder.au3 then put the #include at the very end of your main script and ensure you Exit the main script to avoid the beheerder.au3 taken over control.

ps. dutch? :)

yeap... Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

When you just want to use some of the Func's from the beheerder.au3 then put the #include at the very end of your main script and ensure you Exit the main script to avoid the beheerder.au3 taken over control.

yeap...

Hmm.. oke, even still i got the same errors, i will look at it, thnx for the support

i tought that was the problem..

- Nice :)

Share this post


Link to post
Share on other sites

Hmm.. oke, even still i got the same errors, i will look at it, thnx for the support

i tought that was the problem..

- Nice :)

What error are you getting when you place the #include as last line in your main script?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

What error are you getting when you place the #include as last line in your main script?

Same as my beginpost.. made a func that calls #include, at the last lines of my mainscript..that you mean? Edited by misterDee

Share this post


Link to post
Share on other sites

Same as my beginpost.. made a func that calls #include, at the last lines of my mainscript..that you mean?

no no no .... you cannot call includes!!!!!!!!!!!!!

#include statements are preprocessed and the CODE is inserted at it's location before the script is processed.

Understand the difference? :)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

no no no .... you cannot call includes!!!!!!!!!!!!!

#include statements are preprocessed and the CODE is inserted at it's location before the script is processed.

Understand the difference? :)

Yes!, can you show me how to resolf my problem?, cant get it done!

- of zeg ik nou iets doms :)

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Yes!, can you show me how to resolf my problem?, cant get it done!

Thought I already did ... but guess I haven't :)

What you could do is make the GUI logic in beheerder.au3 a FUNC... something like:

#include <misc.au3>
#include <File.au3>
#include <GuiComboBox.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListviewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <GuiListView.au3>
#include <GuiTab.au3>

;Globalizeren
Global $db_artikelcode
Global $db_omschrijving
Global $db_bestelnummer
Global $db_inkoopprijs
Global $db_aantal
Global $db_opmerking
Global $db_klant
Global $db_aanmelder
Global $db_status

Global $aListView[3]

Main()

Func Main()
    ;DB connect
    $FULL_MDB_FILE_NAME = @ScriptDir & "\database\db.mdb"
    $dbpass = "1"
    $CONN = ObjCreate("ADODB.Connection")
    $CONN.Open('Driver={Microsoft Access Driver (*.mdb)};Dbq=' & $FULL_MDB_FILE_NAME & ";PWD=" & $dbpass & ';')
    $RecordSet = ObjCreate("ADODB.Recordset")

    ; We use ESC to exit the temporary Combo
    Opt("GUICloseOnESC", 0)
    ; Set flag to indicate double click in ListView
    Global $fDblClk = False, $hListView = 0
    ; Declare global variables
    Global $aLV_Click_Info, $hTmp_Combo = 0
    ; Open DLL for _IsPressed
    $dll = DllOpen("user32.dll")

    ;Gui
    $GUI = GUICreate("Technofarm BETA v0.99 - Ingelogd als: Ter Aar ", 790, 700, 134, 10, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_APPWINDOW, $WS_MINIMIZEBOX, $WS_EX_RIGHT, $WS_EX_WINDOWEDGE))
    GUICtrlCreatePic(@ScriptDir & "\images\main_bg_top.jpg", 0, 0, 790, 78)
    GUICtrlCreatePic(@ScriptDir & "\images\main_bg_bottom.jpg", 0, 666, 790, 35)
    GUISetBkColor(0xFFFFFF)
    $TAB = GUICtrlCreateTab(0, 76, 800, 700)
    GUICtrlCreateTabItem("Dashboard")
    ;Bodegraven
    GUICtrlCreateTabItem("Bestellingenlijst Bodegraven")
    $updatebtn_bg = GUICtrlCreateButton("Update statussen", 10, 640, 100, 20)
    $listview_bg = _GUICtrlListView_Create($GUI, "Artikelcode | Artikelomschrijving | Bestelnummer | Inkoopprijs | Aantal | Opmerking | Klantgegevens | Aanmelder | Status", 0, 110, 791, 527)
    _GUICtrlListView_SetExtendedListViewStyle($listview_bg, $LVS_EX_GRIDLINES)
    $bestellingen = $CONN.Execute("SELECT * FROM bestellingen_bodegraven")
    With $bestellingen
        While Not .EOF
            $db_artikelcode = .fields("artikelcode").value
            $db_omschrijving = .fields("artikelomschrijving").value
            $db_bestelnummer = .fields("bestelnummer").value
            $db_inkoopprijs = .fields("inkoopprijs").value
            $db_aantal = .fields("aantal").value
            $db_opmerking = .fields("opmerking").value
            $db_klant = .fields("klant").value
            $db_aanmelder = .fields("aanmelder").value
            $db_status = .fields("status").value

            Local $Name[9]
            $Name[0] = $db_artikelcode
            $Name[1] = $db_omschrijving
            $Name[2] = $db_bestelnummer
            $Name[3] = $db_inkoopprijs
            $Name[4] = $db_aantal
            $Name[5] = $db_opmerking
            $Name[6] = $db_klant
            $Name[7] = $db_aanmelder
            $Name[8] = $db_status

            $index = _GUICtrlListView_AddItem($listview_bg, $Name[0], 0)
            _GUICtrlListView_AddSubItem($listview_bg, $index, $Name[1], 1)
            _GUICtrlListView_AddSubItem($listview_bg, $index, $Name[2], 2)
            _GUICtrlListView_AddSubItem($listview_bg, $index, $Name[3], 3)
            _GUICtrlListView_AddSubItem($listview_bg, $index, $Name[4], 4)
            _GUICtrlListView_AddSubItem($listview_bg, $index, $Name[5], 5)
            _GUICtrlListView_AddSubItem($listview_bg, $index, $Name[6], 6)
            _GUICtrlListView_AddSubItem($listview_bg, $index, $Name[7], 7)
            _GUICtrlListView_AddSubItem($listview_bg, $index, $Name[8], 8)
            .Movenext
        WEnd
    EndWith
    ControlHide($GUI, "", $listview_bg)
    $aListView[0] = $listview_bg ; Put handles into an array

    ;Ter Aar
    GUICtrlCreateTabItem("Bestellingenlijst Ter Aar")
    $updatebtn_ta = GUICtrlCreateButton("Update statussen", 10, 640, 100, 20)
    $listview_ta = _GUICtrlListView_Create($GUI, "Artikelcode | Artikelomschrijving | Bestelnummer | Inkoopprijs | Aantal | Opmerking | Klantgegevens | Aanmelder | Status", 0, 110, 791, 527)
    _GUICtrlListView_SetExtendedListViewStyle($listview_ta, $LVS_EX_GRIDLINES)
    $bestellingen = $CONN.Execute("SELECT * FROM bestellingen_teraar")
    With $bestellingen
        While Not .EOF
            $db_artikelcode = .fields("artikelcode").value
            $db_omschrijving = .fields("artikelomschrijving").value
            $db_bestelnummer = .fields("bestelnummer").value
            $db_inkoopprijs = .fields("inkoopprijs").value
            $db_aantal = .fields("aantal").value
            $db_opmerking = .fields("opmerking").value
            $db_klant = .fields("klant").value
            $db_aanmelder = .fields("aanmelder").value
            $db_status = .fields("status").value

            Local $Name[9]
            $Name[0] = $db_artikelcode
            $Name[1] = $db_omschrijving
            $Name[2] = $db_bestelnummer
            $Name[3] = $db_inkoopprijs
            $Name[4] = $db_aantal
            $Name[5] = $db_opmerking
            $Name[6] = $db_klant
            $Name[7] = $db_aanmelder
            $Name[8] = $db_status

            $index = _GUICtrlListView_AddItem($listview_ta, $Name[0], 0)
            _GUICtrlListView_AddSubItem($listview_ta, $index, $Name[1], 1)
            _GUICtrlListView_AddSubItem($listview_ta, $index, $Name[2], 2)
            _GUICtrlListView_AddSubItem($listview_ta, $index, $Name[3], 3)
            _GUICtrlListView_AddSubItem($listview_ta, $index, $Name[4], 4)
            _GUICtrlListView_AddSubItem($listview_ta, $index, $Name[5], 5)
            _GUICtrlListView_AddSubItem($listview_ta, $index, $Name[6], 6)
            _GUICtrlListView_AddSubItem($listview_ta, $index, $Name[7], 7)
            _GUICtrlListView_AddSubItem($listview_ta, $index, $Name[8], 8)
            .Movenext
        WEnd
    EndWith
    ControlHide($GUI, "", $listview_ta)
    $aListView[1] = $listview_ta ; Put handles into an array

    GUICtrlCreateTabItem("Bestellingenlijst Leimuiden")
    $updatebtn_lm = GUICtrlCreateButton("Update statussen", 10, 640, 100, 20)
    $listview_lm = _GUICtrlListView_Create($GUI, "Artikelcode | Artikelomschrijving | Bestelnummer | Inkoopprijs | Aantal | Opmerking | Klantgegevens | Aanmelder | Status", 0, 110, 791, 527)
    _GUICtrlListView_SetExtendedListViewStyle($listview_lm, $LVS_EX_GRIDLINES)
    $bestellingen = $CONN.Execute("SELECT * FROM bestellingen_leimuiden")
    With $bestellingen
        While Not .EOF
            $db_artikelcode = .fields("artikelcode").value
            $db_omschrijving = .fields("artikelomschrijving").value
            $db_bestelnummer = .fields("bestelnummer").value
            $db_inkoopprijs = .fields("inkoopprijs").value
            $db_aantal = .fields("aantal").value
            $db_opmerking = .fields("opmerking").value
            $db_klant = .fields("klant").value
            $db_aanmelder = .fields("aanmelder").value
            $db_status = .fields("status").value

            Local $Name[9]
            $Name[0] = $db_artikelcode
            $Name[1] = $db_omschrijving
            $Name[2] = $db_bestelnummer
            $Name[3] = $db_inkoopprijs
            $Name[4] = $db_aantal
            $Name[5] = $db_opmerking
            $Name[6] = $db_klant
            $Name[7] = $db_aanmelder
            $Name[8] = $db_status

            $index = _GUICtrlListView_AddItem($listview_lm, $Name[0], 0)
            _GUICtrlListView_AddSubItem($listview_lm, $index, $Name[1], 1)
            _GUICtrlListView_AddSubItem($listview_lm, $index, $Name[2], 2)
            _GUICtrlListView_AddSubItem($listview_lm, $index, $Name[3], 3)
            _GUICtrlListView_AddSubItem($listview_lm, $index, $Name[4], 4)
            _GUICtrlListView_AddSubItem($listview_lm, $index, $Name[5], 5)
            _GUICtrlListView_AddSubItem($listview_lm, $index, $Name[6], 6)
            _GUICtrlListView_AddSubItem($listview_lm, $index, $Name[7], 7)
            _GUICtrlListView_AddSubItem($listview_lm, $index, $Name[8], 8)
            .Movenext
        WEnd
    EndWith
    ControlHide($GUI, "", $listview_lm)
    $aListView[2] = $listview_lm ; Put handles into an array
    GUICtrlCreateTabItem("Gebruikersoverzicht")
    $listview_go = GUICtrlCreateListView("Gebruikersnaam | Locatie | Gebruikersrechten", 0, 340, 791, 295, "", $LVS_EX_GRIDLINES)
    $admin_toevoegen = GUICtrlCreateButton("Account aanmaken", 325, 305, 120, 20)
    $admin_verwijderen = GUICtrlCreateButton("Account verwijderen", 10, 640, 120, 20)
    GUICtrlCreatePic(@ScriptDir & "\images\logo.jpg", 240, 135, 150, 150)

    $gebruikers = $CONN.Execute("SELECT * FROM gebruikers")
    With $gebruikers
        While Not .EOF
            $db_gebruikersnaam = .fields("gebruikersnaam").value
            $db_locatie = .fields("locatie").value
            $db_rechten = .fields("rechten").value
            GUICtrlCreateListViewItem($db_gebruikersnaam & "|" & $db_locatie & "|" & $db_rechten, $listview_go)
            .Movenext
        WEnd
    EndWith

    ;Gebruikersnaam
    GUICtrlCreateLabel("Gebruikersnaam:", 20, 125)
    $admin_gebruikersnaam = GUICtrlCreateInput("", 20, 145, 150, 20)
    ;Wachtwoord
    GUICtrlCreateLabel("Wachtwoord:", 20, 175)
    $admin_wachtwoord = GUICtrlCreateInput("", 20, 195, 150, 20)
    ;Locatie
    GUICtrlCreateLabel("Locatie:", 20, 225)
    $admin_locatie = GUICtrlCreateCombo("Bodegraven", 20, 245, 120, 20)
    GUICtrlSetData(-1, "Ter Aar" & "|" & "Leimuiden")
    ;Rechten
    GUICtrlCreateLabel("Gebruikersrechten:", 20, 275)
    $admin_rechten = GUICtrlCreateCombo("Gebruiker", 20, 295, 120, 20)
    GUICtrlSetData(-1, "Beheerder")

    GUICtrlCreateGroup("", 10, 110, 440, 220)
    GUICtrlCreateTabItem("")

    ; Look for double clicks
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    $iLastTab = 0
    GUISetState(@SW_SHOW)
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                DllClose($dll)
                Exit
            Case $updatebtn_bg
                _updatestatus_bg()
            Case $updatebtn_ta
                _updatestatus_ta()
            Case $updatebtn_lm
                _updatestatus_lm()
            Case $admin_toevoegen
                _admin_toevoegen()
            Case $admin_verwijderen
                _admin_verwijderen()
        EndSwitch

        ; Check which Tab is active
        $iCurrTab = _GUICtrlTab_GetCurFocus($TAB)
        ; If the Tab has changed
        If $iCurrTab <> $iLastTab Then
            ; Store the value for future comparisons
            $iLastTab = $iCurrTab
            ; Show/Hide controls as required
            Switch $iCurrTab
                Case 0, 4
                    ControlHide($GUI, "", $listview_bg)
                    ControlHide($GUI, "", $listview_ta)
                    ControlHide($GUI, "", $listview_lm)
                Case 1
                    ControlHide($GUI, "", $listview_ta)
                    ControlHide($GUI, "", $listview_lm)
                    ControlShow($GUI, "", $listview_bg)
                Case 2
                    ControlHide($GUI, "", $listview_bg)
                    ControlHide($GUI, "", $listview_lm)
                    ControlShow($GUI, "", $listview_ta)
                Case 3
                    ControlHide($GUI, "", $listview_bg)
                    ControlHide($GUI, "", $listview_ta)
                    ControlShow($GUI, "", $listview_lm)
            EndSwitch
        EndIf
        ;#ce

        ; If a temporary combo exists
        If $hTmp_Combo <> 0 Then
            ; If ENTER pressed
            If _IsPressed("0D", $dll) Then
                ; Set label to edit content
                $sText = GUICtrlRead($hTmp_Combo)
                _GUICtrlListView_SetItemText($hListView, $aLV_Click_Info[0], $sText, $aLV_Click_Info[1])
                ; Delete temporary combo
                GUICtrlDelete($hTmp_Combo)
                $hTmp_Combo = 0
                GUICtrlSetState($hListView, $GUI_ENABLE)
            EndIf
            ; If ESC pressed
            If _IsPressed("1B", $dll) Then
                ; Delete temporary combo
                GUICtrlDelete($hTmp_Combo)
                $hTmp_Combo = 0
                GUICtrlSetState($hListView, $GUI_ENABLE)
            EndIf
        EndIf

        ; If an item was double clicked
        If $fDblClk Then
            ; Set clicked listview handle as passed in $fDblClk
            $hListView = $fDblClk
            $fDblClk = False
            ; Delete an existing temporary combo
            GUICtrlDelete($hTmp_Combo)
            ; Get label position
            Switch $aLV_Click_Info[1]
                Case 0 ; On Item
                    $aLV_Rect_Info = _GUICtrlListView_GetItemRect($hListView, $aLV_Click_Info[0], 2)
                Case Else ; On SubItem
                    $aLV_Rect_Info = _GUICtrlListView_GetSubItemRect($hListView, $aLV_Click_Info[0], $aLV_Click_Info[1])
            EndSwitch
            ; Create temporary combo
            $hTmp_Combo = GUICtrlCreateCombo("", $aLV_Rect_Info[0] + 0, $aLV_Rect_Info[1] + 110, 100, $aLV_Rect_Info[3] - $aLV_Rect_Info[1])
            GUICtrlSetData($hTmp_Combo, "In behandeling|Afgehandeld|In backorder")
            GUICtrlSetState($hListView, $GUI_DISABLE)
            GUICtrlSetState($hTmp_Combo, BitOR($GUI_FOCUS, $GUI_ONTOP))
        EndIf

    WEnd
EndFunc   ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)

    ; If a combo exists, return immediately
    If $hTmp_Combo <> 0 Then Return $GUI_RUNDEFMSG

    Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)

    ; Check the listviews
    For $i = 0 To 2
        If HWnd(DllStructGetData($tNMHDR, "hWndFrom")) = $aListView[$i] Then

            If DllStructGetData($tNMHDR, "Code") = $NM_DBLCLK Then

                $aLV_Click_Info = _GUICtrlListView_SubItemHitTest($aListView[$i])
                ; As long as the click was on the ListView
                If $aLV_Click_Info[0] <> -1 Then
                    ; Check it was in Col 2
                    If $aLV_Click_Info[1] = 8 Then $fDblClk = $aListView[$i] ; return the handle of the Listview that was doubleclicked
                EndIf
            EndIf
        EndIf
    Next
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _updatestatus_bg()
    $ItemsCount = _GUICtrlListView_GetItemCount($listview_bg)
    For $i = 0 To $ItemsCount Step 1
        $update_artikelcode = _GUICtrlListView_GetItemText($listview_bg, $i, 0)
        $update_omschrijving = _GUICtrlListView_GetItemText($listview_bg, $i, 1)
        $update_aantal = _GUICtrlListView_GetItemText($listview_bg, $i, 4)
        $update_status = _GUICtrlListView_GetItemText($listview_bg, $i, 8)
        $CONN.Execute("UPDATE bestellingen_bodegraven SET Status = '" & $update_status & "' WHERE Artikelcode = '" & $update_artikelcode & "' AND Artikelomschrijving = '" & $update_omschrijving & "' AND Aantal = '" & $update_aantal & "'")
    Next
EndFunc   ;==>_updatestatus_bg

Func _updatestatus_ta()
    $ItemsCount = _GUICtrlListView_GetItemCount($listview_ta)
    For $i = 0 To $ItemsCount Step 1
        $update_artikelcode = _GUICtrlListView_GetItemText($listview_ta, $i, 0)
        $update_omschrijving = _GUICtrlListView_GetItemText($listview_ta, $i, 1)
        $update_aantal = _GUICtrlListView_GetItemText($listview_ta, $i, 4)
        $update_status = _GUICtrlListView_GetItemText($listview_ta, $i, 8)
        $CONN.Execute("UPDATE bestellingen_teraar SET Status = '" & $update_status & "' WHERE Artikelcode = '" & $update_artikelcode & "' AND Artikelomschrijving = '" & $update_omschrijving & "' AND Aantal = '" & $update_aantal & "'")
    Next
EndFunc   ;==>_updatestatus_ta

Func _updatestatus_lm()
    $ItemsCount = _GUICtrlListView_GetItemCount($listview_lm)
    For $i = 0 To $ItemsCount Step 1
        $update_artikelcode = _GUICtrlListView_GetItemText($listview_lm, $i, 0)
        $update_omschrijving = _GUICtrlListView_GetItemText($listview_lm, $i, 1)
        $update_aantal = _GUICtrlListView_GetItemText($listview_lm, $i, 4)
        $update_status = _GUICtrlListView_GetItemText($listview_lm, $i, 8)
        $CONN.Execute("UPDATE bestellingen_leimuiden SET Status = '" & $update_status & "' WHERE Artikelcode = '" & $update_artikelcode & "' AND Artikelomschrijving = '" & $update_omschrijving & "' AND Aantal = '" & $update_aantal & "'")
    Next
EndFunc   ;==>_updatestatus_lm

Func _admin_toevoegen()
    $read_gebruikersnaam = GUICtrlRead($admin_gebruikersnaam)
    $read_wachtwoord = GUICtrlRead($admin_wachtwoord)
    $read_locatie = GUICtrlRead($admin_locatie)
    $read_rechten = GUICtrlRead($admin_rechten)
    GUICtrlCreateListViewItem($read_gebruikersnaam & "|" & $read_locatie & "|" & $read_rechten, $listview_go)
    $CONN.Execute("INSERT into gebruikers (Gebruikersnaam, Wachtwoord, Locatie, Rechten) values ('" & $read_gebruikersnaam & "', '" & $read_wachtwoord & "', '" & $read_locatie & "', '" & $read_rechten & "')")
EndFunc   ;==>_admin_toevoegen

Func _admin_verwijderen()
    $read_gebruikersnaam = GUICtrlRead($admin_gebruikersnaam)
    $read_locatie = GUICtrlRead($admin_locatie)
    $read_rechten = GUICtrlRead($admin_rechten)
    If _GUICtrlListView_GetItemText($listview_go, 0, 0) = _GUICtrlListView_GetItemSelected($listview_go, 0) Then
        $CONN.Execute("DELETE FROM gebruikers WHERE Gebruikersnaam = '" & $read_gebruikersnaam & "' AND Locatie = '" & $read_locatie & "' AND Rechten = '" & $read_rechten & "'")
    EndIf
EndFunc   ;==>_admin_verwijderen

... and include that in your posted script like:

;   Techniektool gemaakt door Dennis
;   in opdracht voor Technofarm
;   Versie 1.0

#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

; Variables
$userlogin = "admin"
$passlogin = "1"

; GUI
$gui = GUICreate("Technofarm Login ", 200, 180, 330, 200, -1, BitOR($WS_EX_RIGHT, $WS_EX_APPWINDOW, $WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic(@ScriptDir & "\images\logo.jpg", 90, 0, 100, 90)
GUICtrlCreateLabel("Gebruikersnaam", 0, 65)
$username = GUICtrlCreateInput("", 0, 80, 120, 20)
GUICtrlCreateLabel("Wachtwoord", 0, 105)
$password = GUICtrlCreateInput("", 0, 120, 120, 20, 0x0020)
$loginbtn = GUICtrlCreateButton("Login", 70, 150, 50, 23)

;DB connect
$FULL_MDB_FILE_NAME = @ScriptDir & "\database\db.mdb"
$dbpass = "xyz"
$CONN = ObjCreate("ADODB.Connection")
$CONN.Open('Driver={Microsoft Access Driver (*.mdb)};Dbq=' & $FULL_MDB_FILE_NAME & ";PWD=" & $dbpass & ';')
$RecordSet = ObjCreate("ADODB.Recordset")

; Loop
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $loginbtn
            _userlogin()
    EndSwitch
WEnd

Func _userlogin()
    $readusername = GUICtrlRead($username)
    $readpassword = GUICtrlRead($password)
    $gebruikers = $CONN.Execute("SELECT * FROM gebruikers WHERE gebruikersnaam='" & $readusername & "';")
    With $gebruikers
        While Not .EOF
            $db_gebruikersnaam = .fields("gebruikersnaam").value
            $db_wachtwoord = .fields("wachtwoord").value
            $db_locatie = .fields("locatie").value
            $db_rechten = .fields("rechten").value
            .movenext
            If $readusername = $db_gebruikersnaam And $readpassword = $db_wachtwoord And $db_rechten = "Beheerder" Then
                GUIDelete($gui)
                main()
            Else
                GUICtrlCreateIcon("Shell32.dll", -132, 130, 123, 15, 15)
                MsgBox(16, "Fout!", "Foutief wachtwoord")
                GUICtrlSetData($password, "")
            EndIf
        WEnd
    EndWith
EndFunc   ;==>_userlogin

Exit
#include "beheerder.au3"

All untested but might give you an idea :)

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Looks like you might have left a password in the script. (line 26 of the main script)

Share this post


Link to post
Share on other sites

Thought I already did ... but guess I haven't :P

All untested but might give you an idea :)

Oh now i get what you mean, im sorry for the whole converstation!

its very clear, thnx for all your support!

:)

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