Sign in to follow this  
Followers 0
momitty

Can I embed something opened from ObjCreate?

21 posts in this topic

I'm working on an application that will in the end be a shell for multiple browsers. I've figured out (I should say other cooler people on this forum like quaizywabbit) how to use a DLL called cwebpage.dll open, and how to open multiple instances of it.... but the downfall is there is no copy and paste functionality. I am really going to need that. So, I see that you can create objects....

My question is, can I embed one of those (Internet Explorer specifically, but who knows later on) into a GUI? So it looks like it's part of the program?

Share this post


Link to post
Share on other sites



You would need to use the CreateWindow functionality from DllCall and then make that window a child of your gui. Look at this site:

http://thecodeproject.com/java/javacom.asp

Even though it uses java, you can still use the info there to embed an internet explorer object. The main problem is not creating it, but controlling it. You would need an interface to control it so much as even changing the URL.

I have found an alternative way of controlling IE windows that you can use. See my post here:

#79588


Who else would I be?

Share this post


Link to post
Share on other sites

Which DLL file do I actually call?

Share this post


Link to post
Share on other sites

Sorry bud, but I have so little time now to give to autoit that I can't give you a good answer. You will have to search yourself.


Who else would I be?

Share this post


Link to post
Share on other sites

I will be a lot of code is you start creating windows with a dllcall.

If your application need to create multiple windows you can use GUICreate up to 1024

if part of those need to be child window just use the $ws_child style

Share this post


Link to post
Share on other sites

But I can't use GUICreate to create an Internet Explorer window can I?

Anyway, back to the DLLCall.... does anybody know what parameters need to go in there....

$result = DllCall("user32.dll", "int", "CreateWindow".........???

Share this post


Link to post
Share on other sites

That stuff doesn't mean too much to me...

$result = DllCall("user32.dll", "int", "CreateWindow", "LPCTSTR", "InternetExplorer.Application", "LPCTSTR", "Internet Explorer", "DWORD", "WS_CHILD", 0,0,500,500,"hwnd", $hwnd, "hmenu", "", "hinstance" , "", lpvoid, "")

I can't test this right now because I'm not at my development machine, but does this look somewhat right?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

The "InternetExplorer.Application" should be changed to "AtlAxWin" and the "Internet Explorer" should be changed to "Shell.Explorer.1" at the very least. You also have another couple of errors like the fach that WS_CHILD is not a string, but a hex value. You need to include the guiconstants and add $WS_CHILD instead. All the information on how to od this is in the first link I sent you to. As long as you get pretty close to the information there, I would say that you have a fighting chance.

Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

Wait, if your looking to embed "cwebpage.dll" into a GUI, it is easy. If this is what you're interested in, please, look on.

After you have created your GUI, and want to add the browser to it, you would do this:

DllCall("cwebpage.dll", "long", "EmbedBrowserObject", "hWnd", $HWND)

Replace "$HWND" with the handle of the window you want to embed the browser into, is that what you're looking for? (Sorry, I didn't read this whole post...)


FootbaG

Share this post


Link to post
Share on other sites

Although the Internet Explorer ActiveXObject is the main focus of this part of the discussion, the main point is to be able to embed activexobjects of all sorts, inluding media players, flash, and others.


Who else would I be?

Share this post


Link to post
Share on other sites

cwebpage.dll is what I'm trying to avoid because it doesn't support copy and paste. And as this-is-me pointed out, it would be nice to know how to embed other objects

I tried this code and still nothing:

$result = DllCall("user32.dll", "int", "CreateWindow", "LPCTSTR", "AtlAxWin", "LPCTSTR", "Shell.Explorer.1", "DWORD", "0x40000000", 0,0,0,0, "hwnd", $hwnd, "hmenu", "", "hinstance" , "", "lpvoid", "")

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

what is a LPCTSTR, DWORD, HMENU, HINSTANCE and LPVOID type?

Looking back through this function specification (from MSDN) and the documentation on DllCall it says to specify the type and then the parameter....

HWND CreateWindow(

LPCTSTR lpClassName,

LPCTSTR lpWindowName,

DWORD dwStyle,

int x,

int y,

int nWidth,

int nHeight,

HWND hWndParent,

HMENU hMenu,

HINSTANCE hInstance,

LPVOID lpParam

);

so....

With AutoIt's limited set of types that are valid how can I make that work?

As you can tell I've done zero Windows programming, which is why this AutoIt GUI stuff is great. I can build simple little scripts that look like windows programs.

Edited by momitty

Share this post


Link to post
Share on other sites

Currently not supported in the release version, the beta has the DllStruct functions

and you would need to learn how to build structs and pointers.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

I've got the latest beta. Can it be achieved with that?

Share this post


Link to post
Share on other sites

Creating a window with API through AutoIt, if it's possible, would be masochistic. Even seasoned C programmers don't do that. They use templates or let the IDE create the code.


AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.

Share this post


Link to post
Share on other sites

Yeah, this isn't the preferred way to do it, but I don't know if there's any other way to accomplish what I'm trying to do.

As far as the DLLStruct, the examples in the documentation and online don't explain much. I'm not even really sure how to use them exactly.

On this one example they did this....

$p = DllStructCreate("dword")

and then in the dllcall it was like....

DLLCall("Advapi32.dll","long","RegQueryInfoKey",_

"int",0x80000000,_

"ptr",0,_

"ptr",0,_

"ptr",0,_

"ptr",DllstructGetPtr($p),_

"ptr",0,_

"ptr",0,_

"ptr",0,_

"ptr",0,_

"ptr",0,_

"ptr",0)

Obviously this isn't the same dll I'm trying to use, but I don't see that any data was put into that Struct. Or what $p is even really representing besides maybe an empty pointer??

Like in my case I have something like this:

$p = DllStructCreate("dword")

$result = DllCall("user32.dll", "HWND", "CreateWindow", _

"lpClassName", "AtlAxWin", _

"lpWindowName", "shell.explorer.1", _

"ptr", $p, _

"int", 10, _

"int", 10, _

"int", 500, _

"int", 500, _

"HWND", $hwnd, _

"hMenu", "", _

"hInstance", "", _

"lpParam", "")

$p should be representing the style in this case. But how do I set it to?

THANKS to everybody for their replies thus far!!!

Share this post


Link to post
Share on other sites

I'm back at it. I took what was on that other thread, and modified it. At first I had the white box, but as soon as I substituted in the information for Internet Explorer I didn't have anything...

#include <guiconstants.au3>
$ID_LISTVIEW = 100
$parhwnd = GuiCreate("Test")
$hInst = DLLCall("kernel32.dll","hwnd","GetModuleHandle","str", "")
$listhwnd = DllCall("user32.dll", "hwnd", "CreateWindowEx", "str", "AtlAxWin", "str", "Shell.Explorer.1", _
                  "str", "", "int", BitOr($WS_CHILD, $WS_VISIBLE), _
                  "int", 0, "int", 0, "int", 300, "int", 300, "hwnd", $parhwnd, _
                  "hwnd", $ID_LISTVIEW, "hwnd", $hInst[0], "ptr", 0)
guisetstate()
sleep(5000)

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