OLE Support?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

Does PB support OLE?, i need to use the InternetExplorer objet, the Webbrowser gadget does not serve my purpose because i have to send additional headers with the url, any solution?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Shawn.

Hi.

You might have a look at the Tips & Tricks thread called "OOP/COM Programming with PB -- Taskbar". I haven't had a chance to try it out yet.

Also, here is a link with some information from MS. You may find something useful here.

http://msdn.microsoft.com/workshop/brow ... _entry.asp

Shawn
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

Thank you, more or less i understand how it works, but i need to find the constants values.

The Class identifier(CLSID), and the interface identifier(IID) of the object are stored somewhere in the registry or in other files, how can i get them?

Also i need the values of the methods, like the Navigate method.

I founded some values on the net:
DataSection
CLSID_WebBrowser:
Data.l $8856f961
Data.w $340a,$11d0
Data.b $a9,$6b,$00,$c0,$4f,$d7,$05,$a2
IID_IWebBrowser:
Data.l $EAB22AC1
Data.w $30C1,$11CF
Data.b $A7,$EB,$00,$00,$C0,$5B,$AE,$0B
EndDataSection

but i still need the method values, where can i find all this values?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

You have to create the values yourself.
You can see the interface for the objects
in the C/C++ headers from the MS Platform SDK.

cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

I will post an example this evening, as I've already done it in PB. I'm at work for now so.. .

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

As promized, here is the code. It requiers the Atl.dll, but show the basics of the com interface:

Code: Select all

AtlAxWinInit_()

OpenWindow(0,0,0,600,400,#PB_Window_SystemMenu,"Test")
hwndChild = CreateWindowex_(#WS_EX_CLIENTEDGE,"AtlAxWin", "Shell.Explorer.1", #WS_CHILD|#WS_VISIBLE,0,0,400,100,WindowID(),0,GetModuleHandle_(0),0)
hwndChild2 = CreateWindowex_(0,"AtlAxWin", "Shell.Explorer.1", #WS_CHILD|#WS_VISIBLE,0,200,400,100,WindowID(),0,GetModuleHandle_(0),0)
Debug hwndChild2

;IUnknown *pUnk = NULL;
AtlAxGetControl_(hwndChild,@pUnk)
AtlAxGetControl_(hwndChild2,@pUnk2)

Debug pUnk

#QueryInterface =  0
#AddRef         =  4
#Release        =  8
#HrInit         = 12
#AddTab         = 16
#DeleteTab      = 20
#ActivateTab    = 24
#SetActiveAlt   = 28

#Navigate2 = 52*4
#GoHome = 9*4



If CallCOM(#QueryInterface, pUnk, ?IID_IWebBrowser2, @Browser) = #S_OK

  Debug Browser
  
  Structure Variant
    Type.w
    Reserved1.w
    Reserved2.w    
    Reserved3.w
    String.l
  EndStructure
      
  MultiByteToWideChar_(#CP_ACP, 0, "[url]http://www.purebasic.com[/url]", -1, AllocateMemory(0, 1000, 0), 1000)
  
  aa = sysallocstring_(MemoryID()) 
  aa = MemoryID()
  bb = sysallocstring_("")
  
  #VT_BSTR = 8
  
  a.Variant\Type = #VT_BSTR
  a\String = aa
  
  b.Variant\Type = #VT_BSTR
  b\String = bb

  
  CallCOM(#Navigate2, Browser, @a, 0,0,0,0,0) ;@b, @b, @b, @b)
  ;CallCOM(#GoHome, Browser)

EndIf

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

End

DataSection

IID_IWebBrowser2:
Data.l $D30C1661
Data.w $CDAF, $11d0
Data.b $8A, $3E, $00, $C0, $4F, $C9, $E2, $6E
Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Fred, hwndChild2 is (under Win98SE) only a white field.
Is this the way it should be?


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

Thank you Fred, it seems a complex code i'll have to study it..

Where did you get the navigate2 value?

It would be easier to use IE itself instead of encapsulating it inside a window?, i mean just using OLE to create an instance of IE and work with its methods an properties, outside of any window, with all its own buttons, menus, etc..
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Shawn.

It would be easier to use IE itself instead of encapsulating it inside a window?, i mean just using OLE to create an instance of IE and work with its methods an properties, outside of any window, with all its own buttons, menus, etc..
What sort of additional headers do you need to send?

Maybe there is a way you can do something simple like this:

Code: Select all

 
RunProgram("[url]http://www.purebasic.com[/url]", "", 0) 
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by merendo.

There is an example at Pauls site. Just look in the sippets part for "dragndrop" at: http://www.reelmediaproductions.com/pb

Cu @ll, merendo
--
Go as far as you can, and realize at last, that you are there again, where you have started your way.
Post Reply