|
I've got a strong feeling I'm missing the blindingly obvious, but here goes...
I can fire up Internet Explorer from my app and open a url of my choice with the following:
ShellExecute (NULL, "open", urlMap [bReturn].data (), NULL, NULL, SW_MAXIMIZE);
But if I already have a web page open, it is replaced by my URL. This is annoying!
What I want is to start a *new* instance of explorer with my URL. Something like:
ShellExecute (NULL, "open", urlMap [bReturn].data (), NULL, NULL, SW_MAXIMIZE | IE_START_IN_NEW_WINDOW);
Any ideas?
Iain.
|
|
|
|
|
This is controlled by an IE option - reuse existing windows for shortcuts.
I think you can run iexplore.exe -new http://blahblah but then you lose the convenience of automagically using the user's default browser.
--Mike--
"I'm working really, really fast at the moment, so a 3 minute outage becomes, due to time dilation, a 5 minute outage."
-- Chris Maunder, relativistic system administrator
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
I don't know whether to be glad I haven't missed an easy way or not...
I've had a look for IExplore -new equivalent flags, and none are
documented. The -new doesn't work.
But I may be able to find the reg entry corresponding to the
"reuse flag" (which worked, ta), and temporarily set it to off...
Or maybe I could just leave it up to the user to turn it off
themselves...
Thanks,
Iain.
|
|
|
|
|
|
You need to fetch the browser EXE from the registry and use this when calling ShellExecute thus:
#define LINK_KEY _T("http\\shell\\open\\command")
void CLink::Open(LPCTSTR lpszURL)
{
ShellExecute(NULL, NULL, lpszURL, NULL, NULL, SW_SHOWNORMAL);
}
void CLink::OpenNew(LPCTSTR lpszURL)
{
CString strBrowser = GetBrowser();
if (strBrowser.IsEmpty())
{
Open(lpszURL);
return;
}
ShellExecute(NULL, NULL, strBrowser, lpszURL, NULL, SW_SHOWNORMAL);
}
CString CLink::GetBrowser() const
{
CString str;
HKEY hKey = NULL;
if (RegOpenKeyEx(HKEY_CLASSES_ROOT, LINK_KEY, 0, KEY_READ, &hKey) ==
ERROR_SUCCESS)
{
DWORD cbData = 0;
if (RegQueryValueEx(hKey, NULL, NULL, NULL, NULL, &cbData) ==
ERROR_SUCCESS)
{
if (cbData > 0)
{
TCHAR* psz = new TCHAR [cbData];
if (psz != NULL)
{
if (RegQueryValueEx(hKey, NULL, NULL,
NULL, (LPBYTE)psz, &cbData) ==
ERROR_SUCCESS)
{
str = psz;
}
delete [] psz;
}
}
}
RegCloseKey(hKey);
}
if (str.GetLength())
{
int nStart = str.Find('"');
int nEnd = str.ReverseFind('"');
if (nStart >= 0 && nEnd >= 0)
{
if (nStart != nEnd)
{
str = str.Mid(nStart + 1, nEnd - nStart - 1);
}
}
else
{
int nIndex = str.ReverseFind('\\');
if (nIndex > 0)
{
int nSpace = str.Find(' ', nIndex);
if (nSpace > 0)
str = str.Left(nSpace);
}
}
}
return str;
}
When I am king, you will be first against the wall.
|
|
|
|
|
Thanks for the long answer. I have the sneaking suspicion you've used this code already?
As I said to Michael, its kind of nice not having a one line solution. That would be
a touch embarassing. I usually *answer* (some of) the questions here after all!
Iain.
|
|
|
|
|
Excellent!! Have a think about writing an article...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Yes, I think I will package up my little CLink class into an article ASAP...
When I am king, you will be first against the wall.
|
|
|
|
|
Robert Edward Caldecott wrote:
Yes, I think I will package up my little CLink class into an article ASAP...
It would make a pretty good article. Very, very handy
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Does anybody know a good LZW conversion shareware? I am writing a sofware that imports and export graphics and I was hoping to use shareware to handle LZW data and also avoid Unisys LZW patent... Help!!!! Thanks
|
|
|
|
|
I've been running into a weird problem. I have a header file that has the following in it:
#ifdef _DEBUG
#pragma comment(lib, "SomeLib_Debug.lib")
#else
#pragma message("Argh")
#pragma comment(lib, "SomeLib.lib")
#endif
This header file is included in a static library, we'll call it "A.lib".
I have a program, "B", that includes "A.lib". A and B have Debug, Release, Unicode Debug, and Unicode Release builds. SomeLib just has a Debug and Release build.
B uses A.lib, but does NOT include the header shown above. In other words, it should not need "SomeLib.lib".
When I compile it in Debug or Release, it compiles fine. If I compile it in Unicode Debug or Unicode Release, it seems to require SomeLib.lib, and the link fails.
Any idea as to why this might happen? I've scoured through the project settings and can't find any differences that would explain this.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
When A.lib compiles this file, it will place the requirement for SomeLib.lib (or SomeLib_Debug.lib) into the associated obj file, which is then included inside A.lib. That means that when the linker is used to link A.lib into an executable, it will find the comment, and so try and link with SomeLib.lib as well. You can turn this behaviour off by checking the "Ignore all default libraries" option on the Project->Link settings, but this will mean you will have to manually link with all the standard libraries (MFC links with about 8 libraries using this method).
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
That makes sense, and that's kindo f what I was afraid of, but it doesn't make sense that it would fail to link only for some configurations (namely, the Unicode ones only.) I guess I was wondering why some configurations would behave differently from others, even though their settings regarding libraries seem the same?
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
How do i open an Dialog BOx from the SDI Main Frame Menu. I tried to use Do.Modal()with the Dialog class object , but it caused an assetion. If i ignore the assertion, it runs perfectly fine. I want to get rid of that assertion.
|
|
|
|
|
What causes the assertion? SDI menu has nothing to do with a dialog box. I suspect that the dialog box is not initialized correctly.
Kuphryn
|
|
|
|
|
I created an object of my Dialog class called Window.In order to open the dialog class i did Window.DoModal();
That is when assertion came up.
|
|
|
|
|
|
assertion says
Debug Assertion failed.
File:afxwin2.inl
Line 162.
i think it is due to some inappropraite use of function DoModal().
|
|
|
|
|
Can you post the code that you are using to create the dialog box as well please... it might make it a bit easier to see what is going on.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
It could be that your dialog contains a CWnd derived member that's not linked to a control. But it's impossible to say for sure unless you post some code.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
here is the Function that is used to create the dialog box when a SDI menu item is clicked.That menu item is called Jaguar.
Jagwindow is my object for class CJaguarDlg.
Hope this clarifies things.
void CVR_ToolView::OnJaguar()
{
CJaguarDlg JagWindow;
int nRet=JagWindow.DoModal();
}
|
|
|
|
|
Sadly, that's of no help. How about posting the OnInitDialog() of CJaguarDlg . Also post its .h file.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
ppathan wrote:
i think it is due to some inappropraite use of function DoModal().
No. Somewhere in your dialog or in one of the embedded controls, a RedrawWindow() is being called before the dialog is created properly, possibly in OnSize() or something like that. If you've put this in, then do this:
if(::IsWindow(m_hWnd))
RedrawWindow(); Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
i want to know more info about CEditView.
Thanks very much!
|
|
|
|
|
MSDN has a plethora of information, examples too! You might even find some examples right here at CP!
|
|
|
|