|
of course
is there a way to catch the error from the IHTmlDocument or something like that?
thanks
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
i saw something on MSDN:
http://support.microsoft.com/kb/317024[^]
but the question is if the page creates iframe within iframe within iframe (which is out of my control) and i place on error at the top of the html (not the inner iframe) will it be caught?
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Hi Guys,
I want to write an function which will accept an file name(along with complete path), append an prefix to it (say Admin to the file name from c:\Sample\sam.txt to c:\Sample\Adminsam.txt). I have written an function via character array manipulation and given below.
<br />
#define ADMIN_PREFIX _T("Admin")<br />
static void RenameToAdminFile(LPCTSTR szFilePath, LPTSTR szAdminFilePath)<br />
{<br />
TCHAR szTempFilePath[MAX_PATH] = _T(""), *pCh;<br />
TCHAR szFileName[MAX_PATH] = _T("");<br />
_tcscpy(szTempFilePath, szFilePath);<br />
bool bValidPath = false;<br />
<br />
if (pCh = _tcsrchr( szTempFilePath, _T('\\')))<br />
{<br />
pCh++;
_tcscpy(szFileName, pCh);<br />
*pCh = _T('\0');<br />
bValidPath = true;<br />
}<br />
else<br />
{<br />
if (pCh = _tcsrchr( szTempFilePath, _T(':')))<br />
{<br />
pCh++;
_tcscpy(szFileName, pCh);<br />
*pCh = _T('\0');<br />
_tcscat(szTempFilePath, _T("\\"));<br />
bValidPath = true;<br />
}<br />
else<br />
{<br />
*szTempFilePath=_T('\0');<br />
}<br />
}<br />
if(bValidPath)<br />
{<br />
TCHAR szTempAdminFileName[MAX_PATH] = ADMIN_PREFIX;<br />
_tcscat(szTempAdminFileName, szFileName);<br />
_tcscat(szTempFilePath, szTempAdminFileName);<br />
}<br />
_tcscpy(szAdminFilePath, szTempFilePath);<br />
return;<br />
}
Are there any STL API's (Not CString methods)that I could use to achieve the same? An code snippet will be of great help.
|
|
|
|
|
Use _tsplitpath to separate the drive letter, folder name, file name and extension into separate variables.
Now you can change the filename by attaching "Admin" into another buffer using _tcscpy_s and _tcscat_s and then stitch the full path back together using _stprintf_s .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for the Info.
Yes. You can use _wsplitpath to split the file path into Drive letters, directory, filename, and file extension and now you can do any manipulation with any of the individual members like appending the file name with an string.
Now you can put individual file info togather using the api _makepath.
|
|
|
|
|
Good spot - wasn't aware of that one. There is now a 'safe' version of that[^] that MS propose you use instead...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
std::string RenameToAdminFile(std::string const& file)
{
std::string::size_type lastSep = file.find_last_of('\\');
if (lastSep != std::string::npos)
{
return file.substr(0, lastSep+1) + "Admin" + file.substr(lastSep+1);
}
else
{
return "Admin" + file;
}
} ?
Hack-amungous, of course, as it assumes various things. As I suggested to someone else today - Boost.FileSystem[^] is a nice (and cross-platform) path manipulation library.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
i try to put some html code with flash content and java script to this control, but this is not shown when i use the function SetDocumentHTML() !!
If i use Navigate the site with the same content is showed exactly!?
Are they any known problems between this control and scripts and flash??
Thanks for any help!!
regards
ternal
|
|
|
|
|
What is the HRESULT value that the function returns?
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
the return code is S_OK, and then i try with this very simple code, and the result is the same, nothing is shown!
CString str_html = L"<html><head<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">Hello worls!</body></html>";
HRESULT hres;
if(S_OK != (hres = m_cBrowserDetails.SetDocumentHTML(str_html)))
Sleep(10);
Then i try with COM and SAVEARRAY, but is the same result!
regards
termal
|
|
|
|
|
I'm just guess here, but you could try and switch off edit mode using CHtmlEditCtrlBase::SetDesignMode[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I have a listbox with a set of parameter names retrived from a text file.I need to display the index number for each parameter name which is in the listbox on a messagebox or in a editbox,i.e when I select the item name.It should happen.How can I do that?
|
|
|
|
|
|
In a led-mood, today?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Cedric Moonen wrote: They hide that information in the documentation[^]
Bastards.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi,
im using
CDC* pObject;
Crect ButtonRect;
Buttonrect is the rect of the total button....
pObject->DrawText(_T("hi"), ButtonRect, DT_END_ELLIPSIS);
RectText is the rect of the text inside button...
and im using pObject->DrawFocusRect(Recttext);
but the issue is focusrect is drawn along the button edges instead of the text edges...
Please try to help....
|
|
|
|
|
kumar sanghvi wrote: RectText is the rect of the text inside button...
How did you took text rect?
|
|
|
|
|
RectText is the client rect of the button
CRect rCalc(RectText);
UINT nVAlign = (nAlign & (DT_VCENTER | DT_TOP | DT_BOTTOM));
nAlign &= ~(DT_VCENTER | DT_TOP | DT_BOTTOM);
int nHeight = pDC->DrawText(sText, rCalc, nAlign | DT_CALCRECT);
if (RectText.Height() > nHeight)
{
if (nVAlign & DT_VCENTER)
RectText.DeflateRect(0, (RectText.Height() - nHeight) / 2);
else if (nVAlign & DT_BOTTOM)
RectText.top = RectText.bottom - nHeight;
else // top
RectText.bottom = RectText.top + nHeight;
}
if (RectText.Width() > rCalc.Width())
{
if (nAlign & DT_CENTER)
RectText.DeflateRect((rText.Width() - rCalc.Width()) / 2, 0);
else if (nAlign & DT_RIGHT)
RectText.left = RectText.right - rCalc.Width();
else // left
RectText.right = RectText.left + rCalc.Width();
}
and im using and im using pObject->DrawFocusRect((LPRECT)Recttext);
but it doesn"t draws the focus rect just around the text but it draws a rect which is less than the boundaries of the text....
|
|
|
|
|
kumar sanghvi wrote: pDC->DrawText(sText, rCalc, nAlign | DT_CALCRECT);
The DT_CALCRECT cannot be used with the DT_TABSTOP style. So please check whether your nAlign has DT_TABSTOP flag.
Optionaly you can use the GetTextExtent() function to find the width and height of the text.
|
|
|
|
|
Thanks for ur response...
using GetTextExtentPoint() i got the width and height of the text...now how can i get
the rect using this width and height...
|
|
|
|
|
Hi,
In my application I need to control current the view of the folder opened in windows explorer.
User will start my application....He will also open a folder in the windows explorer. When he clicks a button in my application the view of the folder will change.(View means list,thumbnails,icon)
Please let me know where should i start?
Regards and thanx,
J
|
|
|
|
|
|
I may also need to implement keyboard shortcuts to the currently opened folder in the windows explorer to change views, so it cannot be hosted in my app.
|
|
|
|
|
Well, see, the trouble is that the concept of there being a single current folder open in Explorer (which you say is what you want to manipulate) is invalid. There may be any number of folders open in Explorer windows concurrently.
Try taking a step back and telling us what you're actually trying to accomplish with this - there may be ways other than the obvious, brute force method...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
Thanks,
Well, My application will install a keyvboard hook. When user depresses a key the active folders view will change.
Regards,
John.
|
|
|
|