Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/26/2020 in all areas

  1. By luck I created a function for that just yesterday 😎... Edit: Changed function name to _WinSetClientSize(), good idea! #include <WinAPISysWin.au3> #include <WindowsConstants.au3> ; crerating a default gui will work ok Local $hGui = GUICreate("Example", 200, 200, 50, 50) Local $aClientSize = WinGetClientSize($hGui) GUISetState() MsgBox(0, 'No Styles', "Width of window's client area : " & $aClientSize[0] & @CRLF & _ "Height of window's client area: " & $aClientSize[1] & @CRLF) GUIDelete($hGui) ; by setting also the Style and the ExStyle parameters will arise a mismatch $hGui = GUICreate("Example", 200, 200, 50, 50, $WS_THICKFRAME, $WS_EX_TOOLWINDOW) $aClientSize = WinGetClientSize($hGui) GUISetState() MsgBox(0, 'Setting Styles', "Width of window's client area : " & $aClientSize[0] & @CRLF & _ "Height of window's client area: " & $aClientSize[1] & @CRLF) _WinSetClientSize($hGui, 200, 200) $aClientSize = WinGetClientSize($hGui) MsgBox(0, 'Use _WinSetClientSize()', "Width of window's client area : " & $aClientSize[0] & @CRLF & _ "Height of window's client area: " & $aClientSize[1] & @CRLF) GUIDelete($hGui) ; setting styles after the default GUI has been created will match the client's area dimensions, ; but will introduce some other side effects $hGui = GUICreate("Example", 200, 200, 50, 50) GUISetStyle($WS_THICKFRAME, $WS_EX_TOOLWINDOW, $hGui) $aClientSize = WinGetClientSize($hGui) GUISetState() MsgBox(0, 'Setting Styles after', "Width of window's client area : " & $aClientSize[0] & @CRLF & _ "Height of window's client area: " & $aClientSize[1] & @CRLF & ".... try to move & resize the gui") Func _WinSetClientSize($hWnd, $iW, $iH) Local $aWinPos = WinGetPos($hWnd) Local $sRect = DllStructCreate("int;int;int;int;") DllStructSetData($sRect, 3, $iW) DllStructSetData($sRect, 4, $iH) _WinAPI_AdjustWindowRectEx($sRect, _WinAPI_GetWindowLong($hWnd, $GWL_STYLE), _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE)) ; ConsoleWrite(DllStructGetData($sRect, 1) & "x" & DllStructGetData($sRect, 2) & @TAB & DllStructGetData($sRect, 3) & "x" & DllStructGetData($sRect, 4) & @CRLF) WinMove($hWnd, "", $aWinPos[0], $aWinPos[1], $aWinPos[2] + (DllStructGetData($sRect, 3) - $aWinPos[2]) - DllStructGetData($sRect, 1), $aWinPos[3] + (DllStructGetData($sRect, 4) - $aWinPos[3]) - DllStructGetData($sRect, 2)) EndFunc ;==>_WinSetClientSize
    2 points
  2. ok @Chimp, you've got it #include <WindowsConstants.au3> Global $hGui, $aClientSize, $aWinPos $hGui = GUICreate("Example", 200, 200, 50, 50, $WS_THICKFRAME, $WS_EX_TOOLWINDOW) _WinSetClientSize($hGui, Default, 200, 200) $aClientSize = WinGetClientSize($hGui) GUISetState() MsgBox(0, 'Setting Styles', "Width of window's client area : " & $aClientSize[0] & @CRLF & _ "Height of window's client area: " & $aClientSize[1] & @CRLF) GUIDelete($hGui) Func _WinSetClientSize($sTitle, $sText, $iWidth, $iHeigth, $iLeft = Default, $iTop = Default) Local $hWin = WinGetHandle($sTitle, $sText) If @error Then Return SetError(1, 0, $hWin) Local $aClientSize = WinGetClientSize($hWin) Local $aWinPos = WinGetPos($hWin) Local $iBorder = Int(($aWinPos[2] - $aClientSize[0]) / 2) Local $iBar = $aWinPos[3] - $aClientSize[1] - $iBorder If $iLeft = "" Or $iLeft = Default Then $iLeft = $aWinPos[0] If $iTop = "" Or $iTop = Default Then $iTop = $aWinPos[1] ConsoleWrite('$iBorder = ' & $iBorder & @CRLF) ConsoleWrite('$iBar = ' & $iBar & @CRLF) WinMove($hWin, "", $iLeft, $iTop, $iWidth + ($iBorder * 2), $iHeigth + $iBorder + $iBar, 0) Return $hWin EndFunc ;==>_WinSetClientSize
    2 points
  3. I have just uploaded a new version of the CryptoNG UDF library that includes the ability to create RSA public/private key pairs. The UDF is _CryptoNG_CreateRSAKeyPair. An example of how to use the new function was added the the examples file. Please refer to the functions header to get more information related to the parameters. There are a few things to keep in mind about this incremental new UDF functionality. The output of the new function is a public/private key blob pair that is CryptoAPI-compatible. Key blobs are what are used internally by Microsoft's Asymmetric Crypto NG APIs. As I detailed in the example file, these key blob files can be easily converted to PEM or DER encoded files using tools like OpenSSL. The addition of this new function does not add much value by itself other than showing how RSA keys can be generated using Microsoft's CryptoNG APIs because you still need some other tool to convert the file to PEM or DER. In other words, if you need a tool like OpenSSL to convert the key blob to PEM or DER, you might as well use OpenSSL to create the key pair to begin with. However, having the ability to create RSA key pair blobs will lend itself to being able to use the CryptoNG APIs to do asymmetric encryption/decryption/signing in the future when that functionality is added to the library. Also, in the future, I may add the ability to convert the key blobs to DER and PEM internally, so that the UDF library doesn't rely on external tools to do the conversions.
    2 points
  4. As the OutlookEX UDF - Help & Support thread has grown too big, I'm starting a new one. The original thread can be found here.
    1 point
  5. water

    OutlookEX

    Version 1.7.0.1

    10,051 downloads

    Extensive library to control and manipulate Microsoft Outlook. This UDF holds the functions to automate items (folders, mails, contacts ...) in the background. Can be seen like an API. There are other UDFs available to automate Outlook: OutlookEX_GUI: This UDF holds the functions to automate the Outlook GUI. OutlookTools: Allows to import/export contacts and events to VCF/ICS files and much more. Threads: Development - General Help & Support - Example Scripts - Wiki BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2020-02-09) None
    1 point
  6. thanks @pixelsearch, in this way it seems to work better p.s. ... it would be interesting a function that allows you to set the size of the "client area of the window" at will ... something like _WinSetClientSize () leaving the styles as they are
    1 point
  7. Hi Chimp Does the following line solve the last gui issue ? ; GUISetStyle($WS_THICKFRAME, $WS_EX_TOOLWINDOW, $hGui) GUISetStyle(BitOR($GUI_SS_DEFAULT_GUI, $WS_THICKFRAME), $WS_EX_TOOLWINDOW, $hGui)
    1 point
  8. Or a little different approach : #include <GUIConstants.au3> #include <GuiComboBox.au3> Local $hGUI = GUICreate("Test") Local $cCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($cCombo, "1|2|3") GUICtrlCreateLabel ("Edit :", 10, 50,50,20) Local $cEdit = GUICtrlCreateInput ("", 50, 50, 150, 20) Local $cButton = GUICtrlCreateButton("OK", 10, 100, 100, 25) Local $cDummy = GUICtrlCreateDummy() Local $aAccelKeys[1][2] = [["{ENTER}", $cDummy]] GUISetAccelerators($aAccelKeys) GUISetState() Local $tInfo _GUICtrlComboBox_GetComboBoxInfo($cCombo, $tInfo) Local $hCombo = DllStructGetData($tInfo, "hEdit") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cButton ExitLoop Case $cDummy If ControlGetHandle($hGUI, "", ControlGetFocus ($hGUI)) = $hCombo Then ; put your code here ConsoleWrite(GUICtrlRead($cCombo) & @CRLF) EndIf EndSwitch WEnd
    1 point
  9. mike2003, I would see if the combo edit box has focus when Enter is pressed - like this: #include <GUIConstantsEx.au3> #include <WinAPISysWin.au3> #include <GuiComboBox.au3> #include <Misc.au3> Global $tInfo $hDLL = DllOpen("user32.dll") $hGUI = GUICreate("Test", 500, 500) $cCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($cCombo, "1|2|3") GUISetState() ; Get handle of combo edit box If _GUICtrlComboBox_GetComboBoxInfo($cCombo, $tInfo) Then $hComboEdit = DllStructGetData($tInfo, "hEdit") Else ConsoleWrite("Fail" & @CRLF) Exit EndIf While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE DllClose($hDLL) Exit EndSwitch ; Check for Enter press If _IsPressed("0D", $hDLL) Then ; Check if combo edit box has focus If _WinAPI_GetFocus() = $hComboEdit Then ConsoleWrite(GUICtrlRead($cCombo) & @CRLF) EndIf EndIf ; Wait for Enter release - try without this to see why you need it! While _IsPressed("0D", $hDLL) Sleep(250) WEnd WEnd M23
    1 point
  10. Hi.. Just signed up to say thanks very much for this function - your work is appreciated :)
    1 point
  11. But neither of those functions return correct results. Some constants are defined as bitwise OR-ed values of two or more basic constants. That's why you will get lots of incorrect results. First you have to check for composite values (like WS_POPUPWINDOW or WS_OVERLAPPEDWINDOW or WS_CAPTION or DS_SHELLFONT or WS_EX_OVERLAPPEDWINDOW or WS_EX_PALETTEWINDOW) and if detected substract its value from the input before adding more styles strings.
    1 point
  12. Check the help file for the _Singleton() function. It's designed for exactly this.
    1 point
  13. Have you tried Run("notepad.exe somefile.ext") ?
    1 point
  14. ShellExecute use the associated file with the program ShellExecute("C:\test.txt") this opens the text.txt. file in notepad ( on my computer ) 8)
    1 point
  15. First: Second: Thanks anyway!
    0 points
×
×
  • Create New...