static void make_explorer_window(IShellFolder* startFolder) { RECT explorerRect; HWND window; FOLDERSETTINGS fs; explorer_info *info; HRESULT hres; WCHAR explorer_title[100]; LoadStringW(explorer_hInstance,IDS_EXPLORER_TITLE,explorer_title, sizeof(explorer_title)/sizeof(WCHAR)); info = HeapAlloc(GetProcessHeap(),0,sizeof(explorer_info)); if(!info) { WINE_ERR("Could not allocate a explorer_info struct\n"); return; } hres = CoCreateInstance(&CLSID_ExplorerBrowser,NULL,CLSCTX_INPROC_SERVER, &IID_IExplorerBrowser,(LPVOID*)&info->browser); if(!SUCCEEDED(hres)) { WINE_ERR("Could not obtain an instance of IExplorerBrowser\n"); HeapFree(GetProcessHeap(),0,info); return; } window = CreateWindowW(EXPLORER_CLASS,explorer_title,WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT,DEFAULT_WIDTH, DEFAULT_HEIGHT,NULL,NULL,explorer_hInstance,NULL); fs.ViewMode = FVM_DETAILS; fs.fFlags = FWF_AUTOARRANGE; explorerRect.left = 0; explorerRect.top = 0; explorerRect.right = DEFAULT_WIDTH; explorerRect.bottom = DEFAULT_HEIGHT; IExplorerBrowser_Initialize(info->browser,window,&explorerRect,&fs); IExplorerBrowser_SetOptions(info->browser,EBO_SHOWFRAMES); SetWindowLongPtrW(window,EXPLORER_INFO_INDEX,(LONG_PTR)info); IExplorerBrowser_BrowseToObject(info->browser,(IUnknown*)startFolder, SBSP_ABSOLUTE); ShowWindow(window,SW_SHOWDEFAULT); UpdateWindow(window); }
static void make_explorer_window(IShellFolder* startFolder) { RECT explorerRect; HWND rebar,nav_toolbar; FOLDERSETTINGS fs; IExplorerBrowserEvents *events; explorer_info *info; HRESULT hres; WCHAR explorer_title[100]; WCHAR pathbox_label[50]; TBADDBITMAP bitmap_info; TBBUTTON nav_buttons[3]; int hist_offset,view_offset; REBARBANDINFOW band_info; memset(nav_buttons,0,sizeof(nav_buttons)); LoadStringW(explorer_hInstance,IDS_EXPLORER_TITLE,explorer_title, sizeof(explorer_title)/sizeof(WCHAR)); LoadStringW(explorer_hInstance,IDS_PATHBOX_LABEL,pathbox_label, sizeof(pathbox_label)/sizeof(WCHAR)); info = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(explorer_info)); if(!info) { WINE_ERR("Could not allocate a explorer_info struct\n"); return; } hres = CoCreateInstance(&CLSID_ExplorerBrowser,NULL,CLSCTX_INPROC_SERVER, &IID_IExplorerBrowser,(LPVOID*)&info->browser); if(FAILED(hres)) { WINE_ERR("Could not obtain an instance of IExplorerBrowser\n"); HeapFree(GetProcessHeap(),0,info); return; } info->rebar_height=0; info->main_window = CreateWindowW(EXPLORER_CLASS,explorer_title,WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT,DEFAULT_WIDTH, DEFAULT_HEIGHT,NULL,NULL,explorer_hInstance,NULL); fs.ViewMode = FVM_DETAILS; fs.fFlags = FWF_AUTOARRANGE; explorerRect.left = 0; explorerRect.top = 0; explorerRect.right = DEFAULT_WIDTH; explorerRect.bottom = DEFAULT_HEIGHT; IExplorerBrowser_Initialize(info->browser,info->main_window,&explorerRect,&fs); IExplorerBrowser_SetOptions(info->browser,EBO_SHOWFRAMES); SetWindowLongPtrW(info->main_window,EXPLORER_INFO_INDEX,(LONG_PTR)info); /*setup navbar*/ rebar = CreateWindowExW(WS_EX_TOOLWINDOW,REBARCLASSNAMEW,NULL, WS_CHILD|WS_VISIBLE|RBS_VARHEIGHT|CCS_TOP|CCS_NODIVIDER, 0,0,0,0,info->main_window,NULL,explorer_hInstance,NULL); nav_toolbar = CreateWindowExW(TBSTYLE_EX_MIXEDBUTTONS,TOOLBARCLASSNAMEW,NULL, WS_CHILD|WS_VISIBLE|TBSTYLE_FLAT,0,0,0,0,rebar,NULL, explorer_hInstance,NULL); bitmap_info.hInst = HINST_COMMCTRL; bitmap_info.nID = IDB_HIST_LARGE_COLOR; hist_offset= SendMessageW(nav_toolbar,TB_ADDBITMAP,0,(LPARAM)&bitmap_info); bitmap_info.nID = IDB_VIEW_LARGE_COLOR; view_offset= SendMessageW(nav_toolbar,TB_ADDBITMAP,0,(LPARAM)&bitmap_info); nav_buttons[0].iBitmap=hist_offset+HIST_BACK; nav_buttons[0].idCommand=BACK_BUTTON; nav_buttons[0].fsState=TBSTATE_ENABLED; nav_buttons[0].fsStyle=BTNS_BUTTON|BTNS_AUTOSIZE; nav_buttons[1].iBitmap=hist_offset+HIST_FORWARD; nav_buttons[1].idCommand=FORWARD_BUTTON; nav_buttons[1].fsState=TBSTATE_ENABLED; nav_buttons[1].fsStyle=BTNS_BUTTON|BTNS_AUTOSIZE; nav_buttons[2].iBitmap=view_offset+VIEW_PARENTFOLDER; nav_buttons[2].idCommand=UP_BUTTON; nav_buttons[2].fsState=TBSTATE_ENABLED; nav_buttons[2].fsStyle=BTNS_BUTTON|BTNS_AUTOSIZE; SendMessageW(nav_toolbar,TB_BUTTONSTRUCTSIZE,sizeof(TBBUTTON),0); SendMessageW(nav_toolbar,TB_ADDBUTTONSW,sizeof(nav_buttons)/sizeof(TBBUTTON),(LPARAM)nav_buttons); band_info.cbSize = sizeof(band_info); band_info.fMask = RBBIM_STYLE|RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_SIZE; band_info.hwndChild = nav_toolbar; band_info.fStyle=RBBS_GRIPPERALWAYS|RBBS_CHILDEDGE; band_info.cyChild=NAV_TOOLBAR_HEIGHT; band_info.cx=0; band_info.cyMinChild=NAV_TOOLBAR_HEIGHT; band_info.cxMinChild=0; SendMessageW(rebar,RB_INSERTBANDW,-1,(LPARAM)&band_info); info->path_box = CreateWindowW(WC_COMBOBOXEXW,PATH_BOX_NAME, WS_CHILD | WS_VISIBLE | CBS_DROPDOWN, 0,0,DEFAULT_WIDTH,PATHBOX_HEIGHT,rebar,NULL, explorer_hInstance,NULL); band_info.cyChild=PATHBOX_HEIGHT; band_info.cx=0; band_info.cyMinChild=PATHBOX_HEIGHT; band_info.cxMinChild=0; band_info.fMask|=RBBIM_TEXT; band_info.lpText=pathbox_label; band_info.fStyle|=RBBS_BREAK; band_info.hwndChild=info->path_box; SendMessageW(rebar,RB_INSERTBANDW,-1,(LPARAM)&band_info); events = make_explorer_events(info); IExplorerBrowser_Advise(info->browser,events,&info->advise_cookie); IExplorerBrowser_BrowseToObject(info->browser,(IUnknown*)startFolder, SBSP_ABSOLUTE); ShowWindow(info->main_window,SW_SHOWDEFAULT); UpdateWindow(info->main_window); IExplorerBrowserEvents_Release(events); }