|
I had read about rvalue references and I'm able to admire it more now.
Thanks
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hello friend,
I need to show one small "Please Wait.." image screen whenewer some back end processing is in progress.
For e.g. whenever user changing his ip adress and port, before going checking and establishing the connection, I want to show a "Please wait ..." image.But while going for connection browser gets hangs because of connection and after connection checking is completed. It goes for next page.
I am using IWebBrowser2 interface through which, I am getting pointer of browser.Then I am using IHTMLELement through which I am getting pointer of current html content.After that I am using IHTMLImageElement to add one img tag inside current html page for please wait screen.
Please give me some suggestions.
Waiting for the positive reply
Thank you.
abhi
|
|
|
|
|
AbhijitAkude wrote: I am using IWebBrowser2 interface
From what? You did not provide any context.
|
|
|
|
|
Hi,
I am porting a VC6.0 code to VS2008. I have a class with following decalration
template<class>
type lowerBound,
type upperBound>
class TempClass
{
public:
TempClass(void );
//virtual ~TempClass(void);
protected:
type mValue;
};
template<class type="" lowerbound="" upperbound="">
TempClass<type,>::TempClass(void)
{
// TBI
}
I am declaring a pointer to this class as
TempClass <float, 1,2> *pT1;
I am getting the error
error C2993: 'float' : illegal type for non-type template parameter 'lowerBound'
error C2993: 'float' : illegal type for non-type template parameter 'upperBound'
how can I fix this problem?
I cannot use the pointers for lowerBound, upperBound.
|
|
|
|
|
Directly? You can't - C++ requires integral types for non-type template parameters.
How about supplying the parameters as ints and casting to the required type in the class, like this?
template<class Type, int LowerBound, int HigherBound>
class TempClass { ... };
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
template<class lowerBoundType, class upperBoundType>
Class TempClass
{
…
};
OR
template<typename lowerBoundType, typename upperBoundType>
Class TempClass
{
…
};
Reasonable Declarations:
TempClass<float, float>* pT1.
TempClass<double, double>* pT1.
TempClass<int, int>* pT1.
If both upper and lower bounds use the same type, which would make since, then a more reasonable template would be:
template<typename boundryType>
Class TempClass
{
…
};
Declaration:
TempClass<float>* pT1.
<div class="ForumSig">INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra</div>
|
|
|
|
|
Hi All,
I have a Multithreaded Application in which i am trying to open a Compounded Stream using OpenStream method of IStream interface in a following manner:
CComPtr<IStream> ptrDataStream;
hr = ptrStorage->OpenStream(strDataStreamName,0,STGM_READ | STGM_SHARE_EXCLUSIVE,0,&ptrDataStream);
if (hr)
return hr;
The problem which I am facing is that at some time not always OpenStream return Access Denied error. After getting this error I added a lock in this function which is released at the end of the function, but this change doesn't effect the error .
Please help me in this regard.
Thanks in Advance
Ankush Gupta
|
|
|
|
|
I use practically the same code when opening a stream from withing a compound storage file which is single threaded and have no problems. Presumably then this must be down to something keeping the stream open and the 'exclusive' access flag causing access denied to be returned. Sorry if I'm restating the obvious. Maybe a file not closed properly?
|
|
|
|
|
Thanks for the reply.
Is there any way of closing the stream?
I looked into the IStorage/IStream interfaces and found that there is no method of closing the storage or stream, but there exist one DestroyElement method. Can it be of any use?? Or there any workaround to fixup the issue.
Thanks
|
|
|
|
|
Code of the function where I am getting the error
CComQIPtr<IStorage> ptrStorage;
CStringW strPage;
HRESULT hr = FindStorage(storage,strName,strPage,ptrStorage);
if FAILED(hr)
return hr;
CComPtr<IStream> ptrMetaStream;
hr = ptrStorage->OpenStream(strPage,0,STGM_READ | STGM_SHARE_EXCLUSIVE,0,&ptrMetaStream);
if FAILED(hr)
return hr;
GUID clsidPageType;
hr = ptrMetaStream->Read(&clsidPageType,sizeof(clsidPageType),NULL);
if FAILED(hr)
return hr;
GUID clsidEntityType;
hr = ptrMetaStream->Read(&clsidEntityType,sizeof(clsidEntityType),NULL);
if FAILED(hr)
return hr;
CComBSTR strDataStreamName;
hr = strDataStreamName.ReadFromStream(ptrMetaStream);
if FAILED(hr)
return hr;
CComPtr<IStream> ptrDataStream;
hr = ptrStorage->OpenStream(strDataStreamName,0,STGM_READ | STGM_SHARE_EXCLUSIVE,0,&ptrDataStream);
if FAILED(hr)
return hr;
CComBSTR strFullName;
hr = strFullName.ReadFromStream(ptrMetaStream);
if FAILED(hr)
return hr;
CComBSTR strMimeType;
hr = strMimeType.ReadFromStream(ptrMetaStream);
if FAILED(hr)
return hr;
LONG nCodePage;
hr = ptrMetaStream->Read(&nCodePage,sizeof(nCodePage),NULL);
if FAILED(hr)
return hr;
CComPtr<IPage> ptrPage;
hr = ptrPage.CoCreateInstance(clsidPageType);
if FAILED(hr)
return hr;
hr = ptrPage->Load(lcid,ptrMetaStream,ptrDataStream,strFullName,strMimeType,clsidEntityType,nCodePage);
if FAILED(hr)
return hr;
hr = ptrPage.CopyTo(ppPage);
if FAILED(hr)
return hr;
|
|
|
|
|
Sorry I can't see anything obviously wrong, though I've never used IPage so can't speak on use of that really. Releasing all interfaces seems to close the streams where I've used them. The Storage did have a Scribble mode which did require calling Save then SaveComplete to release the no-scribble (no-write) mode in my implementation but I think that was down to IPersistStorage rather than IStorage perhaps.
|
|
|
|
|
I have a WTL SDI App which contains a couple of splitter bars and am trying to save and restore the position and size of the main window and the position of the splitter bars. I started using the classes in the 2001 CP article: 'Saving and restoring window appearance in WTL'[^] which, for the Main-Frame wrap GetWindowPlacement and SetWindowPlacement. For the splitters the classes simply get/set the splitter position. These classes rely on creating the window then restoring the windows position etc after creation.
Initially with this implementation I found the vertical and horizontal splitters crept to the right and down respectively on each restoration but this was solved this by altering my call to CreateEx to pass in the size of the window from my saved WINDOWPLACEMENT:
wndMain.CreateEx(0,ws.m_WindowPlacement.rcNormalPosition)
The handler for WM_CREATE was now able to create and position the CSplitterWindow and CHorSplitterWindow splitter windows properly as it could obtain the correct size of the (restored) main window using GetClientRect.
This works well unless the window is exited whilst maximised. On restoration, calling CreateEx as above now passes in the saved, non-maximised, size of the main window. In the OnCreate handler, calling GetClientRect to use in positioning the splitter windows now comes back with, not the maximized size of the window as I expected, but the size the window will become if it's Restored Down.
Can I get the saved WINDOWPLACEMENT structure 'into' the Main-Frame window before or during my call to CreateEx in a way so that a call to GetClientRect within the OnCreate handler will obtain the size, even if the window is maximized?
Common sense seems to tell me that I should'nt have to shoehorn in part of the WINDOWPLACEMENT struct during CreateEx and mess about with maximised/not-maximised and that there is a 'correct' way to get it all in before my OnCreate handler runs.
|
|
|
|
|
Assuming wndMain is of type CMainFrame....
Add a WINDOWPLACEMENT member to the CMainFrame class, add a WINDOWPLACEMENT parameter to the CMainFrame constructor that you us to initialise the WINDOWPLACEMENT member of CMainFrame. Use that member to set the window's placement (with SetWindowPlacement) in the WM_CREATE handler?
Like this:
WINDOWPLACEMENT wp;
CMainFrame wndMain(wp);
CMainFrame(WINDOWPLACEMENT const& wp) : wp_(wp) {}
CMainFrame()
{
WINDOWPLACEMENT wp = {0};
wp.length = sizeof WINDOWPLACEMENT;
wp.showCmd = SW_SHOWNORMAL;
wp.rcNormalPosition.top = 100;
wp.rcNormalPosition.left = 100;
wp.rcNormalPosition.right = 200;
wp.rcNormalPosition.bottom = 200;
wp_ = wp;
}
WINDOWPLACEMENT wp_;
LRESULT OnCreate(UINT , WPARAM , LPARAM , BOOL& )
{
SetWindowPlacement(&wp_);
}
Yes, it works and you get the maximized client rect back in OnCreate.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart,
I never thought about passing the WINDOWPLACEMENT in to the CMainFrame prior to calling CreateEx(...). In the handler for WM_CREATE GetClientRect(...) now returns the expected size so I can set splitters etc up fine. Thanks.
Odd behaviour though in the case where the application was either closed from a minimized or maximized state. On restarting, the retrieved prior state is indicated by the WINDOWPLACEMENT.showCmd . When previously minimized or maximized is the case, in between the OnCreate(...) handler exiting and the following call to ShowWindow(...) something changes the WINDOWPLACEMENT.rcNormalPosition information to either the size and position of a minimized or a maximized window respectively. This then means when the User Restores, it 'restores' to exactly the same minimized or maximized size! To the eye the window stays as it was.
I had to work around this by resetting the WINDOWPLACEMENT again after CreateEx returns. I found I also had to call ShowWindow with the retreived showCmd rather than nCmdShow and remove any saved WPF_RESTORETOMAXIMIZED flag.
int Run(LPTSTR = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
...
if(WindowPlacement.flags & WPF_RESTORETOMAXIMIZED)
{
WindowPlacement.flags &= WPF_SETMINPOSITION;
}
CMainFrame wndMain(WindowPlacement);
wndMain.CreateEx();
wndMain.SetWindowPlacement(&WindowPlacement);
wndMain.ShowWindow(WindowPlacement.showCmd);
...
Why this is necessary I don't know. Anyway it all seems OK now so thanks.
|
|
|
|
|
what is the purpose of the following properties in the Object tag:
PARAM NAME="_Version" VALUE="458752"
PARAM NAME="_ExtentX" VALUE="9843"
PARAM NAME="_ExtentY" VALUE="7373"
PARAM NAME="_StockProps" VALUE="1"
Some details would be appreciated as to what each property is I have seen these properties on a number of controls in web pages.
Thanks in advance.
|
|
|
|
|
Its used to set the default value for the property identified by NAME.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for your reply, Which property are you referring too?
|
|
|
|
|
Property of the embedded object.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Sorry Superman, your not making any sense. Have you read the question? I am looking for a breakdown of what EACH property means and there purpose.
|
|
|
|
|
Oh! That is totally dependent on the object that is being embedded.
Those are custom properties I guess.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
In the wizard I'm working on I need to bring up a window that allows our users to select a folder to gather files from. I figured that CFolderDialogImpl would work just dandy. However, I wanted to remove the 'Make New Folder' button (which I was able to do by using Spy++ to find out it's ID and hide it) and replace it with a check box that the user can check to specify whether or not to recurse into subdirectories of the selected folder. I created a dialog in the resource editor with just a checkbox in it (IDC_CHECK_RECURSE is the resource ID for the checkbox, and it belongs to IDD_ENHANCED_FOLDER_DIALOG).
My problem is that I can't, for the life of me, get the check box that I created in the resource editor to show up! I know that I haven't set anything up to handle the messages for my check box. I'm more concerned with just getting the dang thing to show up first.
Here is what the class looks like...
class CFolderDialogEx : public CFolderDialogImpl<CFolderDialogEx>
{
protected:
typedef CFolderDialogImpl<CFolderDialogEx> baseClass;
typedef CFolderDialogEx thisClass;
public:
enum DialogIds
{
_IDC_STATUSTEXT = 0x00003741,
_IDC_TITLE = 0x00003742,
_IDC_NEW_FOLDER = 0x00003746,
};
enum { IDD = IDD_ENHANCED_FOLDER_DIALOG };
CFolderDialogEx(HWND hWndParent = NULL, LPCTSTR lpstrTitle = NULL, UINT uFlags = BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT)
: baseClass(hWndParent, lpstrTitle, uFlags)
{
}
BEGIN_MSG_MAP(thisClass)
END_MSG_MAP()
void OnInitialized()
{
if((m_bi.ulFlags & BIF_NEWDIALOGSTYLE) == BIF_NEWDIALOGSTYLE &&
(m_bi.ulFlags & BIF_STATUSTEXT) == BIF_STATUSTEXT)
{
int fontHeight = 11;
CWindow title = ::GetDlgItem(m_hWnd, _IDC_TITLE);
RECT rcTitle = {0};
if(title)
{
CFontHandle titleFont = title.GetFont();
CLogFont logFont;
titleFont.GetLogFont(logFont);
if(logFont.lfHeight < 0)
fontHeight = -1*logFont.lfHeight;
title.GetWindowRect(&rcTitle);
::MapWindowPoints(NULL, title.GetParent(), (LPPOINT)&rcTitle, 2);
rcTitle.top -= 1;
rcTitle.bottom -= fontHeight + 1;
title.SetWindowPos(NULL, &rcTitle, (SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW));
}
CWindow status = ::GetDlgItem(m_hWnd, _IDC_STATUSTEXT);
if(status)
{
status.EnableWindow(TRUE);
status.ModifyStyle(0,SS_PATHELLIPSIS|SS_NOPREFIX);
rcTitle.top = rcTitle.bottom + 2;
rcTitle.bottom = rcTitle.top + fontHeight + (fontHeight/2);
status.SetWindowPos(NULL, &rcTitle, (SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW));
}
}
CRect rect;
CWindow makeNewFolderButton = ::GetDlgItem(m_hWnd, _IDC_NEW_FOLDER);
if ( makeNewFolderButton.IsWindow() )
{
makeNewFolderButton.ScreenToClient( &rect );
makeNewFolderButton.ShowWindow( SW_HIDE );
CWindow recurseBox = ::GetDlgItem( this->m_hWnd, IDC_CHECK_RECURSE );
DWORD error;
error = GetLastError();
if ( recurseBox.IsWindow() )
{
recurseBox.MoveWindow( &rect );
recurseBox.ShowWindow( SW_NORMAL );
}
}
}
....
recurseBox.m_hWnd is NULL, which makes the if ( recurseBox.IsWindow() ) fail.
error is ERROR_CONTROL_ID_NOT_FOUND
I'm completely aware that I may be going about this all wrong. All I want to do is have a folder dialog with the checkbox that let's the user specify whether or not to recurse into subdirectories. I don't really care how it gets done, as long as it gets done. Any help would be very much appreciated!
Thanks!
|
|
|
|
|
I'd be tempted to do it slightly differently for various reasons, the main one being that I don't think SHBrowseForFolder (the underlying API) allows controls to be added to its dialog.
Anyway - why not have a separate dialog with three controls - an edit box containing the text of the path, a 'browse' button that would show the folder browsing dialog (the result of which would get put back into the text box) and a check box for the recursion control.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
The following code is correct:
FRLE_FALSE(m_pRssManager.CreateInstance(RssLib::CLSID_RssManager),_T("can't create RssManager object"));
CString sRssDBFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\DB\\RssTab.mrr"));
try{
m_pRssManager->Open((LPCTSTR)sRssDBFile);
}
catch(...)
{
MessageBox(::AfxGetMainWnd()->m_hWnd, _T("database file is already damaged,will create a new empty database file"),_T("message"),MB_OK|MB_ICONINFORMATION);
CString sRssDBTemplateFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\NewRssTab.mrr"));
if( ::PathFileExists(sRssDBTemplateFile) ){
::CopyFile(sRssDBTemplateFile, sRssDBFile, FALSE);
RssLib::IRssManagerPtr pRssManager;
FRLE_FALSE(pRssManager.CreateInstance(RssLib::CLSID_RssManager),_T("can't create RssManager object"));
pRssManager->Open((LPCTSTR)sRssDBFile);
m_pRssManager = pRssManager;
}
}
the following code is not correct:
FRLE_FALSE(m_pRssManager.CreateInstance(RssLib::CLSID_RssManager),_T("can't create RssManager object"));
CString sRssDBFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\DB\\RssTab.mrr"));
try{
m_pRssManager->Open((LPCTSTR)sRssDBFile);
}
catch(...)
{
MessageBox(::AfxGetMainWnd()->m_hWnd, _T("database file is already damaged,will create a new empty database file"),_T("message"),MB_OK|MB_ICONINFORMATION);
CString sRssDBTemplateFile = (LPCTSTR)(GlobalSet::g_sRootPath + _T("\\NewRssTab.mrr"));
if( ::PathFileExists(sRssDBTemplateFile) ){
::CopyFile(sRssDBTemplateFile, sRssDBFile, FALSE);
m_pRssManager ->Open((LPCTSTR)sRssDBFile);
}
}
May I ask the reason ? Why have to recreate the RssManager object ?
thanks a lot!
sdfdsfsd
|
|
|
|
|
Try formatting the code using the 'code block' button, so that indents aren't lost - that is pretty much unreadable, which makes it unlikely that someone's going to answer your query.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanks. this query is resolves. it is not relate com, it is other question.
sdfdsfsd
|
|
|
|
|