Help with 'Could not find splitter cursor .....'
Daniel Keller dkeller@psln1.psln.com -- dkeller@psln.com Thursday, June 13, 1996 [Watcom C/C++ v10.6 - Win95 - MFC v3.2] Hi, My app uses a splitter window, if I compile it to use the MFC DLLs it works fine, but if I compile it to run alone it displays the cursor arrows pointing right and left (<--->), when I debug I it just says "Could not find splitter cursor - using system provided alternative. I have no Idea what is causing this. I have included my code. I also have a question about my code that is not directly related to MFC: at one point it is supposed to display a browse for folder dialog (by calling SHBrowseForFolder) but it never displays the dialog, at one point I am supposed to call "g_pMalloc->lpVtbl->Alloc(g_pMalloc,MAX_PATH)" but when I try to Compile this it says lpVtbl has not been declared so I changed it to "g_pMalloc->Alloc(MAX_PATH)". Any help on why this doesn't work or why "lpVtbl has not been declared" would be greatly appreciated. Thanks, Daniel. -- "Despite all my rage I am still just a rat in a cage." Billy Corgan of The Smashing Pumpkins ------------------------------------------------------ dkeller@psln.com ------------------------------------------------------ --- main.cpp //I'm hot shure which files should be included #include#include #include #include #include #include #include #include #include #include "main.h" /////////////////////////////////////////////////////////////////////////= // BEGIN_MESSAGE_MAP(CMainWindow,CFrameWnd) ON_COMMAND(FILE_OPEN,OnOpen) ON_COMMAND(FILE_EXIT,OnExit) END_MESSAGE_MAP(); /////////////////////////////////////////////////////////////////////////= // CTheApp TheApp; /////////////////////////////////////////////////////////////////////////= // IMPLEMENT_DYNCREATE(CListView,CWnd); CListView::CListView() { SetWindowLong(m_hWnd,GWL_STYLE,LVS_LIST); BrowseForFolder(m_hWnd); } LPITEMIDLIST CListView::GetNextItemID(LPITEMIDLIST pidl) { int cb=3Dpidl->mkid.cb; if(cb=3D=3D0) return NULL; pidl=3D(LPITEMIDLIST) (((LPBYTE)pidl)+cb); return (pidl->mkid.cb=3D=3D0) ? NULL:pidl; } LPITEMIDLIST CListView::CopyItemID(LPITEMIDLIST pidl) { int cb=3Dpidl->mkid.cb; LPITEMIDLIST = pidlNew=3D(LPITEMIDLIST)g_pMalloc->Alloc(cb+sizeof(USHORT)); // ^^^^^^^^^^^ This should be // LPITEMIDLIST = pidlNew=3D(LPITEMIDLIST)g_pMalloc->lpVtbl->Alloc(g_pMalloc, // cb+sizeof(USHORT)); if(pidlNew=3D=3DNULL) return NULL; CopyMemory(pidlNew,pidl,cb); *((USHORT *) (((LPBYTE)pidlNew)+cb))=3D0; return pidlNew; } CListView::BrowseForFolder(HWND hwnd) { BROWSEINFO bi; LPSTR lpBuffer; LPITEMIDLIST pidlPrograms; LPITEMIDLIST pidlBrowse; if(SHGetMalloc(&g_pMalloc)<0) return NULL; if((lpBuffer=3D(LPSTR) g_pMalloc->Alloc(MAX_PATH))=3D=3DNULL) return NULL; //^^^^^^^^^^^^^^^^^ this should be //if((lpBuffer=3D(LPSTR)g_pMalloc->lpVtbl->Alloc(g_pMalloc,MAX_PATH))=3D=3D= NULL) if(SHGetSpecialFolderLocation(hwnd,CSIDL_PROGRAMS,&pidlPrograms)<0) { g_pMalloc->Free(lpBuffer); //^^^^^^^^^^^^^^^^ this should be // g_pMalloc->lpVtbl->Free(g_pMalloc,lpBuffer); return NULL; }=20 return NULL; } IMPLEMENT_DYNCREATE(CMainWindow,CFrameWnd); CMainWindow::CMainWindow() { LoadFrame(MAIN_RESOURCES); } BOOL CMainWindow::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { SplitterWnd.CreateStatic(this,1,2,WS_VSCROLL|WS_HSCROLL|WS_CHILD| WS_VISIBLE); SplitterWnd.CreateView(0,0,RUNTIME_CLASS(CListView), CSize(0,0),pContext); SplitterWnd.CreateView(0,1,RUNTIME_CLASS(CListView), CSize(130,50),pContext); return TRUE; =20 } =20 =20 void CMainWindow::OnOpen() { CFileDialog cDlg(TRUE); char FileName[256]; char Filter[256]; int i; lstrcpy(Filter,"All files (*.*)|*.*|C Files (*.c)|*.c||"); for(i=3D0;Filter[i]!=3D0;i++) { if(Filter[i]=3D=3D'|') Filter[i]=3D0; } FileName[0]=3D0; cDlg.m_ofn.lStructSize=3Dsizeof(OPENFILENAME); cDlg.m_ofn.hwndOwner=3DNULL; cDlg.m_ofn.hInstance=3DAfxGetInstanceHandle(); cDlg.m_ofn.lpstrFilter=3DFilter; cDlg.m_ofn.lpstrFile=3D(LPSTR)FileName; cDlg.m_ofn.nMaxFile=3Dsizeof(FileName); = cDlg.m_ofn.Flags=3DcDlg.m_ofn.Flags|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_HIDEREADONLY|OFN_EXPLORER; if(cDlg.DoModal()!=3DIDOK) return; } void CMainWindow::OnExit() { TheApp.m_pMainWnd->SendMessage(WM_CLOSE,0,0L); } BOOL CTheApp::InitInstance() { Enable3dControls(); m_pMainWnd=3Dnew CMainWindow; m_pMainWnd->ShowWindow(m_nCmdShow); m_pMainWnd->UpdateWindow(); return TRUE; } --- main.h #define MAIN_RESOURCES 110 #define FILE_OPEN 120 #define FILE_EXIT 121 class CListView: public CWnd { public: LPMALLOC g_pMalloc; LPITEMIDLIST GetNextItemID(LPITEMIDLIST pidl); LPITEMIDLIST CopyItemID(LPITEMIDLIST pidl); DECLARE_DYNCREATE(CListView); CListView(); BrowseForFolder(HWND hwnd); }; class CMainWindow: public CFrameWnd { public: DECLARE_DYNCREATE(CMainWindow); CSplitterWnd SplitterWnd; CMainWindow(); virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); afx_msg void OnOpen(); afx_msg void OnExit(); DECLARE_MESSAGE_MAP() }; class CTheApp: public CWinApp { public: virtual BOOL InitInstance(); };
Mario Contestabile -- Mario_Contestabile.UOS__MTL@UOSMTL2.universal.com Monday, June 17, 1996 >calling SHBrowseForFolder) but it never displays the dialog, at one point >I am supposed to call "g_pMalloc->lpVtbl->Alloc(g_pMalloc,MAX_PATH)" but >when I try to Compile this it says lpVtbl has not been declared so I >changed it to "g_pMalloc->Alloc(MAX_PATH)". Any help on why this doesn't Did you try LPMALLOC; ::SHGetMalloc(&pMalloc) mcontest@universal.com
Sammi -- sigarashi@geographix.com Tuesday, June 18, 1996 This happened to me too. Here's an answer. In your application RC file, add this. You have to explicitly include "afxres.rc" when you are using a static MFC library. --------------------------------------------------------------- #include "afxres.h" // <-I'm sure you have this already #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #include "afxres.rc" // Standard components <- this has the cursor you want so many other thangs. #endif --------------------------------------------------------------- >[Watcom C/C++ v10.6 - Win95 - MFC v3.2] >Hi, >My app uses a splitter window, if I compile it to use the MFC DLLs it >works fine, but if I compile it to run alone it displays the cursor >arrows pointing right and left (<--->), when I debug I it just says >"Could >not find splitter cursor - using system provided alternative. I have no >Idea what is causing this. I have included my code. > >I also have a question about my code that is not directly related to >MFC: >at one point it is supposed to display a browse for folder dialog (by >calling SHBrowseForFolder) but it never displays the dialog, at one >point >I am supposed to call "g_pMalloc->lpVtbl->Alloc(g_pMalloc,MAX_PATH)" >but >when I try to Compile this it says lpVtbl has not been declared so I >changed it to "g_pMalloc->Alloc(MAX_PATH)". Any help on why this >doesn't >work or why "lpVtbl has not been declared" would be greatly >appreciated. >Thanks, >Daniel. >-- > >"Despite all my rage I am still just a rat in a cage." > Billy Corgan of The Smashing Pumpkins >------------------------------------------------------ >dkeller@psln.com >------------------------------------------------------ > >--- main.cpp > >//I'm hot shure which files should be included > >#include>#include >#include >#include >#include >#include >#include >#include >#include >#include "main.h" > >//////////////////////////////////////////////////////////////////////// >/= >// >BEGIN_MESSAGE_MAP(CMainWindow,CFrameWnd) > ON_COMMAND(FILE_OPEN,OnOpen) > ON_COMMAND(FILE_EXIT,OnExit) >END_MESSAGE_MAP(); >//////////////////////////////////////////////////////////////////////// >/= >// >CTheApp TheApp; >//////////////////////////////////////////////////////////////////////// >/= >// >IMPLEMENT_DYNCREATE(CListView,CWnd); >CListView::CListView() >{ > SetWindowLong(m_hWnd,GWL_STYLE,LVS_LIST); > BrowseForFolder(m_hWnd); >} > >LPITEMIDLIST CListView::GetNextItemID(LPITEMIDLIST pidl) >{ > int cb=3Dpidl->mkid.cb; > if(cb=3D=3D0) return NULL; > pidl=3D(LPITEMIDLIST) (((LPBYTE)pidl)+cb); > return (pidl->mkid.cb=3D=3D0) ? NULL:pidl; >} > >LPITEMIDLIST CListView::CopyItemID(LPITEMIDLIST pidl) >{ > int cb=3Dpidl->mkid.cb; > LPITEMIDLIST = >pidlNew=3D(LPITEMIDLIST)g_pMalloc->Alloc(cb+sizeof(USHORT)); >// ^^^^^^^^^^^ This should be >// LPITEMIDLIST = >pidlNew=3D(LPITEMIDLIST)g_pMalloc->lpVtbl->Alloc(g_pMalloc, >// cb+sizeof(USHORT)); > if(pidlNew=3D=3DNULL) return NULL; > CopyMemory(pidlNew,pidl,cb); > *((USHORT *) (((LPBYTE)pidlNew)+cb))=3D0; > return pidlNew; >} > >CListView::BrowseForFolder(HWND hwnd) >{ > BROWSEINFO bi; > LPSTR lpBuffer; > LPITEMIDLIST pidlPrograms; > LPITEMIDLIST pidlBrowse; > if(SHGetMalloc(&g_pMalloc)<0) return NULL; > if((lpBuffer=3D(LPSTR) g_pMalloc->Alloc(MAX_PATH))=3D=3DNULL) > return NULL; >//^^^^^^^^^^^^^^^^^ this should be >//if((lpBuffer=3D(LPSTR)g_pMalloc->lpVtbl->Alloc(g_pMalloc,MAX_PATH))=3D >=3D= >NULL) > > if(SHGetSpecialFolderLocation(hwnd,CSIDL_PROGRAMS,&pidlPrograms)<0) > { > g_pMalloc->Free(lpBuffer); >//^^^^^^^^^^^^^^^^ this should be >// g_pMalloc->lpVtbl->Free(g_pMalloc,lpBuffer); > return NULL; > }=20 > return NULL; >} > > >IMPLEMENT_DYNCREATE(CMainWindow,CFrameWnd); >CMainWindow::CMainWindow() >{ > LoadFrame(MAIN_RESOURCES); >} > >BOOL CMainWindow::OnCreateClient(LPCREATESTRUCT lpcs, > CCreateContext* pContext) >{ > SplitterWnd.CreateStatic(this,1,2,WS_VSCROLL|WS_HSCROLL|WS_CHILD| > WS_VISIBLE); > SplitterWnd.CreateView(0,0,RUNTIME_CLASS(CListView), > CSize(0,0),pContext); > SplitterWnd.CreateView(0,1,RUNTIME_CLASS(CListView), > CSize(130,50),pContext); > return TRUE; =20 >} =20 > =20 >void CMainWindow::OnOpen() >{ > CFileDialog cDlg(TRUE); > char FileName[256]; > char Filter[256]; > int i; > > lstrcpy(Filter,"All files (*.*)|*.*|C Files (*.c)|*.c||"); > for(i=3D0;Filter[i]!=3D0;i++) > { > if(Filter[i]=3D=3D'|') Filter[i]=3D0; > } > > FileName[0]=3D0; > > cDlg.m_ofn.lStructSize=3Dsizeof(OPENFILENAME); > cDlg.m_ofn.hwndOwner=3DNULL; > cDlg.m_ofn.hInstance=3DAfxGetInstanceHandle(); > cDlg.m_ofn.lpstrFilter=3DFilter; > cDlg.m_ofn.lpstrFile=3D(LPSTR)FileName; > cDlg.m_ofn.nMaxFile=3Dsizeof(FileName); > = >cDlg.m_ofn.Flags=3DcDlg.m_ofn.Flags|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| > > OFN_HIDEREADONLY|OFN_EXPLORER; > if(cDlg.DoModal()!=3DIDOK) return; >} > >void CMainWindow::OnExit() >{ > TheApp.m_pMainWnd->SendMessage(WM_CLOSE,0,0L); >} > >BOOL CTheApp::InitInstance() >{ > Enable3dControls(); > m_pMainWnd=3Dnew CMainWindow; > m_pMainWnd->ShowWindow(m_nCmdShow); > m_pMainWnd->UpdateWindow(); > return TRUE; >} > > >--- main.h > >#define MAIN_RESOURCES 110 >#define FILE_OPEN 120 >#define FILE_EXIT 121 > >class CListView: public CWnd >{ > public: > LPMALLOC g_pMalloc; > LPITEMIDLIST GetNextItemID(LPITEMIDLIST pidl); > LPITEMIDLIST CopyItemID(LPITEMIDLIST pidl); > DECLARE_DYNCREATE(CListView); > CListView(); > BrowseForFolder(HWND hwnd); >}; > >class CMainWindow: public CFrameWnd >{ > public: > DECLARE_DYNCREATE(CMainWindow); > CSplitterWnd SplitterWnd; > CMainWindow(); > virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, > CCreateContext* pContext); > afx_msg void OnOpen(); > afx_msg void OnExit(); > DECLARE_MESSAGE_MAP() >}; > >class CTheApp: public CWinApp >{ > public: > virtual BOOL InitInstance(); >}; > >
| Вернуться в корень Архива |