Sign in to follow this  
Followers 0
Poncho

Clone a Class of a Programm and include a mirror in my AU3 GUI?

4 posts in this topic

#1 ·  Posted (edited)

Hiho,

iam sry for my bad english. Hope anyone understand what iam trying to say.

Here my Problem:

I want to include a VB-Class of a running programm into my AutoIT-GUI. The class is called msctls_progress and is a Progressbar of a VB-Programm

Is this possible to make a mirror in my own GUI of it? If yes.. HOW?

thanks so far

poncho

Edited by Poncho

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <WindowsConstants.au3>
Opt("TrayIconDebug",1)

$hGui = GUICreate("Test GUI", 320, 240)
GUISetState(@SW_HIDE, $hGui)

$hPid=Run(@SystemDir & '\notepad.exe',"", @SW_HIDE)
WinWait("[CLASS:Notepad]", "", 5)
$hChild = WinGetHandle("[CLASS:Notepad]", "")
$NEXSTYLE = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChild, "int", 236)
DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChild, "int", 236, "int", BitOR($NEXSTYLE[0], $WS_EX_MDICHILD))
DllCall("user32.dll", "int", "SetParent", "hwnd", $hChild, "hwnd", $hGui)
WinMove($hChild, "", 0, 0,320,240)
GUISetState(@SW_SHOW, $hGui)
WinSetState($hChild,"",@SW_SHOW)

While GUIGetMsg()<>-3
    Sleep(1)
WEnd

Func OnAutoItExit()
    ProcessClose($hPid)
EndFunc

Found this Code on AutoIT.de - Well it works yes but not with msctls_progress. It wont show it... :P

Edited by Poncho

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#include <WindowsConstants.au3>
Opt("TrayIconDebug",1)

$hGui = GUICreate("Test GUI", 320, 240)
GUISetState(@SW_HIDE, $hGui)

$hPid=Run(@SystemDir & '\notepad.exe',"", @SW_HIDE)
WinWait("[CLASS:Notepad]", "", 5)
$hChild = WinGetHandle("[CLASS:Notepad]", "")
$NEXSTYLE = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChild, "int", 236)
DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChild, "int", 236, "int", BitOR($NEXSTYLE[0], $WS_EX_MDICHILD))
DllCall("user32.dll", "int", "SetParent", "hwnd", $hChild, "hwnd", $hGui)
WinMove($hChild, "", 0, 0,320,240)
GUISetState(@SW_SHOW, $hGui)
WinSetState($hChild,"",@SW_SHOW)

While GUIGetMsg()<>-3
    Sleep(1)
WEnd

Func OnAutoItExit()
    ProcessClose($hPid)
EndFunc

Found this Code on AutoIT.de - Well it works yes but not with msctls_progress. It wont show it... :P

Tried it with ControlHide but this looks very buggy. It also Crashs my VoipProgramm..

Well, think that Method isnt good. I only want a CLASS, not the Hole PROG :|

any help`?

#include <WindowsConstants.au3>
Opt("TrayIconDebug",1)

$hGui = GUICreate("Test GUI", 380, 380)
GUISetState(@SW_HIDE, $hGui)

$hPid=Run(@SystemDir & '\sndrec32.exe /play "' & @WindowsDir & '\Media\tada.wav"',"", @SW_HIDE)
WinWait("[CLASS:SoundRec]", "", 5)
$hChild = WinGetHandle("[CLASS:SoundRec]", "")
$NEXSTYLE = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChild, "int", 236)
DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChild, "int", 236, "int", BitOR($NEXSTYLE[0], $WS_EX_MDICHILD))
DllCall("user32.dll", "int", "SetParent", "hwnd", $hChild, "hwnd", $hGui)

WinMove($hChild, "", -6, -40 ,400,450)
ControlHide($hChild,"","shadowframe1")
ControlHide($hChild,"","noflickertext1")
ControlHide($hChild,"","noflickertext2")
ControlHide($hChild,"","shadowframe2")
ControlHide($hChild,"","noflickertext3")
ControlHide($hChild,"","noflickertext4")
ControlHide($hChild,"","msctls_trackbar321")
ControlMove($hChild,"","wavedisplay1",150,150)
ControlMove($hChild,"","Button1",10,10,50,50)
ControlMove($hChild,"","Button2",70,10,50,50)
ControlMove($hChild,"","Button3",130,10,50,50)
ControlMove($hChild,"","Button4",190,10,50,50)
ControlMove($hChild,"","Button5",250,10,50,50)

GUISetState(@SW_SHOW, $hGui)
WinSetState($hChild,"",@SW_SHOW)

While GUIGetMsg()<>-3
    Sleep(1)
WEnd

Func OnAutoItExit()
    ProcessClose($hPid)
EndFunc
Edited by Poncho

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

got a solution for me.

I just post it if any1 needs help with this code..

I used a second Child-InChild Window to display only a piece of the programm with WinMove. That worked really great.

Thats it so far:

$hPid=Run($sparvoippath & "\SparVoip.exe", "" , @SW_HIDE)
            If $hPid = 0 Then
            msgbox(0, "FATAL ERROR", "Cant find Sparvoip path." & @CR & "Please install SparVoip Software.")
            exit
            EndIF
            WinWait($hPid, "", 5)
            $voicegui = GUICreate("sparVoip",380, 18,11,452, $WS_POPUP)
            GUISetBkColor(0xFFFFFF, $voicegui)
            DllCall("user32.dll", "hwnd", "SetParent", "hwnd",$voicegui, "hwnd",$maingui)
            GUISetState(@SW_HIDE, $voicegui)
            $hChild1 = WinGetTitle("SparVoip")
            $hChild = WinGetHandle("[TITLE:" & WinGetTitle("SparVoip") & "]", "")
            $NEXSTYLE = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChild, "int", 236)
            DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChild, "int", 236, "int", BitOR($NEXSTYLE[0], $WS_EX_MDICHILD))
            DllCall("user32.dll", "int", "SetParent", "hwnd", $hChild, "hwnd", $voicegui)
            WinMove($hChild, "", -5, -377,443,550)
            GUISetState(@SW_SHOW, $voicegui)
            WinSetState($hChild,"",@SW_SHOW)
Edited by Poncho

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