Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/24/2011 in all areas

  1. _GUICtrlListBox_SetCurSel()?
    1 point
  2. Nov 8, 2011 Please Note A couple of people have raised concerns and I will address them here: I did not have SQLite V3 support in the version of Autoit that I was using. It was admittedly an older version and it was my fault that I didn't check out the latest version. Be that as it may, this package is intended to work with SQLite V3 so if you have the latest version of Autoit, you probably already have a version of the DLL in place. The SQLIte_Easy module references the DLL by the name SQLite_v3.dll.au3. I will be updating the documentation and checking this out with the latest version of Autoit when I get a chance.This UDF is intended to be both easy and simple. Many of the potential uses of a database are simple and those are the ones that this is good for. It can handle a single database and a single table or multiple tables if they are joined. It doesn't attempt to support all of the possible options in SQLIte. If your application requirement (today or potentially in the future as it evolves) is more complex than this, then you should use the SQLite UDF directly.___________________________________________________________________________________ The SQLite UDF makes accessing an SQLite database in AutoIt pretty easy. I found however; that it still took me more time to put it all together than it should have. I spent a bit of extra time and assembled the package that I wanted but didn't find. It includes: The SQLite_Easy UDF (a simplified interface in front of the standard SQLite UDF)Examples of the most common database functions (using SQLite_Easy)A link to download SQLite Expert, a good free SQLite Manager utility.SQLite_v3.dll.au3 - The dll interface needed for SQLite Version 3 databases. If you have a recent version of Autoit, then you probably already have a version of this (but maybe under a different name).The examples are quite simple so they may be useful for those who aren't very familiar with using a database.Note: I take no credit for the V3 DLL interface. I found that on the Forum and just gave it a new, more consistent name. Version 1.1 Changes - Aug 23, 2011 The changes in this Version are mostly about making it easier to code SQLite requests and to access the data from a database table. Simplified Table Inserts SQLite only provides the traditional format for inserts where you list the fields and then list the data for each one. MySQL allows you to use the same format as an update ( field1='aaaa',field2='bbb'...). SQLite_Easy now returns the ROWID for an Insert which you need to use a similar approach for SQLite. SQLite_String: Simplified Strings for SQL Commands If you are defining an SQL string (e.g. Insert or Update) in Autoit and the column values are mostly variables, then the string becomes a long awkward series of concatenated literals and variables. This function allows you to embed the variables in the input string. The output string has the values of the variables inserted in place of the variable names. Thus, you can provide an input string such as "Update people set field1='$a1', field2='$a2' ..." SQLite_Col: Use Associative Indices Accessing the data from an SQLite_Read normally involves retrieving the data from an array using an index number (based on the relative position of the column). In other languages like PHP, you can also access the col data using the name of the column as the index. You can't normally do this in Autoit since it doesn't support associative arrays. The SQLite_Col function provides the ability to reference the column data returned by an SQLite_Read using the column name. This makes the code easier to create and easier to read; and, it separates the code from the structure / order of the table columns. To download the package, click here.
    1 point
  3. Here is how i will do it... i am a off of coding practice so ask wherever you want to know or you don`t understand, i will try to answer. #include <GuiConstantsEx.au3> #include <GDIPlus.au3> #include <winapi.au3> Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x172 Global $iWidth = 100 Global $iHeight = 100 ; Creating GUI, Save Button and Pic Control... $hGUI = GUICreate("Graphic") GUISetBkColor(0xABCDEF) $iPic = GUICtrlCreatePic("", 0, 0, $iWidth, $iHeight) $iButton1 = GUICtrlCreateButton("Save To File...", 0, 370, 200, 30) $iButton2 = GUICtrlCreateButton("Generate Random Image...", 200, 370, 200, 30) ; Creating an empty image and getting the graphic context... _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) ; Drawing random points... $hPen = _GDIPlus_PenCreate(0xFF000000) Local $i For $y = 0 To $iHeight For $x = 0 To $iWidth $i = Random(0, 1, 1) If $i = 1 Then _GDIPlus_PenSetColor($hPen, 0xFFFFFFFF) ; If i = 1 then white Else _GDIPlus_PenSetColor($hPen, 0xFF000000) ; If i = 0 then black EndIf _GDIPlus_GraphicsDrawRect($hGraphic, $x, $y, 1, 1, $hPen) ; Creating Squares of 1X1(dots) Next Next ; Showing the Image in the Pic Control... $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap) _WinAPI_DeleteObject($hBitmap) ; Showing the GUI and the starting the main loop... GUISetState() While True $iMsg = GUIGetMsg() Switch $iMsg Case -3 _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Exit Case $iButton1 _GDIPlus_ImageSaveToFile($hImage, @DesktopDir & "\temp.png") Case $iButton2 Local $i For $y = 0 To $iHeight For $x = 0 To $iWidth $i = Random(0, 1, 1) If $i = 1 Then _GDIPlus_PenSetColor($hPen, 0xFFFFFFFF) ; If i = 1 then white Else _GDIPlus_PenSetColor($hPen, 0xFF000000) ; If i = 0 then black EndIf _GDIPlus_GraphicsDrawRect($hGraphic, $x, $y, 1, 1, $hPen) ; Creating Squares of 1X1(dots) Next Next $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap) _WinAPI_DeleteObject($hBitmap) EndSwitch WEnd Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc ;==>_GDIPlus_BitmapCreateFromScan0
    1 point
×
×
  • Create New...