Scenic Ribbon won't show up in Delphi Form // Has anybody an idea? -


i've played little bit scenic ribbon api (windows ribbon framework). result:

program ribtest;  uses   windows,   messages,   activex,   comobj;  {$r 'e:\ribbon\test.res'}  type   ui_viewtype = (ui_viewtype_ribbon = 1);   ui_viewverb = (ui_viewverb_create = 0, ui_viewverb_destroy = 1,                   ui_viewverb_size = 2, ui_viewverb_error = 3);   ui_commandtype = (ui_commandtype_unknown = 0,                     ui_commandtype_group = 1,                     ui_commandtype_action = 2,                     ui_commandtype_anchor = 3,                     ui_commandtype_context = 4,                     ui_commandtype_collection = 5,                     ui_commandtype_commandcollection = 6,                     ui_commandtype_decimal = 7,                     ui_commandtype_boolean = 8,                     ui_commandtype_font = 9,                     ui_commandtype_recentitems = 10,                     ui_commandtype_coloranchor = 11,                     ui_commandtype_colorcollection = 12);    ui_executeverb = (ui_executionverb_execute = 0,                     ui_executionverb_preview = 1,                     ui_executionverb_cancelpreview = 2);      iuiribbon = interface   ['{803982ab-370a-4f7e-a9e7-8784036a6e26}']     function getheight(var cy: uint32): hresult; stdcall;     function loadsettingsfromstream(stream: istream): hresult; stdcall;     function savesettingstostream(stream: istream): hresult; stdcall;    end;    iuisimplepropertyset = interface   ['{c205bb48-5b1c-4219-a106-15bd0a5f24e2}']     function getvalue(key: tpropertykey; var value: tpropvariant): hresult; stdcall;   end;    iuicommandhandler = interface   ['{75ae0a2d-dc03-4c9f-8883-069660d0beb6}']     function execute(commandid: uint32; verb: ui_executeverb; key: tpropertykey;                       value: tpropvariant; execprops: iuisimplepropertyset): hresult; stdcall;     function updateproperty(commandid: uint32; key: tpropertykey; currvalue: tpropvariant;                             var newvalue: tpropertykey): hresult; stdcall;    end;    iuiapplication = interface   ['{d428903c-729a-491d-910d-682a08ff2522}']     function onviewchanged(viewid: uint32; typeid: ui_viewtype; view: iunknown;                           verb: ui_viewverb; reasoncode: int32): hresult; stdcall;     function oncreateuicommand(commandid: uint32; typeid: ui_commandtype;                               commandhandler: iuicommandhandler): hresult; stdcall;     function ondestroyuicommand(commandid: uint32; typeid: ui_commandtype;                                commandhandler: iuicommandhandler): hresult; stdcall;   end;    ui_invalidations = (ui_invalidations_state = 1, ui_invalidations_value = 2,                       ui_invalidations_property = 4, ui_invalidations_allproperties = 8);    iuiframework = interface   ['{f4f0385d-6872-43a8-ad09-4c339cb3f5c5}']     function initialize(framewnd: hwnd; app: iuiapplication): hresult; stdcall;     function loadui(instance: cardinal; recname: lpcwstr): hresult; stdcall;     function getview(viedid: uint32; riid: tiid; var ppv: pointer): hresult; stdcall;     function getuicommandproperty(commandid: uint32; key: tpropertykey;                       var value: tpropvariant): hresult; stdcall;     function setuicommandproperty(commandid: uint32; key: tpropertykey;                       value: tpropvariant): hresult; stdcall;     function invalidateuicommand(commandid: uint32; flags: ui_invalidations;                       const key: ppropertykey): hresult; stdcall;     function flushpendinginvalidations: hresult; stdcall;     function setmodes(imodes: int32): hresult; stdcall;    end;    ttest = class(tinterfacedobject, iuiapplication)   public     function onviewchanged(viewid: uint32; typeid: ui_viewtype; view: iunknown;                           verb: ui_viewverb; reasoncode: int32): hresult; stdcall;     function oncreateuicommand(commandid: uint32; typeid: ui_commandtype;                               commandhandler: iuicommandhandler): hresult; stdcall;     function ondestroyuicommand(commandid: uint32; typeid: ui_commandtype;       commandhandler: iuicommandhandler): hresult; stdcall;    end;  const   clsid_uiribbonframework: tguid = '{926749fa-2615-4987-8845-c33e65f2b957}';  var   myapp: ttest;   meinhandle: hwnd;   tmpframew: iuiframework;   function wndproc(hwnd: hwnd; umsg: uint; wparam: wparam; lparam: lparam): lresult; stdcall; var   res: hresult; begin   result := 0;   case umsg of     wm_create:       begin         coinitialize(nil);         cocreateinstance(clsid_uiribbonframework, nil, clsctx_inproc_server,                            iuiframework, tmpframew);           if succeeded(tmpframew.initialize(hwnd, iuiapplication(myapp)))           begin             res := tmpframew.loadui(hinstance, pchar('application_ribbon'));             if not succeeded(res)then                 sleep(5);           end;       end;     wm_destroy:       begin         postquitmessage(0);       end;   else     result := defwindowproc(hwnd, umsg, wparam, lparam);   end; end;   var   wc: twndclassex;   msg: tmsg; { ttest }  function ttest.oncreateuicommand(commandid: uint32; typeid: ui_commandtype;   commandhandler: iuicommandhandler): hresult; begin   result := e_notimpl; end;  function ttest.ondestroyuicommand(commandid: uint32; typeid: ui_commandtype;   commandhandler: iuicommandhandler): hresult; begin   result := e_notimpl; end;  function ttest.onviewchanged(viewid: uint32; typeid: ui_viewtype;   view: iunknown; verb: ui_viewverb; reasoncode: int32): hresult; begin   result := e_notimpl; end;  begin   myapp := ttest.create;    wc.cbsize := sizeof(twndclassex);   wc.style := 0;   wc.cbclsextra := 0;   wc.cbwndextra := 0;   wc.hbrbackground := color_window;   wc.lpszmenuname := nil;   wc.lpszclassname := 'meinribbon';   wc.hiconsm := 0;   wc.hinstance := hinstance;   wc.hicon := loadicon(hinstance, makeintresource(1));   wc.hcursor := loadcursor(0, idc_arrow);   wc.lpfnwndproc := @wndproc;   registerclassex(wc);    meinhandle := createwindow('meinribbon', 'testapp',                  ws_overlapped or ws_clipchildren or ws_sysmenu or ws_caption,                 integer(cw_usedefault), 0, integer(cw_usedefault), 0, hwnd_desktop,                 0, hinstance, nil);    showwindow(meinhandle, sw_shownormal);   updatewindow(meinhandle);     while true   begin     if not getmessage(msg, 0, 0, 0) break;     translatemessage(msg);     dispatchmessage(msg);   end;    exitcode := getlasterror; end. 

everything runs without error. i've made resource ribbon binary xml definition , got linked correctly executable. window appears without ribbon.

the important part in wndproc. framework gets initialized tmpframew.initialize (seems correct). reference counter of myapp (it's iuiapplication implementation) increases. call tmpframew.loadui ribbon definition should loaded. there no error in call (result 0 , no exception raises) reference counter of myapp decreases.

that's happens... have idea i'm doing wrong?

i've found error...

  1. i'm not familiar c or c++. (i guess) therefore i've overlooked asterisks , out's. there incorrect params leads minor bugs.
  2. but main problem header file. in uiribbon.h function iuiframework.destroy missing. in online sdk , in uiribbon.idl function defined. added interface , works expected.

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -