WebGadget DocumentComplete event

Just starting out? Need help? Post your questions and find answers here.
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post by NoahPhense »

Here is the full CPP Project, including the Workspace, etc.

Click to Download

- np
ern
New User
New User
Posts: 6
Joined: Sun May 09, 2004 1:18 am
Location: greensboro, nc usa

Post by ern »

I too would like too know what the WebGadget is up to sometimes, and I feel like I've been to some of the places y'all have, trying to find out.

For what it's worth, with reference strictly to (Word) "Documents", I had some luck with the following code:

***********************************************************
;Sorry, I don't know how this code will show up if copied to your system.

If OpenWindow(0, 0, 0, 1000,1000, #PB_Window_SystemMenu|#PB_Window_Screencentered, "View Word document(s)...")
If CreateGadgetList(WindowID())
File$ = OpenFileRequester("Choose file(s)", "C:\", "MS Word Documents (*.doc)|*.doc", 0,#PB_Requester_MultiSelection)

WebGadget(1, 0,0, 1000, 1000, "File://"+File$) ;maybe "File://" tells browser not to look for connection

Repeat
Event = WaitWindowEvent()
Debug event
If Event=#PB_EventRepaint
Delay(3000)
SetGadgetText(1,NextSelectedFileName())
EndIf

Until Event = #PB_EventCloseWindow ;THIS (by going to End) will close WinWord, Debugger/Quit will not

EndIf
EndIf
FreeGadget(1)
End


;Note: (Per Freak) on the first run, the file might take a little time before displaying,
;because the webgadget needs to load the MS-word file display thingy first.
;Subsequent displays should be faster, then.

*************************************************************

The key point here is "simply" Repaint, which (simply) refers to a mixture of my naive understanding of the issues with the ideosyncracies of Microsoft's Webbrowser.

In some way, though, I think, this and the Web Browser threads are related to a thread (maybe mis)titled "Message 275 (1792 on similar projects)": viewtopic.php?t=10802&highlight=messages

I thank you recent posters for confirming that the problem was not, solely, with my feeble mind; and again, I thank the respondents, especialy fweil,to my earlier questions.
soerenkj
User
User
Posts: 95
Joined: Mon Jun 14, 2004 10:19 pm

Post by soerenkj »

Sparkie, I posted a function here:
viewtopic.php?t=11292
that might help you figure out which events you are receiving, although, most likely not, if they are some specially defined ones..
I'm looking very much forward to see how you get these events.
I did try to look at the code you linked to but I really cannot stand looking at c++-code anymore since I discovered the beauty that is PureBasic..! (fx why are there so many files in these packages....?!?)

ern, I'm sorry but I don't get what you are trying to say..
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Sorry to say soerenkj, that your function does us no good here. (Nice work by the way :) )

Here's where I'm stuck...

Code: Select all

_variant_t varID( "myID", VT_BSTR );
_variant_t varIdx( 0, VT_I4 );

    hr = pElemColl->item( varID, varIdx, &pElemDisp )
I think _variant_t varID() converted to PB is

Code: Select all

varId.Variant
pElemColl->item( varID, varIdx, &pElemDisp ) converted to PB

Code: Select all

pElemColl\item(varID, varIdx, @pElemDisp.IDispatch)
Just can't get the variant's to cooperate :evil:
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
soerenkj
User
User
Posts: 95
Joined: Mon Jun 14, 2004 10:19 pm

Post by soerenkj »

hi Sparkie, there is no Variant structure defined in my PureBasic..!?
did you just yourself define it like the microsoft VARIANT structure? :
http://msdn.microsoft.com/library/defau ... 6_7zdz.asp

but according to msdn _variant_t is a *class* that incapsulates this VARIANT structure. And they are saying that the VARIANT structure cannot be passed by reference (I don't know if that is enforced in VC++? but I guess not in PB..)

I don't know how we can make something equivalent to the class constructions in PB.. especially when the _variant_t doesn't even have any constructor that takes a string (char pointer?) as it's first arguement, according to http://msdn.microsoft.com/library/defau ... iant_t.asp
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post by NoahPhense »

@sparkie
There are a couple usages of the variant here on the forums. You might
search around.. The variant structures that I have looked at on here are
VERY scary.. ;) But someone has already created em.

- np
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Thanks guys. I've seen just about every post here on Variants as well as many, many, many web pages. I am taking a break from Variants for a day or 2 then I'll come back with a clear head. 8)

Thanks for all the guidance along the way :)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
ern
New User
New User
Posts: 6
Joined: Sun May 09, 2004 1:18 am
Location: greensboro, nc usa

Post by ern »

Ignoring all other issues about the WebBrowser, I meant that if the "document" (a nebulous term in MSspeak- see http://msdn.microsoft.com/workshop/brow ... cument.asp? ) in question is an MSWord document; a #PB_EventRepaint message seems to come back to the PureBasic program when the document is complete.

By complete, I mean a "done deal" such that I can see it on the screen, and my program can proceed smoothly to another (multi)selected "document" without any intervention on my part.

On another hand; if the "document" is a JPEG image, a WM_Timer message(#275, I think) seems to come back to PureBasic.

Admittedly, I didn't get far enough in my investigations to understand what Microsoft defines or supposes "DocumentComplete" to mean.
pantsonhead
User
User
Posts: 39
Joined: Fri Mar 26, 2004 1:47 pm
Location: London, UK
Contact:

What, no updates?

Post by pantsonhead »

Any more progress Sparkie?
I'm interested to see how this goes....
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Progress report:

1. Was able to lose about 4 to 5 more hours of my life while reading about Variants :evil:
2. Was able to burn and destroy about 3 more brain cells 8O
3. Discovered I still have room for more gray hairs 8)
4. Learned that our cat doesn't know anything about Variants either :roll:

Not to worry though, I am persistant with loads of patience. It's only a matter of time until we overcome this beast knows as the Variant. :P
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
soerenkj
User
User
Posts: 95
Joined: Mon Jun 14, 2004 10:19 pm

Post by soerenkj »

hi, I just returned from my holiday in Barcelona... sorry to see, that no solution has been found yet..
but anyway, Sparkie, could you post the code you made until now - you were saying you were able to see events coming from the 'IWebBrowser2-object'..? (I guess it should be possible to figure out which events they are..)
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Welcome back soerenkj :)

I'm not sure I still have that code intact. I have about 30 different variations of code that I was working on. I'll go back in time and see if I can dig that one out.

If I remember correctly, the events I was seeing were not actually webgadget related. That's what led me to the point where I am now, stuck on VARIANTS. :evil:
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Post by NoahPhense »

lol yeah .. someone said the word variant.. and everyone finally got
around to working on one of their old projects.. imagine that.. lol
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

I knew we were in trouble after I saw this post from freak. :(

I haven't given up on this but right now most of my time is being spent on another project. :wink:
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
soerenkj
User
User
Posts: 95
Joined: Mon Jun 14, 2004 10:19 pm

Post by soerenkj »

Sparkie, did you see this post:

viewtopic.php?t=11031&highlight=interface+generator

looks like aXend understands that variant stuff..!
Post Reply