trancexx Posted July 24, 2013 Author Posted July 24, 2013 Win7 x64 SP1There are no additional dependencies. Only three files from the zip file (being in the same folder) are needed for the example to work. I can't try now but really, it should work. Did you try 32 bit AutoIt or only x64 version? ♡♡♡ . eMyvnE
UEZ Posted July 24, 2013 Posted July 24, 2013 For me it works properly on my Win7 x64 notebook running it in both versions (x64 and x86). AutoIt version: 3.3.8.1 and AutoIt Object version: 1.2.7.0 Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
spudw2k Posted July 24, 2013 Posted July 24, 2013 I didn't think about the version differences. Turns out both work after I re-installed AutoIt. Thanks and looks great btw! Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
cyberbit Posted July 25, 2013 Posted July 25, 2013 (edited) Seems like a great project, but ribbon will not appear on XPro SP3. Not surprising. EDIT: Tried it on my home system (Win7 HP x64), works great! Very nice. Edited July 26, 2013 by cyberbit _ArrayConcatenate2D · Aero Flip 3D · EPOCH (destroy timestamps) · File Properties Modifier · _GetFileType · UpdateEngine<new> · In-line Case (_ICase) <new> [hr] 50% of the time, it works all the time. -PezoFaSho
MachinistProgrammer Posted August 6, 2013 Posted August 6, 2013 Will this be developed into a UDF (for those that aren't so good with with that kind of code) All my projects live on github
Andreik Posted August 7, 2013 Posted August 7, 2013 (edited) Looking at a C++ example (example is to set the global color) and based on what I saw in your other example functions I tried to get the global color of the ribbon but I can get this work. CComPtr<IPropertyStore> spPropertyStore; // _spFramework is a pointer to the IUIFramework interface that is assigned // when the Ribbon is initialized. if (SUCCEEDED(_spFramework->QueryInterface(&spPropertyStore))) { PROPVARIANT propvarBackground; PROPVARIANT propvarHighlight; PROPVARIANT propvarText; // UI_HSBCOLOR is a type defined in UIRibbon.h that is composed of // three component values: hue, saturation and brightness, respectively. UI_HSBCOLOR BackgroundColor = UI_HSB(0x14, 0x38, 0x54); UI_HSBCOLOR HighlightColor = UI_HSB(0x00, 0x36, 0x87); UI_HSBCOLOR TextColor = UI_HSB(0x2B, 0xD6, 0x00); InitPropVariantFromUInt32(BackgroundColor, &propvarBackground); InitPropVariantFromUInt32(HighlightColor, &propvarHighlight); InitPropVariantFromUInt32(TextColor, &propvarText); spPropertyStore->SetValue(UI_PKEY_GlobalBackgroundColor, propvarBackground); spPropertyStore->SetValue(UI_PKEY_GlobalTextColor, propvarText); spPropertyStore->Commit(); } Func _GetGlobalColor() Local $tIID_IPropertyStore = _AutoItObject_CLSIDFromString($sIID_IPropertyStore) Local $aCall = $oRibbFramework.QueryInterface(Number(DllStructGetPtr($tIID_IPropertyStore)), 0) Local $pPropertyStore = $aCall[2] Local $oPropertyStore = _AutoItObject_WrapperCreate($pPropertyStore, $dtagIPropertyStore) Local $tGUIDByte = _AutoItObject_DllStructCreate("byte Data[16]", _AutoItObject_CLSIDFromString("{00002000-7363-696e-8441798acf5aebb7}")) Local $tUI_PKEY_GlobalBackgroundColor = _AutoItObject_DllStructCreate("byte GUID[16]; dword PID;") $tUI_PKEY_GlobalBackgroundColor.GUID = $tGUIDByte.Data $tUI_PKEY_GlobalBackgroundColor.PID = 19 ; type = VT_UI4 $aCall = $oPropertyStore.GetValue($tUI_PKEY_GlobalBackgroundColor(), 0) If IsArray($aCall) And $aCall[2] <> 0 Then Return $aCall[2] EndFunc I'm confused about PROPVARIANT and UI_HSBCOLOR. Edited August 7, 2013 by Andreik
trancexx Posted August 7, 2013 Author Posted August 7, 2013 Rewrite the whole thing to use built-in functions instead of relying on AutoItObject. It's much simpler that way and things will start resolving themselves.I can write callback object function and PKEY related one if you want. ♡♡♡ . eMyvnE
Andreik Posted August 7, 2013 Posted August 7, 2013 When you say "whole thing" you mean all script or just this function?
FireFox Posted August 7, 2013 Posted August 7, 2013 (edited) @trancexxI see you suggest everyone to use the built-in object functions.However I can see in the helpfile for the ObjCreateInterface an experimental warning.Is it up to date? I mean you finished the function so it can be safely used?Br, FireFox. Edited August 7, 2013 by FireFox
trancexx Posted August 7, 2013 Author Posted August 7, 2013 Function can be safely used. It's not finished in parts which are not directly related to the functionallity but rather on validating input. Other things I wanted to add are really for additional user convenience and other parts of AutoIt needed updating before that. I can't say what Jon wants. Sometimes he makes completely wrong decisions, but it's highly unlikely he'll remove this function. That would be plain stupid.Use built-in function.@Andreik, yes the whole thing. ♡♡♡ . eMyvnE
FireFox Posted August 7, 2013 Posted August 7, 2013 (edited) Ok, I got your message Edited August 7, 2013 by FireFox
trancexx Posted August 7, 2013 Author Posted August 7, 2013 Andreik UI_PKEY_GlobalBackgroundColor is defined as "{000007D0-7363-696e-8441-798acf5aebb7} 19" in string form. First part of the string is guid and other is dword pid. You can use PSPropertyKeyFromString to convert to struct form. Or you can do it manually with _WinAPI_GUIDFromString() and append dword value of pid. I'm not sure where you got the definition you have in your code. ♡♡♡ . eMyvnE
Andreik Posted August 7, 2013 Posted August 7, 2013 Thanks for tips, PSPropertyKeyFromString works nice but I get a COM error when I use GetValue method from IPropertyStore. COM Error, ScriptLine(307) : Number 0x80004003 - Invalid pointer I suppose it's because I send 0 as PROPVARIANT (second parameter)??
trancexx Posted August 7, 2013 Author Posted August 7, 2013 (edited) Well when you ditch AutoItObject you will have this function for that: Func _GetGlobalColor() Local $oPropertyStore = ObjCreateInterface($oRibbFramework(), $sIID_IPropertyStore, $tagIPropertyStore) If @error Then Return SetError(1, 0, 0) $oPropertyStore.AddRef() Local $tPKEY = PSPropertyKeyFromString($sUI_PKEY_GlobalBackgroundColor) Local $iColor If $oPropertyStore.GetValue($tPKEY, $iColor) Then Return SetError(2, 0, 0) Return $iColor EndFunc ...and IPropertyStore definition will be: ;=============================================================================== #interface "IPropertyStore" Global Const $sIID_IPropertyStore = "{886d8eeb-8cf2-4446-8d02-cdba1dbdcf99}" Global Const $tagIPropertyStore = _ "GetCount hresult(dword*);" & _ "GetAt hresult(dword;ptr*);" & _ "GetValue hresult(struct*;variant*);" & _ "SetValue hresult(struct*;variant*);" & _ "Commit hresult();" ;=============================================================================== ...and it will work just fine. Edited August 7, 2013 by trancexx ♡♡♡ . eMyvnE
Andreik Posted August 7, 2013 Posted August 7, 2013 Func _GetGlobalColor() Local $sUI_PKEY_GlobalBackgroundColor = "{000007D0-7363-696e-8441-798acf5aebb7} 19" Local $oPropertyStore = ObjCreateInterface($sCLSID_UIRibbonFramework, $sIID_IPropertyStore, $dtagIPropertyStore) If @error Then Return SetError(1, 0, 0) $oPropertyStore.AddRef() $tPROPERTYKEY = DllStructCreate("BYTE GUID[16]; DWORD PID") DllCall("propsys.dll","ulong","PSPropertyKeyFromString","wstr",$sUI_PKEY_GlobalBackgroundColor,"ptr",DllStructGetPtr($tPROPERTYKEY)) ConsoleWrite(DllStructGetData($tPROPERTYKEY,"GUID") & @CRLF) ConsoleWrite(DllStructGetData($tPROPERTYKEY,"PID") & @CRLF) Local $iColor If $oPropertyStore.GetValue(DllStructGetPtr($tPROPERTYKEY), $iColor) Then Return SetError(2, 0, 0) Return $iColor EndFunc The structure is filled with correct informations as I can see in console but when the method GetValue is called I get the same error.
trancexx Posted August 7, 2013 Author Posted August 7, 2013 Here, try this RibbonExample_BUILTIN.au3 When you click "Stop" color you want will get printed to console. Is that it? ♡♡♡ . eMyvnE
Andreik Posted August 7, 2013 Posted August 7, 2013 >>>GlobalColor = 00F57F96 Yes, it works great. Thank you! PS: did you notice the fail closing the application from menu?
trancexx Posted August 7, 2013 Author Posted August 7, 2013 Yes, it works great. Thank you! PS: did you notice the fail closing the application from menu? No I haven't. Now that you mention it makes sense to fail, right? It's the same thing as delete this; ... in C++. After releasing objects they shouldn't be accessed in any way. My bad. I'll fix that before updating the OP with the new code. ♡♡♡ . eMyvnE
Andreik Posted September 7, 2013 Posted September 7, 2013 I try to get the height of ribbon when it is created and I have as example a code from MSDN but don't work very well. expandcollapse popupSTDMETHODIMP CApplication::OnViewChanged( UINT viewId, UI_VIEWTYPE typeId, IUnknown* pView, UI_VIEWVERB verb, INT uReasonCode) { HRESULT hr = E_NOTIMPL; // Checks to see if the view that was changed was a Ribbon view. if (UI_VIEWTYPE_RIBBON == typeId) { switch (verb) { // The view was newly created. case UI_VIEWVERB_CREATE: _cwprintf(L"IUIApplication::OnViewChanged called with verb=CREATE\r\n"); if (NULL == g_pRibbon) /* g_pRibbon is a global pointer to the IUIRibbon object */ { // Retrieve and store the IUIRibbon hr = pView->QueryInterface(&g_pRibbon); } break; // The view was resized. // In the case of the Ribbon view, the application should call // GetHeight() to determine the height of the Ribbon. case UI_VIEWVERB_SIZE: _cwprintf(L"IUIApplication::OnViewChanged called with verb=SIZE\r\n"); // Call to the framework to determine the height of the Ribbon. if (NULL != g_pRibbon) { UINT uRibbonHeight; hr = g_pRibbon->GetHeight(&uRibbonHeight); } if (!SUCCEEDED(hr)) { //_cwprintf(L"IUIRibbon::GetHeight() failed with hr=0x%X\r\n", hr); } break; // The view was destroyed. case UI_VIEWVERB_DESTROY: //_cwprintf(L"IUIApplication::OnViewChanged called with verb=DESTROY\r\n"); g_pRibbon = NULL; hr = S_OK; break; } } return hr; } And what I tried: Func _MyUIApp_OnViewChanged($pSelf, $iViewId, $iTypeId, $pView, $iVerb, $iReason) #forceref $pSelf, $iViewId, $iTypeId, $pView, $iVerb, $iReason Switch $iVerb Case 0 ;UI_VIEWVERB_CREATE ConsoleWrite("UI_VIEWVERB_CREATE" & @CRLF) $oUnknown = ObjCreateInterface($pView,$sIID_IUnknown) $oUnknown.QueryInterface($g_pRibbon) Case 2 ;UI_VIEWVERB_SIZE ConsoleWrite("UI_VIEWVERB_SIZE" & @CRLF) Local $uRibbonHeight $g_pRibbon.GetHeight($uRibbonHeight) EndSwitch Return 0 ; S_OK EndFunc ;==>_MyUIApp_OnViewChanged What I'm doing wrong?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now