Instead, use the MSXML2.XMLHTTP object and use the SetRequestHeader() method to set a referer.
E.g.
Code: Select all
myHTTPObject\Invoke("SetRequestHeader('referer', 'http://www.microsoft.com')")
(Untested.)
Code: Select all
myHTTPObject\Invoke("SetRequestHeader('referer', 'http://www.microsoft.com')")
Code: Select all
If OpenWindow(0, 302, 15, 600, 300, "WebGadget Header Test", #PB_Window_SystemMenu | #PB_Window_TitleBar )
WebGadget(#Web_Gadget, 20, 20, 560, 215, "")
ButtonGadget(#Button_Start, 20, 250, 110, 40, "Start")
browser = COMate_WrapCOMObject(GetWindowLong_(GadgetID(#Web_Gadget), #GWL_USERDATA))
EndIf
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_Gadget
Select EventGadget()
Case #Button_Start
referer$ = "'referer : http://www.msn.com$000d$000a'" ;#CRLF$
browser\Invoke("Navigate('http://www.stardrifter.org/cgi-bin/ref.cgi', #empty, '_self', #empty, " + referer$ + ")")
EndSelect
EndSelect
Until EventID = #PB_Event_CloseWindow
browser\Release()
End
Code: Select all
IncludePath "..\"
XIncludeFile "COMatePLUS.pbi"
;-Safe array structures - taken from "VariantHelper_Include.pb"
;==============================================================
Structure SAFEARRAYBOUND
cElements.l
lLbound.l
EndStructure
Structure SAFEARRAY
cDims.w
fFeatures.w
cbElements.l
cLocks.l
*pvData.pData
rgsabound.SAFEARRAYBOUND[0]
EndStructure
;-Set up a 2-d safearray of signed integers of dimensions 20 by 20.
;==================================================================
;Begin with an array of SAFEARRAYBOUND structures; one for each dimension.
Dim safeArrayBound.SAFEARRAYBOUND(2)
With safeArrayBound(0)
\lLbound = 1
\cElements = 20
EndWith
With safeArrayBound(1)
\lLbound = 1
\cElements = 20
EndWith
;Now create the array and check for success.
*safeArray.SAFEARRAY = SafeArrayCreate_(#VT_I4, 2, @safeArrayBound())
If *safeArray = 0
MessageRequester("COMate -Excel 2-d Safearray demo!", "Couldn't create the Safearray!")
End
EndIf
;Populate the array.
Dim indices(1)
For i = 1 To 20
For j = 1 To 20
indices(0) = i
indices(1) = j
temp = 20*(i-1)+j
SafeArrayPutElement_(*safeArray, @indices(), @temp)
Next
Next
;Bundle the Safearray up into a variant suitable for passing to a COM method.
Define var.VARIANT
With var
\vt = #VT_ARRAY|#VT_I4
\parray = *safeArray
EndWith
;-Fire up Excel and load cells from the array in one go.
;=======================================================
Define.COMateObject ExcelObject, WorkBook
ExcelObject = COMate_CreateObject("Excel.Application")
If ExcelObject
If ExcelObject\SetProperty("Visible = #True") = #S_OK
WorkBook = ExcelObject\GetObjectProperty("Workbooks\Add")
If WorkBook
ExcelObject\SetProperty("Range('A1:T20') = " + Str(var) + " as variant")
ExcelObject\Invoke("Quit()")
WorkBook\Release()
EndIf
EndIf
ExcelObject\Release()
Else
MessageRequester("COMate -Excel demo", "Couldn't create the application object!")
EndIf
;Now free the Safearray. Either use SafeArrayDestroy_() or VariantClear_() on any variant containing the array.
VariantClear_(var)
Code: Select all
http://msdn.microsoft.com/en-us/library/dd378402(VS.85).aspx
Code: Select all
#COMATE_NOINCLUDEATL = #True
IncludePath #PB_Compiler_Home+"COMatePLUS\"
IncludeFile "COMatePLUS.pbi"
IncludePath ""
Procedure.s StrGUID(*GUID.GUID)
Protected GUID$, Seperator$ = "-"
If *GUID
GUID$ = Right(Hex(*GUID\Data1), 8)
GUID$ + Seperator$+Right(Hex(*GUID\Data2), 4)
GUID$ + Seperator$+Right(Hex(*GUID\Data3), 4)
GUID$ + Seperator$+Right(Hex(*GUID\Data4[0]), 2)+Right(Hex(*GUID\Data4[1]), 2)
GUID$ + Seperator$+Right(Hex(*GUID\Data4[2]), 2)+Right(Hex(*GUID\Data4[3]), 2)+Right(Hex(*GUID\Data4[4]), 2)+Right(Hex(*GUID\Data4[5]), 2)+Right(Hex(*GUID\Data4[6]), 2)+Right(Hex(*GUID\Data4[7]), 2)
ProcedureReturn "{"+GUID$+"}"
EndIf
ProcedureReturn ""
EndProcedure
Interface IObjectArray
GetAt(uiIndex, riid, *ppv)
GetCount(*pcObjects)
EndInterface
Interface ICustomDestinationList
AbortList()
AddUserTasks(*poa.IObjectArray)
AppendCategory(pszCategory.p-unicode, *poa.IObjectArray)
AppendKnownCategory(category)
BeginList(*pcMinSlots, riid, *ppv)
CommitList()
DeleteList(pszAppID.p-unicode)
GetRemovedDestinations(riid, *ppv)
SetAppID(pszAppID.p-unicode)
EndInterface
Debug COMate_GetIIDFromName("ICustomDestinationList", @IID.GUID)
Debug StrGUID(@IID)
If OpenWindow(0, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
Debug COMate_CreateObject("ICustomDestinationList")
Debug COMate_GetLastErrorDescription()
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
EndIf
Code: Select all
0
{6332DEBF-87B5-4670-90C0-5E57B48A49E}
0
Invalid progID/CLSID. Check your spelling of the programmatic identifier. Also check that the component / ActiveX control has been registered.
Code: Select all
GUID$ = StrGUID(@IID)
myObject.COMateObject = COMate_CreateObject(GUID$)
Code: Select all
ICustomDestinationList *pcdl;
HRESULT hr = CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl));
Code: Select all
pcdl.ICustomDestinationList
CoCreateInstance_(?CLSID_DestinationList, 0, #CLSCTX_INPROC_SERVER, ?IID_iCustomDestinationList, @pcdl)