Jump to content
Sign in to follow this  
kokoilie

Can ObjCreate be used with a program created in Autoit?

Recommended Posts

kokoilie

I'm using irrlight to display 3D models in a window but I can't create any controls in this window
and I thought I could compile the code and use objcreate () to display the irrlight (3D) part and overlay it with the autoit gui controls

if it won't work is there a way to add gui controls on to the window created by the .dll?

Edited by kokoilie

Share this post


Link to post
Share on other sites
water

I have never used it myself but maybe the >Au3Irrlicht UDF is what you are looking for.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Richard Robertson

You can't show standard Windows controls on top of a 3D render unless you cache the rendered image and use it as a background.

Share this post


Link to post
Share on other sites
kokoilie

About the Irrlicht UDF that's exactly what i'm using.

How exactly do I cache the render and use it as background? Or more importantly how resource effective this will be?

Edited by kokoilie

Share this post


Link to post
Share on other sites
Richard Robertson

I've never used Irrlicht so I'm afraid I don't know. Most 3D systems let you save a render to an image and you can set that to the background.

Share this post


Link to post
Share on other sites
kokoilie

Maybe it will be the same way as to render texture from the camera, but if I can't do it with irrlicht can you tell me about a 3D system that you used or know how to work with?

Share this post


Link to post
Share on other sites
Richard Robertson

Maybe it will be the same way as to render texture from the camera, but if I can't do it with irrlicht can you tell me about a 3D system that you used or know how to work with?

I'm sorry but I have never actually done 3D programming. I know that if you hook in to DirectX or OpenGL directly instead of using a helper library, you can use almost anything as a texture source.

Share this post


Link to post
Share on other sites
Werty

It can be done by punching holes in the Gui like so...

#include "./Bin/au3Irrlicht2.au3"
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

$Gui = GUICreate("AutoIt Window", 800, 600, -1, -1)
HotKeySet("{ESC}", "_exit")

;Embed Irrlicht RenderWindow---------------------------------------------------------------------------------------
_IrrStart($IRR_EDT_opengl, 1024, 768, $IRR_BITS_PER_PIXEL_32, $IRR_windowed, $IRR_SHADOWS, $IRR_capture_EVENTS, $IRR_VERTICAL_SYNC_Off)
_IrrSetWindowCaption( "IrrLicht Window")

    Local $outer_rgn, $inner_rgn, $combined_rgn

    $outer_rgn = _WinAPI_CreateRectRgn(0, 0, 800, 600)
    $inner_rgn = _WinAPI_CreateRectRgn(103, 102, 200, 122)
    $combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0)
    _WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF)
    _WinAPI_DeleteObject($outer_rgn)
    _WinAPI_DeleteObject($inner_rgn)
    _WinAPI_SetWindowRgn(WinGetHandle("IrrLicht Window", ""), $combined_rgn)

GUICtrlCreateButton("Hey", 100, 80, 100, 22)

WinMove("IrrLicht Window", "", -3, -22)
_WinAPI_Setparent(WinGetHandle("IrrLicht Window", ""), $Gui)
WinActivate("AutoIt Window")

GUISetState()
;--------------------------------------------------------------------------------------------------------------------
;add your IrrLicht stuff here.....

WHILE _IrrRunning()

    _IrrBeginScene(128,128,128)
    _IrrDrawScene()
    _IrrEndScene()
    Sleep(5)
WEND

Func _exit()
    _IrrStop()
    Exit
EndFunc ; _exit

Share this post


Link to post
Share on other sites
kokoilie

Thanks Werty, works like a charm.

Never thought I could use that (actually never knew it's an option). Well guess i'm still green and have much to learn.

One more thing... can I put those "punched holes" back or should I try to make the whole gui that way?

Share this post


Link to post
Share on other sites
Werty

It would be easier just making the autoit window wider than the irrlicht window, now that's it's embedded, and then use the extra space for controls like buttons, tabs etc.

Then there's no need to punch holes.

Something like this...

#include "./Bin/au3Irrlicht2.au3"
;#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

$Gui = GUICreate("AutoIt Window", 800, 458, -1, -1)
HotKeySet("{ESC}", "_exit")

;Embed Irrlicht RenderWindow---------------------------------------------------------------------------------------
_IrrStart($IRR_EDT_opengl, 640, 480, $IRR_BITS_PER_PIXEL_32, $IRR_windowed, $IRR_SHADOWS, $IRR_capture_EVENTS, $IRR_VERTICAL_SYNC_Off)
_IrrSetWindowCaption( "IrrLicht Window")
_WinAPI_SetWindowRgn(WinGetHandle("IrrLicht Window", ""), _WinAPI_CreateRectRgn(3, 22, 640, 480)) ; Cut off IrrLicht Window Border

GUICtrlCreateButton("Hey1", 680, 40, 100, 22)
GUICtrlCreateButton("Hey2", 680, 80, 100, 22)
GUICtrlCreateButton("Hey3", 680, 120, 100, 22)


WinMove("IrrLicht Window", "", -3, -22)
_WinAPI_Setparent(WinGetHandle("IrrLicht Window", ""), $Gui)
WinActivate("AutoIt Window")

GUISetState()
;--------------------------------------------------------------------------------------------------------------------
;add your IrrLicht stuff here.....

WHILE _IrrRunning()

    _IrrBeginScene(128,128,128)
    _IrrDrawScene()
    _IrrEndScene()
    Sleep(5)


WEND

Func _exit()
    _IrrStop()
    Exit
EndFunc ; _exit
  • Like 1

Share this post


Link to post
Share on other sites
kokoilie

Actually now that I started playing with it and reversed the setparrent part so that the gui is child to the irrlicht render
so to hide the controls I don't want to see I just call GUISetState (@SW_HIDE)

Also the way I want to make it I don't even need to make the gui transparent while it's visible 

Share this post


Link to post
Share on other sites
Richard Robertson

That's actually a really interesting way to do that. Not the most efficient, but interesting nonetheless.

Share this post


Link to post
Share on other sites
andy2

It is working at my end too! Thanks for sharing it Werty.

Share this post


Link to post
Share on other sites
Luigi

Wow! This amazing!


Visit my repository

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  

  • Similar Content

    • GarnetDagger
      By GarnetDagger
      I would love to have some help or guidance 
      I am able to Query from my database but I am not able to Update or insert etc because I lack the knowledge for it
       
      this is my code for to retrieve some data from and works perfect
       
      Dim $ueberschriften = "" Dim $anzahl = 0 Dim $dsncount = 1 Global $DSN = "MTXXV5" Global $Query = "Select * from VIEWS" Func SSSQL($SSQuery) ;SuperSonicSQL     ConsoleWrite($SSQuery & @LF)     $cmboVal = ""     $adoCon = ObjCreate("ADODB.Connection")     $adoCon.Open($DSN)     $adoRs = ObjCreate("ADODB.Recordset")     $adoSQL = $SSQuery     $adoRs.CursorType = 2     $adoRs.LockType = 3     $adoRs.Open($adoSQL, $adoCon)     With $adoRs         Global $QueryAnswer = .GetRows     EndWith     Return $QueryAnswer EndFunc   ;==>SSSQL and this is my failed attempt, The Query is correct but I want to able to use it in autoit instead of have to manual update or insert into flamerobin
       
      $SS_SQL_Insert_or_Update = "INSERT INTO DETECTION (DNAME,DTYPE,WINNAME,AREA,COLOR,MOUSE) VALUES ('PopUpTradeInviteYes        s                    ','SEARCH','XXX','175,240,550,240,65,228,82,234','5062478','0') " Func SSSQLIU($SS_SQL_Insert_or_Update) ;SuperSonicSQL :P     $cmboVal = ""     $adoCon = ObjCreate("ADODB.Connection")     $adoCon.Open($DSN)     $adoRs = ObjCreate("ADODB.Record")     $adoSQL =$SS_SQL_Insert_or_Update ;~     $adoRs.CursorType = 2     $adoRs.LockType = 4     $adoRs.Open($adoSQL, $adoCon) ;~     With $adoRs ;~         Global $QueryAnswer = .GetRows ;~     EndWith ;~     Return $QueryAnswer EndFunc   ;==>SSSQL I am at a total loss and I am just trying this at random but I am also going to sleep now
      I would love to have some minor examples
      "C:\_CC_V10_DetectionTAB.au3" (174) : ==> The requested action with this object has failed.:
      $adoRs.Open($adoSQL, $adoCon)
      $adoRs^ ERROR
    • RichardL
      By RichardL
      Local $sAxName Local $oMSComm $sAxName = "MSCOMMLib.MSComm.1" $oMSComm = ObjCreate($sAxName) MsgBox(0, Default, StringFormat("Name: %s, Obj %d, Err %d", $sAxName, IsObj($oMSComm), @error)) I'm talking to serial ports (for Arduino) using the MSComm object.  It all runs fine from SciTE or .exe.  If I compile to .a3x the object is not created.  I could manage without .a3x but I like it because it compiles faster.
       
       
    • BobRoss
      By BobRoss
      Hi All,
      Now before I start, I have trawled through the forum & elsewhere for the last 24 hours or so & found nothing to even point me in the right direction.
      I have a rather large script that's doing various (AD reads & applying RegWrites based on the SID & AD reads....) & I've stripped it all back & the problem appears to lie with the create object which is calling a sproc I wrote to pull back various based on params passed.
      Now for the actual issue, all worked fine first time everywhere apart from within a Citrix xenapp session which is when I'm getting hit with the Exception Occured Script Line -1 - Variable must be of type 'Object'.
      Here is a stripped back portion which I've been testing with against xenapp (with a MsgBox added to easily see if anything did return), can anyone notice anything glaringly stupid that I'm doing?
      Global $AppError = ObjEvent("AutoIt.Error","ErrFunc") $Emp=@UserName $adDSN="Driver={SQL Server};Server=*****;Database=*****;Uid=****;Pwd=*****" $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ($adDSN) $FNsQuery = "exec [ooo_sp_ad_user] @user="&$Emp&",@type=1" $FNresult = $adCN.Execute($FNsQuery) $ADFirstName=$FNresult.Fields("").Value MsgBox(0, "AD Test", $ADFirstName) $adCN.Close Func ErrFunc() Local $HexNumber Local $strMsg $HexNumber = Hex($AppError.Number, 8) $strMsg = "Error Number: " & $HexNumber & @CRLF $strMsg &= "WinDescription: " & $AppError.WinDescription & @CRLF $strMsg &= "Script Line: " & $AppError.ScriptLine & @CRLF MsgBox(0, "ERROR", $strMsg) SetError(1) Endfunc Any pointers at all would be greatly appreciated.
      Thanks
      Bob
    • AndyS01
      By AndyS01
      I have a test file that creates an Excel.Application object, and it works OK when I run it with F5, but when I compile it and run the executble, the operation fails.   Here is my code: Opt('MustDeclareVars', 1) Global $oMyError, $oExcel _Main() Exit (1) Func _Main() Local $str $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Initialize a COM error handler If IsObj($oMyError) Then $oExcel = ObjCreate("Excel.Application") If IsObj($oExcel) Then $str = "Created the Excel.Application object OK" Else $str = "ObjCreate() FAILED!" EndIf Else $str = "ObjEvent() FAILED!" EndIf MsgBox(0, "results", $str) EndFunc ;==>_Main Func MyErrFunc() Local $str $str = "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext ClipPut($str) MsgBox(0, "AutoItCOM Test", $str & @CRLF & "(results are in the clipboard)") Exit (1) EndFunc ;==>MyErrFunc Here is the error info:
      We intercepted a COM Error ! err.description is: err.windescription: Not enough storage is available to complete this operation. err.number is: 8007000E err.lastdllerror is: 0 err.scriptline is: -1 err.source is: err.helpfile is: err.helpcontext is:
    • afzalw
      By afzalw
      I have used the following code to open and close an excel file after working in it, but after the file is closed I checked the task manager it shows EXCEL.EXE * 32 in the process tab. Is there a way to remove this from task manager also when I close my excel workbook ?

      Thanks


      ; Open the already existing Excel File #include <Excel.au3> $oExcel = ObjCreate("Excel.Application") Local $sFilePath1 = @ScriptDir & "\Excel File.xlsm" ;This file should already exist Local $oExcel = _ExcelBookOpen($sFilePath1) ;Opening the file $oExcel.application.quit ;Closing the Excel Application
×