|
If you want to launch iexplore.exe, regardless of whether it is the default browser or not, you'll need to use an absolute path, or resolve the CLSID {FBF23B42-E3F0-101B-8488-00AA003E56F8} to IE's path. You could also look for the HKCR\Applications\iexplore.exe\shell\open\command key.
If, however, you just want to launch the default browser, call AssocQueryString() before calling CreateProcess() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: HKCR\Applications\iexplore.exe\shell\open\command
I surprisingly do not have this key, though using ie on my computer. Is this really reliable ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
Rage wrote: Is this really reliable ?
I don't know. I was simply providing options for the OP to explore. The more he has to pick from, the more robust his application is likely to be.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I think the problem is just reliability
I've found also this registry key:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE
But how can I be sure to find it or them on any installation?
anyway, thank you everybody for the help
FPT95
|
|
|
|
|
fakeplastictree95 wrote: a registry key for pathname
I do not think this exists (I just searched through my registry).
Need it to be iexplore, or can it be the current web browser (in which case you may want to retrieve the path using registry file extensions) ?
fakeplastictree95 wrote: not to
hard-code iexplore
This can also be configured in some options of your app.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
Use ShellExecute() to run a URL in the user's default browser.
|
|
|
|
|
Hi,
I have declared int m_intValue; and wrote int GetValue(){ return m_intValue;} function.I have declared a structure
struct Table
{
int intData;
CString strName;
};
CArray<table*,table*>m_Tables;
Now i want to write a function same as GetValue() function which will return m_Tables.How to declare it ?
thanks in before
James
|
|
|
|
|
RockyJames wrote: How to declare it ?
One such way would be:
typedef CArray<Table*, Table*> _Table;
_Table m_Tables;
_Table* GetValue( void )
{
return &m_Tables;
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
I have a dialog, that has a sub-dialog. When I have opened the sub-dialog, I may wish to have access to either a variable, of function within the main dialog. Can this be done, if so how?
The value of the variable could change whilst the sub-dialog is open, so I need to check its value before doing anything else in the sub-dialog.
Hope someone can help!
69 Bay
|
|
|
|
|
You can use of CMain *m_Main=(CMain*)GetParent();m_Main->Yourfunction
|
|
|
|
|
Thanks WhiteSky
Just did this - works OK - the only other thing I had to do was include the header file for my main dialog in the sub-dialog. This all seems to work now
Thanks for your help!
69Bay
|
|
|
|
|
Pass a pointer of your current dialog to the sub-dialogs.
void MainDialog::DoSomething()
{
CSubDialog dlg( this );
dlg.DoModal();
}
and in your sub dialog:
class MainDialog;
class CSubDialog
{
CSubDialog( MainDialog* pMainDialog );
};
CSubDialog::CSubDialog( MainDialog* pMainDialog ) : m_pMainDialog( pMainDialog )
{
}
|
|
|
|
|
69 Bay wrote: The value of the variable could change whilst the sub-dialog is open...
How?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Maybe is modeless...
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.
|
|
|
|
|
The Main dialog has a timer in it which still runs whilst the sub-dialog is open. I read in data from the parallel port, which I want the sub-dialog program to have access to, and write data out of the port.
Thanks for looking!
69 Bay
|
|
|
|
|
|
CString::GetBuffer() . Use CString::ReleaseBuffer() after using buffer.
|
|
|
|
|
no. GetBuffer() is not to convert but to get a pointer to the buffer encapsulated within the CString.
if you have to convert a CString, use the cast operators it provides instead, like (LPCTSTR) ...
|
|
|
|
|
toxcct wrote: no. GetBuffer() is not to convert but to get a pointer to the buffer encapsulated within the CString
How it is different? It returns class's NULL terminated buffer, so can be used as char* . What you would term as if not Convert?
toxcct wrote: if you have to convert a CString, use the cast operators it provides instead, like (LPCTSTR)...
It's does same thing as above, get pointer to the buffer encapuslated within CString .
|
|
|
|
|
prasad_som wrote: How it is different?
One is changeable, one is not. It's a bad design to frivolously provide access to CString 's character buffer via GetBuffer() unless it is absolutely necessary. The LPCSTR cast will suffice in most cases.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: One is changeable, one is not.
Agree. I was puzzled by " is not convert" thing. Anyway, it is one of solutions.
|
|
|
|
|
Usually you don't need that, because there is the operator LPCTSTR ( ) const; . However there is the method GetBuffer but use it with care...
hope it helps
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.
|
|
|
|
|
In my (non-unicode) programs I do like this:
char * cp = (char *) (LPCTSTR) CString;
It's not completely safe, since cp is a non-const char *, and LPCTSTR is a const pointer.
But as long as the resulting pointer (cp in this case) is used for reading only, it's perfectly safe.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
as you said, it's not "completely safe" (actually, not safe at all... lol).
first of all, you use C-Style cast, which is deprecated for using static_cast<>()
moreover, by using (char*) after that, you remove the constness of the string return, which is very very bad ! if you have to modify a CString string, use GetBuffer(), or copy its content into your own modifiable char array.
at last, if you have to deal with the Unicode/Ansi conversion, you should use T2A()-like (in your case) macros...
|
|
|
|
|
Did you even read what I wrote?
toxcct wrote: as you said, it's not "completely safe" (actually, not safe at all... lol).
Using a const pointer as a const pointer IS perfectly safe, IMO. Any objections?
toxcct wrote: you remove the constness of the string return, which is very very bad
What I wrote:
It's not completely safe, since cp is a non-const char *, and LPCTSTR is a const pointer.
But as long as the resulting pointer (cp in this case) is used for reading only, it's perfectly safe.
toxcct wrote: if you have to modify a CString string, use GetBuffer(), or copy its content into your own modifiable char array.
Other answers covered this case. There was no need to say it again.
toxcct wrote: at last, if you have to deal with the Unicode/Ansi conversion, you should use T2A()-like (in your case) macros...
What I wrote:
In my (non-unicode) programs I do like this:
One thing though, static_cast is nice, but then again:
What I wrote:
In my (non-unicode) programs I do like this:
And I do what I want in my programs, as long as they works as expected. Which they usually does...
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|