Sign in to follow this  
Followers 0
johnmcloud

[SOLVED] GUI Resize method?

10 posts in this topic

#1 ·  Posted (edited)

Hi guys,

With GUICreate, when set H and W, it start from bottom-right for resize the GUI.

If i want to resize the four side starting from the center? So the four side it will be resize in the same way.

Hope i was clear, if i wasn't i'll do some screen :oops:

Thanks for support

Edited by johnmcloud

Share this post


Link to post
Share on other sites



Unless I misunderstood, try this:

GUICtrlSetResizing($Control,136)

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

See equal to the normal version.

I'll do an example:

This is a gui with 243, 170, -1, -1:

Posted Image

Now is 150, 120, -1, -1:

Posted Image

As you can see, it resize from botton-right. I want a risize equal to every side, like a "Scale", not like the image.

I want a resize like this:

Posted Image

Not this:

Posted Image

I don't know how to explain better :oops:

Thanks

Edited by johnmcloud

Share this post


Link to post
Share on other sites

Try this to see if it's doing what you're asking:

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

#region - GUI Create
$GUI = GUICreate('Test', 243, 170, -1, -1, BitOR($WS_THICKFRAME, $GUI_SS_DEFAULT_GUI))
GUICtrlCreateGroup("GROUP 1", 10, 10, 223, 150)
GUICtrlSetResizing(-1, 1)
GUICtrlCreateButton("TEST", 30, 30)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE)

GUISetState()
#endregion - GUI Create

#region - GUI SelectLoop
While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd
#endregion - GUI SelectLoop
Func _Exit()
    Exit
EndFunc

This demonstrates what rcmaehl was saying earlier.


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

mmm not :oops:

Posted Image

A side-question: My GUI is always "on top", also if another windows is on it. How to make the gui in a second place?

Share this post


Link to post
Share on other sites

That script will in no way, shape, or form ever give you what you're showing in your picture on a properly operating computer. If that's what you're getting then either you changed the script or your computer is working weirdly. I ran that script on Windows XP x86, and Windows 7 x64 and x86, I also tried it on AutoIt versions 3.3.6.1, 3.3.8.1, beta 3.3.9.1 and none of them showed that behavior.


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

#7 ·  Posted (edited)

Try this:

;coded by UEZ
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global Const $hGUI = GUICreate("Proportional Scale", 243, 170, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_THICKFRAME))
Global Const $idGroup = GUICtrlCreateGroup("Group1", 16, 8, 215, 150)
Global Const $idButton = GUICtrlCreateButton("Test", 50, 50, 50, 30)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

Global $aWS = WinGetPos($hGUI)
Global Const $ratio = $aWS[3] / $aWS[2]
Global Const $minSize = Int($aWS[2] * 0.75)
Global Const $maxSize = Int($aWS[2] * 2)

GUIRegisterMsg($WM_SIZING, "WM_SIZING")
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

Global $nMsg

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIRegisterMsg($WM_SIZING, "")
            GUIRegisterMsg($WM_GETMINMAXINFO, "")
            GUIDelete($hGUI)
            Exit
    EndSwitch
WEnd

Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($minmaxinfo, 7, $minSize) ; min X
    DllStructSetData($minmaxinfo, 8, $minSize) ; min Y
    DllStructSetData($minmaxinfo, 9, $maxSize) ; max X
    DllStructSetData($minmaxinfo, 10, $maxSize) ; max Y
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_GETMINMAXINFO

Func WM_SIZING($hWnd, $iMsg, $wParam, $lParam)
    Local $sRect = DllStructCreate("Int[4]", $lParam)
    Local $left = DllStructGetData($sRect, 1, 1)
    Local $top = DllStructGetData($sRect, 1, 2)
    Local $right = DllStructGetData($sRect, 1, 3)
    Local $bottom = DllStructGetData($sRect, 1, 4)

    Switch $wParam ;drag side or corner
        Case 1, 2, 4, 7
            $iNewY = Int(($right - $left) * $ratio)
            DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 2) + $iNewY, 4)
        Case Else
            $iNewX = Int(($bottom - $top) / $ratio)
            DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 1) + $iNewX, 3)
    EndSwitch
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_SIZING

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I'm testing both and work. The BrewManNH's script not work before because i have manually edit the value of the GUI ( was my first intention, scale in base at the value of the GUI). I think its a better result your script. Thanks also to UEZ, it's a perfect scale :oops:

My last problem, why this GUI is "always at top"?:

$GUIHeight = 25
$GUIWidth = 50

$GUI_1 = GUICreate("", $GUIWidth, $GUIHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED, $WS_EX_TOOLWINDOW)
;~ GUISetBkColor(0xABCDEF)
$Area_GUI_1 = GUICtrlCreateLabel("", 0, 0, $GUIWidth, $GUIHeight)
_WinAPI_SetLayeredWindowAttributes($GUI_1, 0xABCDEF, 255)
GUISetState()

How to remove?

Edited by johnmcloud

Share this post


Link to post
Share on other sites

$GUI_1 = GUICreate("", $GUIWidth, $GUIHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED, $WS_EX_TOOLWINDOW)

is wrong because of the last parameter you set! $WS_EX_TOOLWINDOW is set as parent parameter!

Try instead:

$GUI_1 = GUICreate("", $GUIWidth, $GUIHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOOLWINDOW)

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

UEZ, same problem. I'll post all the script:

EDIT: Maybe better open a new thread for this. Thanks to all :oops:

Edited by johnmcloud

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

  • Similar Content

    • rootx
      Best way to play little video inside a Gui
      By rootx
      I would like to insert a video player inside the gui Autoit, preferably one with a free license such as Media Player Classic or VLC, I saw in the forum but I found examples of many years ago.
      Some examples links or advice would be much help
    • passwd
      Two images in one GUI control with ability to move image
      By passwd
      Hello. I'm trying to make a form with two pictures and one button. But pictures must overlap one another. First picture I'm getting from screenshot of another window, but second picture must be with alfa channel and positioning on that first image.
      Something like that:
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <ScreenCapture.au3> Global Const $AC_SRC_ALPHA = 1 $Form1_1 = GUICreate("Document", 701, 671, -1, -1) GUISetBkColor(0xFFFFFF) $Pic1 = GUICtrlCreatePic("", 8, 8, 409, 657) $Button1 = GUICtrlCreateButton("Take Picture", 424, 8, 161, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Generate() EndSwitch WEnd Func Generate() Local $hBMP, $hBitmap, $hGraphic, $WindowToCapture WinActivate("Notepad") $WindowToCapture = ControlGetHandle("Notepad", "", "[CLASS:Edit; INSTANCE:1]") $hBMP = _ScreenCapture_CaptureWnd ( '', $WindowToCapture,4,4,400,470,False) ; Initialize GDI+ library _GDIPlus_Startup() $PicHandle = GUICtrlGetHandle($Pic1) $myGuiHandle = ControlGetHandle("Document", "", $PicHandle) $TransparentButtonTest = GUICreate("", 0, 0, 390, 130, $WS_EX_MDICHILD, $WS_EX_LAYERED, $myGuiHandle) $hImageButton = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\2-f.png") SetBitMap($TransparentButtonTest, $hImageButton, 255) GUISetState() WinActivate("Document") ; Draw bitmap to GUI $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) $hGraphic = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($Pic1)) _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 100) ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject($hBMP) ; Shut down GDI+ library _GDIPlus_Shutdown() EndFunc Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap But the most interesting, that I need to move second picture(png FromFile) by draging it with mouse ontop of first image.
      Can you tell me what I have done wrong and maybe there is some easier ways to do this?
    • mpower
      Scrollable area and resizing
      By mpower
      Hi guys, I have a GUI which requires scrolling, however resizing is a bit of a problem because any time you scroll down/up and then resize, the controls move down/up and blank space is created within the scrollable area. 
      Any help with maintaining scrollable area size to be fixed would be great.
      Here is a reproducer:
      To achieve the undesirable effect I described, simply run the script, scroll down and then resize window. You will notice that new blank space is created either on top or on bottom of the window depending on scrolling/resizing direction. Easiest way to see how bad it is, is to scroll down the page about half-way and then maximise the window. You will notice now a whole bunch of blank space is added to the top of the window and scrolling up simply shows nothing, scrolling down shows controls but they are cut off because of the blank space created on top of the page.
      This is all happening within the yellow bg  child gui. I need to make it so that even if the GUI is resized the contents of the yellow bg child gui do not move and the scrollable area within the child gui remains the same.
      #NoTrayIcon #include-once #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIScroll.au3> #include <SendMessage.au3> Opt("GUIResizeMode", 802) Global $parentgui_w = 880, $parentgui_h = 810, $childgui_w = $parentgui_w - 2, $childgui_h = $parentgui_h - 292 $parentgui = GUICreate("Scrollbar resize problem", $parentgui_w, $parentgui_h, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetBkColor(0xFFFFFF, $parentgui) $childgui = GUICreate("", $childgui_w, $childgui_h, -5, 263, $WS_POPUP, $WS_EX_MDICHILD, $parentgui) GUISetBkColor(0xFFF123, $childgui) Dim $buttons[25] For $i = 0 to 24 If $i > 0 Then $cPos = ControlGetPos($childgui, "", $buttons[$i - 1]) $buttons[$i] = GUICtrlCreateButton("Button " & $i + 1, ($childgui_w - 200) / 2, $cPos[1] + $cPos[3] + 50, 200, 80) Else $buttons[$i] = GUICtrlCreateButton("Button " & $i + 1, ($childgui_w - 200) / 2, 20, 200, 80) EndIf Next Scrollbar_Create($childgui, $SB_VERT, 130 * 25) Scrollbar_Step(15, $childgui, $SB_VERT) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUIRegisterMsg($WM_NCACTIVATE, "WM_NCACTIVATE") GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") GUISetState(@SW_SHOW, $parentgui) GUISetState(@SW_SHOWNOACTIVATE, $childgui) While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $parentgui Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_RESTORE $pPos = WinGetPos($parentgui) WinMove($parentgui, "", Default, Default, $pPos[2]+1, $pPos[3]+1) WinMove($parentgui, "", Default, Default, $pPos[2]-1, $pPos[3]-1) EndSwitch EndSwitch WEnd Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) Local $iMw = BitShift($wParam, 16) $scroll_lines = 5 If $iMw > 0 Then For $i = 0 to $scroll_lines _SendMessage($childgui, $WM_VSCROLL, $SB_LINEUP) Next Else For $i = 0 to $scroll_lines _SendMessage($childgui, $WM_VSCROLL, $SB_LINEDOWN) Next EndIf Return $GUI_RUNDEFMSG EndFunc Func WM_SIZE($hwnd, $uMsg, $wParam, $lParam) If $hwnd = $parentgui Then $wPos = WinGetPos($parentgui) $pgui_wdiff = ($wPos[2] - $parentgui_w) / 2 $pgui_hdiff = ($wPos[3] - $parentgui_h) / 2 If $pgui_wdiff > 7 Then If $pgui_hdiff <> 0 Then If $wPos[2] > $parentgui_w Then WinMove($childgui, "", $wPos[0] + 2 + $pgui_wdiff, Default, $parentgui_w - 2, $wPos[3] - 306) Else WinMove($childgui, "", $wPos[0] + 2 + $pgui_wdiff, Default, $wPos[2] - 16, $wPos[3] - 306) EndIf Else WinMove($childgui, "", $wPos[0] + 2 + $pgui_wdiff, Default) EndIf ElseIf $pgui_wdiff < 7 Then If $wPos[0] <> -32000 Then WinMove($childgui, "", $wPos[0] + 8, Default, $wPos[2] - 16, $wPos[3] - 306) EndIf ElseIf $pgui_hdiff > 42 Then WinMove($childgui, "", Default, Default, Default, $wPos[3] - 306) EndIf EndIf Return 0 EndFunc Func WM_NCACTIVATE($hwnd, $imsg, $wparam) If $hwnd = $parentgui Then If NOT $wparam Then Return 1 EndIf Return $gui_rundefmsg EndFunc  
    • Wicked_Caty
      No carriage return in label
      By Wicked_Caty
      My program generates a huge lot of numbers that has to be displayed in a label. Usually there are around 100 thousand and 1 million numbers, so I obviously have certain problems with space. I get the data into the label, but it's all in one line and simply exceeds the label (by a couple of million pixels, but never mind that)... Of course it won't fit into a 200x200 big label either, but it'd look a lot nicer. I don't even need to scroll in it.
      The only thing in need is an automatic @CRLF at the border of the label.
      Something like the style $ES_MULTILINE for the input box.
      Here's the most important stuff from the GUI.
      Local $gui = GUICreate("Crypt", 630, 440) Local $in = GUICtrlCreateInput("", 10, 10, 300, 300, $ES_MULTILINE) ; need something like $ES_MULTILINE just one line later in this code Local $out = GUICtrlCreateLabel("", 320, 10, 300, 300) ; instead of "", please imagine a random number between 1e5 and 1e6 here please ; a lot of buttons that don't matter right now GUISetBkColor(0x111111, $gui) GUICtrlSetBkColor($in, 0xEEEEEE) GUICtrlSetBkColor($out, 0xEEEEEE) ; again a lot of button configuartion that's completely unnecessary right now GUICtrlSetColor($in, 0x111111) GUICtrlSetColor($out, 0x111111) ; same as before GUISetFont(13, 200, 0, "Candara", $gui) GUICtrlSetFont($in, 13, 200, 0, "Candara") GUICtrlSetFont($out, 13, 200, 0, "Candara") ; still configuation for the buttons Local $data0 = "" ; some unimportant variables GUISetState(@SW_SHOW, $gui) ; switch from GUIGetMsg() in an infinite while-loop Thanks!
    • Trolleule
      [Solved] Access TreeView Control of existing GUI
      By Trolleule
      Hey,
      i'm building a "Jump To" registry key function and trying to get access to the regedit treeview control like this:
      #include <GUIConstants.au3> #include <GuiTreeView.au3> #include <TreeViewConstants.au3> #include <SendMessage.au3> #include <WinAPI.au3> Global $h_item ShellExecute("regedit.exe") ;~ Local $pid = ProcessExists("regedit.exe") ;~ If $pid Then ;~ $h_tree = WinHandFromPID($pid, "[CLASS:RegEdit_RegEdit]") ;~ WinActivate("[CLASS:RegEdit_RegEdit]", "") ;~ EndIf WinWaitActive("[CLASS:RegEdit_RegEdit]", "") ;~ WinActivate("[CLASS:RegEdit_RegEdit]", "") ;~ WinSetState("[CLASS:RegEdit_RegEdit]", "", @SW_SHOW) ; activate ;~ WinSetState("[CLASS:RegEdit_RegEdit]", "", @SW_RESTORE) ; activate ;~ WinSetState("[CLASS:RegEdit_RegEdit]", "", @SW_RESTORE) ; activate $h_tree = WinGetHandle("[CLASS:RegEdit_RegEdit]", "") ;~ $ret = _WinAPI_ShowWindow($h_tree, @SW_RESTORE) $ctrl = ControlGetHandle($h_tree, "", "[CLASS:SysTreeView32]") ConsoleWrite("$h_tree: " & $h_tree & @CRLF) ConsoleWrite("$ctrl: " & $ctrl & @CRLF) $show = GUICtrlCreateButton("Show", 70, 180, 70, 20) Show() ;~ While 1 ;~ Sleep(200) ;~ WEnd Func Show() $result = "" _SendMessage($ctrl, $WM_SETFOCUS, 0, 0) If @error Then ConsoleWrite("error" & @CRLF) $h_item = _SendMessage($ctrl, $TVM_GETNEXTITEM, $TVGN_ROOT, 0) $split = StringSplit("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "\") For $i=1 To $split[0] ConsoleWrite("item bevor findkey: " & $h_item & @CRLF) $h_item = FindKey($h_item, $split[$i]) If $h_item = 0 Then Return _SendMessage($ctrl, $TVM_SELECTITEM, 0x0009, $h_item) ; expand tree _GUICtrlTreeView_Expand($ctrl, $h_item) Next MsgBox(0, "dsfsdf", "sdfsf") Exit EndFunc Func FindKey($hItemParent, $sKey) $h_item = _SendMessage($ctrl, $TVM_GETNEXTITEM, $TVGN_CHILD, $hItemParent) ConsoleWrite("child : " & $h_item & " key: " & $sKey & " parent: " & $hItemParent & " parent text: " & _GUICtrlTreeView_GetText($ctrl, $hItemParent) & @CRLF) While $h_item <> 0 Local $sItemText = _GUICtrlTreeView_GetText($ctrl, $h_item) ConsoleWrite("text : " & $sItemText & @CRLF) If $sItemText = $sKey Then Return $h_item $h_item = _SendMessage($ctrl, $TVM_GETNEXTITEM, $TVGN_NEXT, $h_item) ConsoleWrite("next : " & $h_item & @CRLF) WEnd ConsoleWrite("not found" & @CRLF) Return 0 EndFunc it's working, when i start regedit.exe within my app. But can't get it work when regedit.exe already open. Some ideas?