Jump to content

jercfd

Active Members
  • Posts

    75
  • Joined

  • Last visited

Everything posted by jercfd

  1. How would I set a cookie before inetget is started. I need to set a cookie with login data so I can download certain files.
  2. What version of Delphi is Koda programed with?
  3. Just a simple song database manager using SQLite. Features: Able to save Name, Artist, Album, Year, Album Cover Image, and Lyrics.Menu to select artists and albums already entered into database.View all entries on single tab.Based of Gerifield's Example #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <SQLite.au3> #include <File.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) _SQLite_Startup(@ScriptDir & "\SQLite3.dll") If FileExists(@ScriptDir & "\Songs.db") Then $hDatabaseFile = _SQLite_Open(@ScriptDir & "\Songs.db") Else $hDatabaseFile = _SQLite_Open(@ScriptDir & "\Songs.db") _SQLite_Exec($hDatabaseFile, "CREATE TABLE SongDB (ID,Name,Artist,Album,Year,Album_Cover,Lyrics);") EndIf $hGUI = GUICreate("Song Database Manager", 641, 481, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) GUISetOnEvent($GUI_EVENT_CLOSE, "_hGUIEvents", $hGUI) $hFile = GUICtrlCreateMenu("&File") $hFile_Exit = GUICtrlCreateMenuItem("Exit" & @TAB & "Alt+F4", $hFile) GUICtrlSetOnEvent(-1, "_hMenuEvents") $hEdit = GUICtrlCreateMenu("&Edit") $hEdit_Previous = GUICtrlCreateMenuItem("Previous Entry", $hEdit) GUICtrlSetOnEvent(-1, "_hMenuEvents") $hEdit_Next = GUICtrlCreateMenuItem("Next Entry", $hEdit) GUICtrlSetOnEvent(-1, "_hMenuEvents") GUICtrlCreateMenuItem("", $hEdit) $hEdit_Save = GUICtrlCreateMenuItem("Save Current Entry", $hEdit) GUICtrlSetOnEvent(-1, "_hMenuEvents") $hEdit_Delete = GUICtrlCreateMenuItem("Delete Current Entry", $hEdit) GUICtrlSetOnEvent(-1, "_hMenuEvents") $hTab = GUICtrlCreateTab(10, 10, 620, 440) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) $hEditTab = GUICtrlCreateTabItem("Edit Database") $hSongEntrySave = GUICtrlCreateButton("Save Entry", 19, 40, 375, 45, $BS_DEFPUSHBUTTON) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, "_hEditDatabaseEvents") $hSongEntryDelete = GUICtrlCreateButton("Delete Entry", 399, 65, 75, 20) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, "_hEditDatabaseEvents") $hMultiLeft = GUICtrlCreateButton("<<<", 399, 40, 40, 20) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, "_hEditDatabaseEvents") $hLeft = GUICtrlCreateButton("<", 444, 40, 40, 20) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, "_hEditDatabaseEvents") $iEntryID = 1 $hEntryNumber = GUICtrlCreateLabel($iEntryID, 489, 42, 40, 14, $SS_CENTER) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $hRight = GUICtrlCreateButton(">", 534, 40, 40, 20) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, "_hEditDatabaseEvents") $hMultiRight = GUICtrlCreateButton(">>>", 579, 40, 40, 20) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, "_hEditDatabaseEvents") $hGotoEntry = GUICtrlCreateButton("Goto:", 524, 65, 45, 20) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, "_hEditDatabaseEvents") $hGotoEntryNumber = GUICtrlCreateInput($iEntryID, 574, 65, 45, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_NUMBER)) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateLabel("Song Name:", 33, 98, 63, 14) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $hSongName = GUICtrlCreateInput("", 99, 95, 220, 21) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateLabel("Artist:", 66, 123, 30, 14) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $sAllArtists = "" _GetAllArtists() $hSongArtist = GUICtrlCreateCombo($sAllArtists, 99, 120, 220, 25) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateLabel("Album:", 60, 148, 36, 14) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $sAllAlbums = "" _GetAllAlbums() $hSongAlbum = GUICtrlCreateCombo($sAllAlbums, 99, 145, 220, 25) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateLabel("Year Released:", 19, 173, 77, 14) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $hSongYear = GUICtrlCreateDate(@YEAR, 99, 170, 220, 21, $DTS_UPDOWN) GUICtrlSendMsg(-1, 0x1032, 0, "yyyy") GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateLabel("Album Cover:", 29, 198, 67, 14) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $sSongCoverBinary = "" $hSongCover = GUICtrlCreatePic("", 99, 195, 220, 220, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $hSongCoverSelect = GUICtrlCreateButton("Select Image", 244, 395, 75, 20) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, "_hEditDatabaseEvents") GUICtrlCreateLabel("Lyrics:", 334, 98, 34, 14) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $hSongLyrics = GUICtrlCreateEdit("", 334, 115, 285, 325) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) $hBrowseTab = GUICtrlCreateTabItem("Browse Database") Local $iDBSuccess, $asSongDB, $iRows, $iColumns, $sDBHeader, $ia $iDBSuccess = _SQLite_GetTable2d($hDatabaseFile, "SELECT * FROM SongDB ORDER BY ID;", $asSongDB, $iRows, $iColumns) If $iDBSuccess = $SQLITE_OK Then $sDBHeader = "#|" For $ia = 0 To UBound($asSongDB, 2) - 1 If $asSongDB[0][$ia] <> "Album_Cover" Then $sDBHeader &= $asSongDB[0][$ia] & "|" EndIf Next EndIf $hBrowseDatabase = GUICtrlCreateListView($sDBHeader, 19, 40, 600, 375) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) _GUICtrlListView_SetColumnWidth($hBrowseDatabase, 0, $LVSCW_AUTOSIZE_USEHEADER) _SongBrowseDatabase() $hRefreshDB = GUICtrlCreateButton("Refresh", 19, 420, 75, 20) GUICtrlSetOnEvent(-1, "_hBrowseDatabaseEvents") $hGotoDBEntry = GUICtrlCreateButton("Goto:", 524, 420, 45, 20) GUICtrlSetOnEvent(-1, "_hBrowseDatabaseEvents") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $hGotoDBEntryNumber = GUICtrlCreateInput("1", 574, 420, 45, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_NUMBER)) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateTabItem("") _SongEntryOpen() GUISetState(@SW_SHOW, $hGUI) While 1 Sleep(100) WEnd Func _hGUIEvents() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE _Exit() EndSwitch EndFunc ;==>_hGUIEvents Func _hMenuEvents() Switch @GUI_CtrlId Case $hFile_Exit _Exit() Case $hEdit_Previous $iEntryID -= 1 If $iEntryID < 1 Then $iEntryID = 1 GUICtrlSetData($hEntryNumber, $iEntryID) GUICtrlSetData($hGotoEntryNumber, $iEntryID) _SongEntryOpen() Case $hEdit_Next $iEntryID += 1 If $iEntryID > 65000 Then $iEntryID = 65000 GUICtrlSetData($hEntryNumber, $iEntryID) GUICtrlSetData($hGotoEntryNumber, $iEntryID) _SongEntryOpen() Case $hEdit_Save If StringIsSpace(GUICtrlRead($hSongName)) Or GUICtrlRead($hSongName) == "" Then MsgBox(16, "Error", "Song Name is empty.") Else _SongEntrySave() EndIf Case $hEdit_Delete Local $iDeleteQuestion $iDeleteQuestion = MsgBox(36, "Delete Current Entry", "Are you sure you want to delete the current entry?") If $iDeleteQuestion = 6 Then _SongEntryDelete() EndSwitch EndFunc ;==>_hMenuEvents Func _hEditDatabaseEvents() Switch @GUI_CtrlId Case $hMultiLeft $iEntryID -= 3 If $iEntryID < 1 Then $iEntryID = 1 GUICtrlSetData($hEntryNumber, $iEntryID) GUICtrlSetData($hGotoEntryNumber, $iEntryID) _SongEntryOpen() Case $hLeft $iEntryID -= 1 If $iEntryID < 1 Then $iEntryID = 1 GUICtrlSetData($hEntryNumber, $iEntryID) GUICtrlSetData($hGotoEntryNumber, $iEntryID) _SongEntryOpen() Case $hRight $iEntryID += 1 If $iEntryID > 65000 Then $iEntryID = 65000 GUICtrlSetData($hEntryNumber, $iEntryID) GUICtrlSetData($hGotoEntryNumber, $iEntryID) _SongEntryOpen() Case $hMultiRight $iEntryID += 3 If $iEntryID > 65000 Then $iEntryID = 65000 GUICtrlSetData($hEntryNumber, $iEntryID) GUICtrlSetData($hGotoEntryNumber, $iEntryID) _SongEntryOpen() Case $hGotoEntry $iEntryID = Round(Number(GUICtrlRead($hGotoEntryNumber))) If $iEntryID < 1 Then $iEntryID = 1 If $iEntryID > 65000 Then $iEntryID = 65000 GUICtrlSetData($hEntryNumber, $iEntryID) GUICtrlSetData($hGotoEntryNumber, $iEntryID) _SongEntryOpen() Case $hSongCoverSelect Local $sSongCoverLocation $sSongCoverLocation = FileOpenDialog("Select Album Art", @DesktopDir, "Images (*.BMP; *.JPG; *.JPEG; *.GIF)", 1, "", $hGUI) If Not @error And FileExists($sSongCoverLocation) Then GUICtrlSetImage($hSongCover, $sSongCoverLocation) $sSongAlbumCoverFile = FileOpen($sSongCoverLocation, 16) $sSongAlbumCover = FileRead($sSongAlbumCoverFile) FileClose($sSongAlbumCoverFile) $sSongCoverBinary = $sSongAlbumCover EndIf Case $hSongEntrySave If StringIsSpace(GUICtrlRead($hSongName)) Or GUICtrlRead($hSongName) == "" Then MsgBox(16, "Error", "Song Name is empty.") Else _SongEntrySave() EndIf Case $hSongEntryDelete Local $iDeleteQuestion $iDeleteQuestion = MsgBox(36, "Delete Current Entry", "Are you sure you want to delete the current entry?") If $iDeleteQuestion = 6 Then _SongEntryDelete() EndSwitch EndFunc ;==>_hEditDatabaseEvents Func _SongEntryOpen() Local $iSongID, $asDatabaseLine, $sTempFile $iSongID = $iEntryID GUICtrlSetData($hSongName, "") GUICtrlSetData($hSongArtist, "") GUICtrlSetData($hSongAlbum, "") GUICtrlSetData($hSongYear, @YEAR) GUICtrlSetImage($hSongCover, "") $sSongCoverBinary = 0 GUICtrlSetData($hSongLyrics, "") If _SQLite_QuerySingleRow($hDatabaseFile, "SELECT * FROM SongDB WHERE ID='" & $iSongID & "';", $asDatabaseLine) == $SQLITE_OK Then If $asDatabaseLine[0] == "" Then GUICtrlSetData($hSongArtist, $sAllArtists) GUICtrlSetData($hSongAlbum, $sAllAlbums) ;MsgBox(0,"ERROR","Query error!") Else GUICtrlSetData($hSongName, $asDatabaseLine[1]) GUICtrlSetData($hSongArtist, $sAllArtists, $asDatabaseLine[2]) GUICtrlSetData($hSongAlbum, $sAllAlbums, $asDatabaseLine[3]) GUICtrlSetData($hSongYear, $asDatabaseLine[4]) $sTempFile = _TempFile() FileWrite($sTempFile, Binary($asDatabaseLine[5])) GUICtrlSetImage($hSongCover, $sTempFile) FileDelete($sTempFile) $sSongCoverBinary = $asDatabaseLine[5] GUICtrlSetData($hSongLyrics, $asDatabaseLine[6]) EndIf EndIf EndFunc ;==>_SongEntryOpen Func _SongEntrySave() Local $iSongID, $sSongName, $sSongArtist, $sSongAlbum, $sSongYear, $sSongAlbumCoverFile, $sSongAlbumCover, $sSongLyrics, $asDatabaseLine $iSongID = $iEntryID $sSongName = GUICtrlRead($hSongName) $sSongArtist = GUICtrlRead($hSongArtist) $sSongAlbum = GUICtrlRead($hSongAlbum) $sSongYear = GUICtrlRead($hSongYear) $sSongAlbumCover = $sSongCoverBinary $sSongLyrics = GUICtrlRead($hSongLyrics) _SQLite_QuerySingleRow($hDatabaseFile, "SELECT ID FROM SongDB WHERE ID='" & $iSongID & "';", $asDatabaseLine) If $asDatabaseLine[0] <> "" Then _SQLite_Exec($hDatabaseFile, "UPDATE SongDB SET Name='" & $sSongName & "',Artist='" & $sSongArtist & "',Album='" & $sSongAlbum & "',Year='" & $sSongYear & "',Album_Cover='" & $sSongAlbumCover & "',Lyrics='" & $sSongLyrics & "' WHERE ID='" & $iSongID & "';") Else _SQLite_Exec($hDatabaseFile, "INSERT INTO SongDB (ID,Name,Artist,Album,Year,Album_Cover,Lyrics) VALUES ('" & $iSongID & "','" & $sSongName & "','" & $sSongArtist & "','" & $sSongAlbum & "','" & $sSongYear & "','" & $sSongAlbumCover & "','" & $sSongLyrics & "');") EndIf EndFunc ;==>_SongEntrySave Func _SongEntryDelete() Local $iSongID, $asDatabaseLine $iSongID = $iEntryID GUICtrlSetData($hSongName, "") GUICtrlSetData($hSongArtist, $sAllArtists, "") GUICtrlSetData($hSongAlbum, $sAllAlbums, "") GUICtrlSetData($hSongYear, @YEAR) GUICtrlSetImage($hSongCover, "") GUICtrlSetData($hSongLyrics, "") _SQLite_QuerySingleRow($hDatabaseFile, "SELECT ID FROM SongDB WHERE ID='" & $iSongID & "';", $asDatabaseLine) If $asDatabaseLine[0] <> "" Then _SQLite_Exec($hDatabaseFile, "DELETE FROM SongDB WHERE ID='" & $iSongID & "';") EndIf EndFunc ;==>_SongEntryDelete Func _GetAllArtists() Local $iDBSuccess, $asSongDB, $iRows, $iColumns $iDBSuccess = _SQLite_GetTable2d($hDatabaseFile, "SELECT * FROM SongDB ORDER BY Artist;", $asSongDB, $iRows, $iColumns) If $iDBSuccess = $SQLITE_OK Then For $id = 1 To UBound($asSongDB) - 1 If $asSongDB[$id][2] <> "" And $asSongDB[$id][2] <> $asSongDB[$id - 1][2] Then $sAllArtists &= $asSongDB[$id][2] & "|" EndIf Next EndIf EndFunc ;==>_GetAllArtists Func _GetAllAlbums() Local $iDBSuccess, $asSongDB, $iRows, $iColumns $iDBSuccess = _SQLite_GetTable2d($hDatabaseFile, "SELECT * FROM SongDB ORDER BY Artist;", $asSongDB, $iRows, $iColumns) If $iDBSuccess = $SQLITE_OK Then For $id = 1 To UBound($asSongDB) - 1 If $asSongDB[$id][3] <> "" And $asSongDB[$id][3] <> $asSongDB[$id - 1][3] Then $sAllAlbums &= $asSongDB[$id][3] & "|" EndIf Next EndIf EndFunc ;==>_GetAllAlbums Func _hBrowseDatabaseEvents() Switch @GUI_CtrlId Case $hRefreshDB _SongBrowseDatabase() Case $hGotoDBEntry Local $iGotoDBEntry $iGotoDBEntry = Round(Number(GUICtrlRead($hGotoDBEntryNumber))) If $iGotoDBEntry < 1 Then $iGotoDBEntry = 1 If $iGotoDBEntry > 65000 Then $iGotoDBEntry = 65000 GUICtrlSetData($hGotoDBEntryNumber, $iGotoDBEntry) _GUICtrlListView_ClickItem($hBrowseDatabase, $iGotoDBEntry - 1) EndSwitch EndFunc ;==>_hBrowseDatabaseEvents Func _SongBrowseDatabase() Local $iDBSuccess, $asSongDB, $iRows, $iColumns, $sDBItemText, $ib, $ic _GUICtrlListView_DeleteAllItems($hBrowseDatabase) $iDBSuccess = _SQLite_GetTable2d($hDatabaseFile, "SELECT * FROM SongDB ORDER BY ID;", $asSongDB, $iRows, $iColumns) If $iDBSuccess = $SQLITE_OK Then For $ib = 1 To UBound($asSongDB) - 1 $sDBItemText = $ib & "|" For $ic = 0 To UBound($asSongDB, 2) - 1 If $ic <> UBound($asSongDB, 2) - 2 Then $sDBItemText &= $asSongDB[$ib][$ic] & "|" EndIf Next GUICtrlCreateListViewItem($sDBItemText, $hBrowseDatabase) Next EndIf EndFunc ;==>_SongBrowseDatabase Func _Exit() _SQLite_Close() _SQLite_Shutdown() Exit EndFunc ;==>_Exit
  4. Thanks wolf9228. This will work for me
  5. How can I check if a file is an icon? The header of an icon is below. I am only interested in offset 0 and 2. Offset# Size Purpose 0 2 reserved. should always be 0 2 2 type. 1 for icon (.ICO), 2 for cursor (.CUR) file 4 2 count; number of images in the file In hex, it would look like this 00 00 01 00 0# 00 # = number of images in file Also, if there is any other method to check if a file is an icon, I would gladly like to know.
  6. A Idea for improvement: Change the open link list and open error links to buttons (not use # for a button)
  7. So I am forced to use GUIRegisterMsg() and the $WM_* constants when I use the UDFs?
  8. I tried that but it isn;t working. $hGUI = GUICreate("TEST", 640, 480, -1, -1) $hFileMenu = _GUICtrlMenu_CreateMenu() $hFileMenu_Open = _GUICtrlMenu_InsertMenuItem($hFileMenu, 0, "&Open" & @TAB & "Ctrl+O") GUICtrlSetOnEvent($hFileMenu_Open, "Test") _GUICtrlMenu_SetMenu($hGUI, $hMenu) func Test() consolewrite("returned"&@CRLF) EndFunc
  9. How can I make the following controls return an event when clicked on? I don't want to use WM_COMMAND for handling the events. If possible, I would like to find out how to use GUIOnEventMode to return an event from the following controls below. _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem()
  10. BUMP
  11. How would I use lod3n launcher to use multiple background images. Also, the top, bottom, and sides need to be dynamically sized from their original. For example, the top.png is 767px long and I want it sized to the current window size.
  12. That way looks exactly the same as my code. I want the GUI to be invisible but the controls not invisible.
  13. How can I make my GUI to only show PNGs and no default background. I still want it to be able to use regular controls. #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> $hGUI = GUICreate("Show PNG", 240, 240, -1, -1, $WS_POPUP) GUISetState(@SW_SHOW, $hGUI) _GDIPlus_StartUp() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Normal\top-left.png") $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) $hImage2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Normal\top.png") $hGraphic2 = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic2, $hImage2, 18, 0) $hImage3 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Normal\top-right.png") $hGraphic3 = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic2, $hImage3, 240-18, 0) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphic2) _GDIPlus_ImageDispose($hImage2) _GDIPlus_GraphicsDispose($hGraphic3) _GDIPlus_ImageDispose($hImage3) _GDIPlus_ShutDown() Exit EndSwitch WEnd
  14. does anyone have a idea why?
  15. When I resize my GUI, the controls disapear/resize to cover the status bar. #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 401, 201, 440, 224, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) $hStatusBar = _GUICtrlStatusBar_Create($Form1) Dim $StatusBar1_PartsWidth[3] = [100, 200, 250] _GUICtrlStatusBar_SetParts($hStatusBar, $StatusBar1_PartsWidth) _GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0) $progress = GUICtrlCreateProgress(0, 0, -1, -1) $hProgress = GUICtrlGetHandle($progress) _GUICtrlStatusBar_EmbedControl ($hStatusBar, 1, $hProgress) $progress2 = GUICtrlCreateProgress(0, 0, -1, -1) $hProgress2 = GUICtrlGetHandle($progress2) _GUICtrlStatusBar_EmbedControl ($hStatusBar, 2, $hProgress2) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) _GUICtrlStatusBar_Resize($hStatusBar) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) Global $sTitle = "Web Browser" Global $sVersion = "1.0" $hGUI = GUICreate($sTitle & " " & $sVersion, 640, 480, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) GUISetOnEvent($GUI_EVENT_CLOSE, "_Main_GUI_Events") _IEErrorHandlerRegister() $oIE = ObjCreate("Shell.Explorer.2") $oIEObj = GUICtrlCreateObj($oIE, 0, 0, 640, 480-25) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) ObjEvent($oIE,"_IE_Event_","DWebBrowserEvents") _IENavigate($oIE,"http://www.google.com/") $hStatusBar = _GUICtrlStatusBar_Create($hGUI) Local $hStatusBar_Parts[2] = [640-150, 100] _GUICtrlStatusBar_SetParts($hStatusBar, $hStatusBar_Parts) _GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0) $ctprogress = GUICtrlCreateProgress(0, 0, -1, -1) $hProgress = GUICtrlGetHandle($ctprogress) _GUICtrlStatusBar_EmbedControl ($hStatusBar, 1, $hProgress) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") GUISetState(@SW_SHOW, $hGUI) While 1 If _IEPropertyGet($oIE, "readystate") < 4 Then _GUICtrlStatusBar_SetText($hStatusBar, "Loading: " & _IEPropertyGet($oIE, "locationurl"), 0) ElseIf _IEPropertyGet($oIE, "readystate") = 4 Then _GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0) EndIf WinSetTitle($hGUI, "", _IEPropertyGet($oIE, "title") & " - " & $sTitle & " " & $sVersion) Sleep(75) WEnd Func _Main_GUI_Events() Local $nMsg = @GUI_CtrlId Switch $nMsg Case $GUI_EVENT_CLOSE _Exit() EndSwitch EndFunc ;==>_Main_GUI_Events Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam) Local $MINMAXINFO = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) Local $aiWinSize = WinGetPos($hWnd) Local $aiClientSize = WinGetClientSize($hWnd) DllStructSetData($MINMAXINFO, 7, 395 + ($aiWinSize[2] - $aiClientSize[0]));Minimum X DllStructSetData($MINMAXINFO, 8, 300 + ($aiWinSize[3] - $aiClientSize[1]));Minimum Y ;DllStructSetData($MINMAXINFO, 9, 0);Maximum X ;DllStructSetData($MINMAXINFO, 10, 0);Maximum Y Return 0 EndFunc ;==>WM_GETMINMAXINFO Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) _GUICtrlStatusBar_Resize($hStatusBar) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Func _Exit() Exit EndFunc ;==>_Exit
  16. How do you use IE Events with #include <IE.au3> I know how to use properties and methods but can't figure it out for events. I have included a MSDN of the events http://msdn.microsoft.com/en-us/library/aa752084.aspx
  17. Thanks for the answer. It works great for me.
  18. I don't want to add the context menu into the tray icon. I want it on the application itself where all the windows on the taskbar are located. The context menu is made by the operating system by default and I want to modify it. Possible example
  19. Isn't Modern menu just supposed to add styles to the context menu? I want to create a custom context menu when you right click the application in the taskbar (shows restore, move, size, minmize, maximize, and close context menu)
  20. How would I make a custom context menu for an autoit application. Example I found some delphi code to do it at http://delphi.about.com/od/vclwriteenhance...taskbarmenu.htm and at http://delphi.about.com/od/windowsshellapi/a/system_menu.htm. It says it uses the GetSystemMenu API and commands like AppendMenu, SetMenuItemInfo, and TMenuItemInfo. Then it traps the WM_SYSCOMMAND message to see if the menu item was clicked.
  21. Thanks for all the replies. I kind of prefer monoceres way of assigning variable values
  22. I was just asking why. I'm just trying to optimize my code to have as little lines as possible.
  23. How come the if statement can't do two commands on one line? Example: If $i = 1 Then $ElementLeft = 599 And $ElementTop = 30 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 633, 447, 275, 231) Global $ElementLeft, $ElementTop For $i = 0 To 1 If $i = 0 Then $ElementLeft = 55 And $ElementTop = 30 If $i = 1 Then $ElementLeft = 599 And $ElementTop = 30 GUICtrlCreateLabel("", $ElementLeft, $ElementTop, 30, 30, $SS_BLACKFRAME) GUICtrlCreateLabel($i + 1, $ElementLeft + 2, $ElementTop + 1, 20, 10) GUICtrlSetFont(-1, 7.5, 400, 0, "Arial") GUICtrlCreateLabel("Text", $ElementLeft + 1, $ElementTop + 14, 28, 15, $SS_CENTER) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
  24. Yeah. This will work for me. Didn't know that you could use _Timer_SetTimer like that
  25. Great! Thanks for telling me how to do this.
×
×
  • Create New...