|
Try this -
ShellExecute(NULL, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi Venera,
Instead of starting default browser, just pass the html file path to ShellExecute() . For instance, for staring microsoft.com,
ShellExecute(NULL, NULL, "www.microsoft.com", 0, NULL, SW_SHOWNORMAL);
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
venera_soft wrote: std::wstring defaultBrowser = getDefaultBrowser();
You don't have to worry about finding out the default browser. A call to ShellExecute will do that for you.
venera_soft wrote: ShellExecute(NULL, NULL, defaultBrowser.c_str(), url.c_str(), NULL, SW_SHOWNORMAL);
You may have to worry more about passing NULL as the verb. Pass _T("open") as the verb and pass the complete URL as the file to be opened.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks for quick reply.
I found that there was an encoding problem.
|
|
|
|
|
Hi to all,
I have a abstract class
class A
{
public:
void fn()=0;
//other functions
}
one derive class
Now I need to make one more class B, which will derive from A....here I will implement one function of A...and I need to declare a pointer to class B and pass it to a function called fun2().....How to do that?
Please help me out....
-----------------------------
I am a beginner
|
|
|
|
|
can u please clear the scneario?
|
|
|
|
|
I have a abstract class
class A
{
public:
void fn1()=0;
//other functions
};
I have another class B
class B : public A
{
void fn1()
{
}
};
in class B I have implement one function of A ie fn1... I need to declare a pointer to class B and pass it to some other function called funMain() in main function.....something like
B *ptr;
funMain(ptr);
My doubt::
Should I write B *ptr or
B *ptr = new B();
-----------------------------
I am a beginner
|
|
|
|
|
Are meaning about the need of allocation?
if u dont have member variables in class B or class A then you can write
B* ptr = 0;
funMain(ptr);
else
you have use to allocate it
B *ptr = new B();
|
|
|
|
|
himangshuS wrote: B *ptr;
funMain(ptr);
My doubt::
Should I write B *ptr or
B *ptr = new B();
of course you've to initialize the pointer (i.e. create an instance of the class)
and then call the function, for instance:
B * ptr;
ptr = new B();
funMain(ptr);
BTW what has it to do with abstract classes?
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]
|
|
|
|
|
himangshuS wrote: void fn()=0;
This is not allowed without the virtual keyword.
It should be virtual void fn()=0;
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
So one of my (many) recent questions ellicited a link to Resource Acquisition Is Initialization[^]. The wikipedia entry made sense and it seemed like, in general, this structure would be a good idea.
So now I'm using std::vector for the first time since my RAII introduction, and I recall that vector<> leaks unless I call vector<>.clear() when I'm done with the vector.
Does that mean, considering RAII, that whenever I want to use std::vector the best-practice method would be to write a specialized container class that calls .clear() in the destructor and exposes all the std::vector methods?
Now that I think of it, the container could be written as a template class.... but I'm going to let the question stand, since I'm just learning about RAII...
Is this an exception to the rule, or would a container class be best?
A thousand praises to all those who exhibit patience with the noob!
MZR
|
|
|
|
|
Mike the Red wrote: I recall that vector<> leaks unless I call vector<>.clear() when I'm done with the vector.
You recall incorrectly vector deallocates and calls the destructor of each contained object when it's destructed.
Mike the Red wrote: Does that mean, considering RAII, that whenever I want to use std::vector the best-practice method would be to write a specialized container class that calls .clear() in the destructor and exposes all the std::vector methods?
No - just use vector.
All STL container classes are (minus trivial bugs) intended to have that behaviour, i.e. they destruct the contained elements and deallocate their storage when destructed.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
That I wasted the last 4 hours trying to stop this from leaking:
int _tmain(int argc, _TCHAR* argv[])
{
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
vector<char *> vc;
vc.push_back("test");
_CrtDumpMemoryLeaks();
return 0;
}<hr>Detected memory leaks!
Dumping objects ->
c:\program files\microsoft visual studio .net 2003\vc7\include\crtdbg.h(689) : {44} normal block at 0x008A0FF0, 4 bytes long.
Data: < C > A0 A5 43 00
Object dump complete.
The program '[7368] ConTest.exe: Native' has exited with code 0 (0x0). When all I needed was a $#^$#&-ing pair of braces...
int _tmain(int argc, _TCHAR* argv[])
{
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
{
vector<char *> vc;
vc.push_back("test");
}
_CrtDumpMemoryLeaks();
return 0;
} I just love learning curves, don't you?
Thank you for your help, Stuart!
...thanks to you, I wasted 4 hours instead of 5 or 6
|
|
|
|
|
Ummmm - the vector hasn't been destructed when you call _CrtDumpMemoryLeaks...
Try this:
#include <iostream>
#include <tchar.h>
#include <vector>
int _tmain(int argc, _TCHAR* argv[])
{
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
{
vector<char *> vc;
vc.push_back("test");
}
_CrtDumpMemoryLeaks();
return 0;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Faster than a speeding bullet
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello everybody. I am beginner on smartphone application with MFC. I need to change both text color of a tab control to white and also background of that tab control to black for smartphone application implemented with MFC. How can I do it? Thanks a lot for your help.
|
|
|
|
|
Hello All,
I have a query regarding File/Folder permissions.
I have a folder on which a particular user don’t have ‘MODIFY’ permission.
I want to read programmatically whether the particular user has the ‘MODIFY’ permission on that folder on not.
Currently I am using following code.
res = _waccess( L"E:\\3D Library\\Temp.txt”, 06 );
Temp.txt is a file in the Folder on which user dont have 'MODIFY' access rights.
This is returning the same value for all users irrespective of the MODIFY permission.
I wanted to use ‘GetFileAttributes(…)’ but I don’t understand how to use it to read ‘MODIFY’ permission.
My query is:
How read the ‘MODIFY’ permission?
Please help.
Thanks,
|
|
|
|
|
To query and set we can use
GetFileAttributes and SetFileAttributes respectively.
dwAttrs = GetFileAttributes(FileData.cFileName);
if (!(dwAttrs & FILE_ATTRIBUTE_READONLY))
{
SetFileAttributes(szNewPath,
dwAttrs | FILE_ATTRIBUTE_READONLY);
}
For user permission on particular folder try this
Check User’s Permissions On A File or Folder[^]
|
|
|
|
|
Thanks For the response.
I can check the read access using this method.
But I want to specifically check the "MODIFY' access.
Is there any way to check the "MODIFY" access.
Thanks...
|
|
|
|
|
if you want to check whether you have MODIFY permission on a folder then call GetFileAttributesEx API
check whether FILE_ATTRIBUTE_READONLY is not set, else you can write and delete, that means, you can modify.
|
|
|
|
|
This information is incorrect. A file can have the read-only attribute not set, but if write permission has been denied, you will not be able to modify it.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Attributes are not the same as permissions, so GetFileAttributes() is not going to do you any good. You'll need to query the file's ACL. Check out GetFileSD() , GetSecurityDescriptorDacl() , GetAclInformation() , and GetAce() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
Hi,
I really think you should read the forum guidelines and understand how a query has to be send. There is nobody here that will do your work. People here will assist you in doing your task.
All the best
|
|
|
|