|
In C++ the easiest way is to use the system CRT function.
#include <process.h>
int main()
{
system("Notepad.exe");
return 0;
}
Steve
|
|
|
|
|
It's great.
I also have this question.
I want to have many friends
|
|
|
|
|
kevinalphaxz wrote: I want to have many friends
That's not a question!
|
|
|
|
|
if i try to include fstream.h and vector.h like this
#include <fstream.h>
#include <vector.h>
some error occured, what should i do?
|
|
|
|
|
The standard library include files don't end in ".h". Use #include <vector> instead, for example.
Steve
|
|
|
|
|
Could you be more specific about the error that occurs? Cause, I don't agree with Steve about the .h .... I mean I use it all the time and it work ????
Sorry My bad Steve ... are you talking about the vector header file??? If you are ... my bad.
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Programm3r wrote: Could you be more specific about the error that occurs? Cause, I don't agree with Steve about the .h .... I mean I use it all the time and it work ????
Steve is right, you shouldn't use .h with the standard C++ Library. Older compilers may ship with both fstream.h and fstream, but VS05 does not.
Before C++ got standardized, C++ headers files were still like C headers, with .h extension. But the standard C++ put all those header files under std namespace, so they rename all of them without .h extension.
|
|
|
|
|
Like I said .... " My bad " ....
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Programm3r wrote: Cause, I don't agree with Steve about the .h .... I mean I use it all the time and it work ????
Then you don't have VS2005. The standard headers do not have .h, and the non standard headers are finally gone in VS2005.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
If we hav URL how to create Inernet shortcut link to that URL programatically?
|
|
|
|
|
, Can you explain in detail ?
|
|
|
|
|
I want to copy all my favourites to some other USB Drive through programatically.
For that if i use SHFileOperation option to copy all tha favourites into my drive...The copied files are not copied as Internet shortcuts they just copied as files.
For that I retrive URLs and want to create internet shortcuts for that URLs...
Do u hav any idea regarding this favorites importing to our program ?
|
|
|
|
|
I got this code from MSDN,
#include <windows.h>
#include <shlobj.h>
#include <intshcut.h>
HRESULT CreateInternetShortcut(LPTSTR pszShortcut, LPTSTR pszURL)
{
IUniformResourceLocator *purl;
HRESULT hr;
hr = CoInitialize(NULL);
if(SUCCEEDED(hr))
{
hr = CoCreateInstance( CLSID_InternetShortcut,
NULL,
CLSCTX_INPROC_SERVER,
IID_IUniformResourceLocator,
(LPVOID*)&purl);
if(SUCCEEDED(hr))
{
IPersistFile* ppf;
hr = purl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
if(SUCCEEDED(hr))
{
hr = purl->SetURL(pszURL, 0);
if(SUCCEEDED(hr))
{
WCHAR wszShortcut[MAX_PATH];
#ifdef UNICODE
lstrcpyn(wszShortcut, pszShortcut, MAX_PATH);
#else
MultiByteToWideChar( CP_ACP,
0,
pszShortcut,
-1,
wszShortcut,
MAX_PATH);
#endif
hr = ppf->Save(wszShortcut, FALSE);
}
ppf->Release();
}
purl->Release();
}
CoUninitialize();
}
return hr;
}
|
|
|
|
|
I used this code But CoCreateInstance cannot create instance in my application ,
i didn't get why it fails?
|
|
|
|
|
whats value of hr? Check if you are missing something from code. Actually it should work, as i've tested it, too.
|
|
|
|
|
the value of hr is -2147467262
|
|
|
|
|
kiranin wrote: the value of hr is -2147467262
I think its for interface not supported.
Check your system matches minimum requirement for IUniformResourceLocator . Thats all I can tell, because this code is working fine for me.
|
|
|
|
|
How can i check it matches the minimum requirement or not?
|
|
|
|
|
Its there in MSDN desciption for interface.
|
|
|
|
|
My Application Cannot Create Instance for IUniformResourceLocator,
Can i know the reasons,
I went throgh the MSDN for IUniformResourceLocator, there jus very small info about thay interface....
|
|
|
|
|
Did you see Interface Information on MSDN?
|
|
|
|
|
I want to add Atl New Object to my project And according to theory it sould be present in Insert Menu But that is not present in my vc++6.0 Enter price Edition...
Can anybody help me how to get it
|
|
|
|
|
Files related to that wizard should present at path Program Files\Microsoft Visual Studio\COMMON\MSDev98\Template\ATL , if not, I think you need to repair/reinstall visual studio.
|
|
|
|
|
Hi, there,
I am thinking of developing a software with some interfaces similar to those in http://www.winpim.com/introduction.htm. Is C++ the suitable tool to do it? If not, what tool/language will be suitable?
Thank you very much!
David
|
|
|
|
|
David L.S. wrote: Is C++ the suitable tool to do it?
Suitable? Yes, quite.
I'm assuming you haven't used C++ or you wouldn't ask.
In that case learning C++ is an adventure.
Then there's MUCHO user-interface stuff to learn if you've never programmed for
Windows (or other OS).
Mark
|
|
|
|