Jump to content

Squeeto

Members
  • Posts

    12
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Squeeto's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thank you. $FO_BINARY did what I needed.
  2. Hi, not sure if there is a better way to do this because Chr() gives me issue. $writeFile = FileOpen("ztest", 2) ;open and erase If Not ($writeFile = -1) Then MsgBox(0, "", Chr(Dec("8E"))) FileWrite($writeFile, Chr(Dec("8E"))) EndIf FileClose($writeFile) 8E hex is 142 decimal AutoIt notes show that chr 142 is Ž With the above script: The message box shows character Ž - good. ztest in Windows notepad shows Ž - good. ztest in Windows wordpad shows as Ž - not good. ztest in Hex editor shows as C5 BD - not good. The extended character set is supposed to be available to chr(). If I want to write 8E to ztest (not C5 BD) how should I do it then? Thank you
  3. This simple way works for me for edit controls. After you have dragged all the files, deleted some lines or whatever you want, you then can GUICtrlRead it into an array (or whatever). #include <GUIConstants.au3> #Include <GuiEdit.au3> $GUI_WIDTH = 400 $GUI_HEIGHT = 300 GUICreate("", $GUI_WIDTH, $GUI_HEIGHT, -1, -1, -1, $WS_EX_ACCEPTFILES) $edit = GUICtrlCreateEdit("", 10, 10, 380, 280, $WS_VSCROLL) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $GUI_EVENT_DROPPED _GUICtrlEdit_SetSel($edit,-1,-1) Case $msg = $GUI_EVENT_MOUSEMOVE $mousePos = GUIGetCursorInfo() If ($mousePos[0]<-3 Or $mousePos[0]>$GUI_WIDTH+2 Or _ $mousePos[1]<0 Or $mousePos[1]>$GUI_HEIGHT+2) Then _GUICtrlEdit_SetSel($edit,-1,-1) EndIf EndSelect WEnd
  4. Crap. I have done this before! Thanks guys. DllCall("kernel32.dll", "int", "CloseHandle", "ptr", $hFile[0])
  5. Hi guys, I have been troubled with this one a while; it is time to ask. I would like to delete a file after a DllCall for CreateFile but the call holds up the file. Am I not releasing it somehow? #include <GUIConstants.au3> $main = GUICreate("", 115, 65) $btn = GUICtrlCreateButton("", 20, 20, 75, 25, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $main ExitLoop Case $msg[0] = $btn And $msg[1] = $main $s = @ScriptDir & "\asdf.txt" a($s) FileDelete($s) ;<---why doesn't this work? EndSelect WEnd Func a($file) $hFile = DllCall("kernel32.dll", "ptr", "CreateFile", _ "str", $file, _ "dword", $GENERIC_READ, _ "dword", $FILE_SHARE_READ, _ "dword", "", _ "dword", $OPEN_EXISTING, _ "dword", $FILE_ATTRIBUTE_NORMAL, _ "ptr", 0) If Not @error Then ;... I will do more here later DllCall("kernel32.dll", "int", "CloseHandle", "ptr", $hFile) If Not @error=0 Then MsgBox(0,"Error",@error) Else MsgBox(16, "Error", "Error retreaving file.") EndIf EndFunc TIA
  6. That fixed it. Thank you Rover.
  7. Hi, I can't seem to get this to work past the CreateFileMapping call. Can anyone see any obvious error? #include <GUIConstants.au3> $main = GUICreate("Test1", 180, 120) $testButton = GUICtrlCreateButton("", 50, 30, 35, 25, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $testButton $fileName = @ScriptDir & "\some.exe" ExitLoop EndSelect WEnd const $PAGE_READONLY = 2 const $FILE_MAP_READ = 4 $hDll = DllOpen("kernel32.dll") If $hDll <> -1 Then $hFile = DllCall($hDll, "hwnd", "CreateFile", _ "str", $fileName, _ "dword", $GENERIC_READ, _ "dword", $FILE_SHARE_READ, _ "dword", "", _ "dword", $OPEN_EXISTING, _ "dword", $FILE_ATTRIBUTE_NORMAL, _ "hwnd", 0) If Not @error Then MsgBox(0, "Testing", $hFile[0]) $hFileMapping = DllCall($hDll, "hwnd", "CreateFileMapping", _ "hwnd", $hFile, _ "dword", "", _ "dword", $PAGE_READONLY, _ "dword", 0, _ "dword", 0, _ "str", "") If Not @error Then MsgBox(0, "Testing", $hFileMapping[0]) $pBaseAddress = DllCall($hDll, "hwnd", "MapViewOfFile", _ "hwnd", $hFileMapping, _ "dword", $FILE_MAP_READ, _ "dword", 0, _ "dword", 0, _ "uint", 0) If Not @error Then MsgBox(0, "Testing", $pBaseAddress[0]) Else MsgBox(16, "Error", "Error retreaving base address.") EndIf Else MsgBox(16, "Error", "Error creating file mapping.") EndIf Else MsgBox(16, "Error", "Error retreaving file.") EndIf DllClose($hDll) Else MsgBox(16, "Error", "Error opening Dll") EndIf Exit Thank you
  8. Maybe PaulIA's _API_CreateFontIndirect, but I see no examples of using this to give it a try. Any idea how to choose MS Sans Serif, 14? #include <A3LGDIPlus.au3> Global $hGUI, $hWnd, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout Global $sString = "Hello world" ; Create GUI $hGUI = GUICreate("GDI+", 400, 300) $hWnd = WinGetHandle("GDI+") GUISetState() ; Draw a string _GDIP_Startup() $hGraphic = _GDIP_GraphicsCreateFromHWND($hWnd) $hBrush = _GDIP_BrushCreateSolid(0xFF00007F) $hFormat = _GDIP_StringFormatCreate() $hFont = _API_CreateFontIndirect(????) $tLayout = _GDIP_RectFCreate(140, 110, 0, 0) $aInfo = _GDIP_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat) _GDIP_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush) ; Loop until user exits do until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _API_DeleteObject ($hFont ) _GDIP_StringFormatDispose($hFormat ) _GDIP_BrushDispose ($hBrush ) _GDIP_GraphicsDispose ($hGraphic) _GDIP_Shutdown()
  9. My first post here, so.. A big thanks to PaulIA for this incredible addition to AutoIt. I was just wondering how to make _GDIP_FontCreate.au work without a true type font like Arial. Try it with "MS Sans Serif" or Courier; it doesn't work. $hFamily = _GDIP_FontFamilyCreate("Courier")
  10. Can't miss that warning now! Thanks Gary. I am writing a little app for a few people and I can't expect them all to install MS Dev Tools so I'll pass on this for now.
  11. Version 3.2.0.1 I didn't compile (convert to executable) it though. But all the other examples test just fine by opening the au3 file from autoit3.exe.
  12. Hi, I just downloaded and tried your FileDialog and TestFileDialog and I get this. Did I miss something?
×
×
  • Create New...