|
-
Feb 7th, 2003, 02:36 AM
#1
Thread Starter
New Member
Shortcuts to C:\
I am wondering if it is possible to create a shortcut to C:\ through a Visual C++ program??, the operating system is XP professional, and the computers are networked, which prevents shortcuts by right clicking. (if u didnt already know that). any ideas, through programs or other things let me know please, any help will be greatly appreciated.
-
Feb 8th, 2003, 06:57 PM
#2
There's a description of the .lnk format somewhere on the MS homepage.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 10th, 2003, 01:46 PM
#3
Frenzied Member
The quickest & easiest way to create a shortcut is by using the ShellExecute API:
Code:
#include <windows.h>
int main(){
ShellExecute(NULL, "open", "C:\\", NULL, NULL, SW_NORMAL);
return 0;
}
Enjoy
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Feb 10th, 2003, 02:33 PM
#4
yay gay
i tryed this from VC++7 and it didnt work:
Code:
// shell.cpp : Defines the entry point for the console application.
//
#include "stdafx"
#include "iostream"
#include <windows>
int _tmain(int argc, _TCHAR* argv[])
{
ShellExecute(NULL, "open", "C:\\", NULL, NULL, SW_NORMAL);
return 0;
}
whats the problem here?
\m/  \m/
-
Feb 10th, 2003, 03:36 PM
#5
Frenzied Member
Code:
// shell.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
ShellExecute(NULL, "open", "C:\\", NULL, NULL, SW_NORMAL);
return 0;
}
Check the blue parts
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Feb 10th, 2003, 03:40 PM
#6
yay gay
#include "stdafx.h"
#include <iostream>
#include <windows.h>
i cant get it! what is the difference?
#include "*.h"
#include "*"
#include <*.h>
#include <*>
where * is the name of the header..what is the difference between them? when do i know which to implement?
\m/  \m/
-
Feb 10th, 2003, 03:42 PM
#7
yay gay
emm...did u edit ur post? i could swear u said bold and not blue and that the things were in bold..lol
\m/  \m/
-
Feb 10th, 2003, 03:45 PM
#8
yay gay
still got an error:
error C2065: 'ShellExecute' : undeclared identifier
\m/  \m/
-
Feb 10th, 2003, 04:23 PM
#9
#include "*.h"
#include "*"
#include <*.h>
#include <*>
#include <windows.h>
The angular brackets are used for header files that are located in the compiler's include directory. Quotes are used for header files that are located in your project directory or elsewhere.
#include "../inc/myclass.h"
.h header files are depreciated; now the standards committee has decided that instead there should be no .h extension, and that the content of the header file should be located inside a namespace (often std).
use .h if you must, or locate the appropriately new header file.
#include <iostream.h> ==> #include <iostream>
#include <stdlib.h> ==> #include <cstdlib>
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Feb 10th, 2003, 04:26 PM
#10
-
Feb 10th, 2003, 04:28 PM
#11
Frenzied Member
Last edited by Jop; Feb 10th, 2003 at 04:36 PM.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Feb 10th, 2003, 04:29 PM
#12
yay gay
ah ok tks to you too lol
\m/  \m/
-
Feb 10th, 2003, 04:35 PM
#13
Frenzied Member
Do you still get errors by the way? I think it should work just fine with the code I posted? in a console app that is
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Feb 10th, 2003, 04:36 PM
#14
yay gay
hmm err no..it still giving error..but it is not big trouble..u see..i am not the guy who started the topic..it was just curiosity lol
\m/  \m/
-
Feb 10th, 2003, 04:41 PM
#15
Frenzied Member
Well now you made me curious why it doesn't work 
Just open a new Solution, a new empty console app project. Make a new Cpp file and paste the code below.
Code:
#include <windows.h>
int main(){
ShellExecute(NULL, "open", "C:\\", NULL, NULL, SW_NORMAL);
return 0;
}
If everything is correct (include paths etc) it should work.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Feb 10th, 2003, 06:02 PM
#16
And if it works you can extend it for UNICODE:
Code:
#include <windows.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR **argv)
{
ShellExecute(NULL, _T("open"), _T("C:\\"), NULL, NULL, SW_NORMAL);
return 0;
}
Or to avoid the console window popping up, make it a win32 app subsystem windows and use
int _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
instead.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 11th, 2003, 07:56 AM
#17
yay gay
hmm ok ty after school ill try it out
\m/  \m/
-
Feb 11th, 2003, 04:13 PM
#18
yay gay
Originally posted by Jop
Well now you made me curious why it doesn't work 
Just open a new Solution, a new empty console app project. Make a new Cpp file and paste the code below.
Code:
#include <windows.h>
int main(){
ShellExecute(NULL, "open", "C:\\", NULL, NULL, SW_NORMAL);
return 0;
}
If everything is correct (include paths etc) it should work.
that worked
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|