Annoyances.org
Home » Windows XP Discussion Forum » Message 1144289850 » Entire Thread Search | Help | Home
  
How to make shortcut run correctly!
Showing all messages in thread #1144289850
Windows XP Annoyances Discussion Forum


The following are all of the messages in this thread (11 in all), shown in chronological order. Click any message subject to view that message by itself or to view the thread hierarchy.
How to make shortcut run correctly!
Wednesday, April 5, 2006 at 7:17 pm
Posted by Thanhbinh (6 messages posted)

I've written a simple console win32 #include "stdafx.h" #include #include int main(int argc, char* argv[]) { int n; printf("Hello World!\n"); printf("\nHay nhap vao mot so bat ky\n"); scanf("%d",&n); printf("%d",n); getch(); return 0; } After that, I make a shortcut to myprogam.exe I want to run the shortcut from cmd, but it doesn't work well.

[Reply or follow-up to this message]

Tip: Run a free scan for common Windows errors ad

re: How to make shortcut run correctly!
Wednesday, April 5, 2006 at 10:07 pm
Posted by geek9pm (1438 messages posted)

Well, first we have to be able to read it...
Hey, this forum is for general Windows XP issues. I doubt any hee even cares about this. Whatr is this thing do?

Geek9pm




On Wednesday, April 5, 2006 at 7:17 pm, Thanhbinh wrote:
>I've written a simple console win32
>#include "stdafx.h"
>#include
>#include
>
>int main(int argc, char* argv[])
>{
> int n;
> printf("Hello World!\n");
> printf("\nHay nhap vao mot so bat ky\n");
> scanf("%d",&n);
> printf("%d",n);
> getch();
> return 0;
>}
>
>After that, I make a shortcut to myprogam.exe
>I want to run the shortcut from cmd, but it doesn't work well.

[Reply or follow-up to this message]

re: How to make shortcut run correctly!
Thursday, April 6, 2006 at 1:33 am
Posted by Thanhbinh (6 messages posted)

I know this forum is for general WinXP issues.However,I still hope someone can help me. Thanks alot


On Wednesday, April 5, 2006 at 10:07 pm, geek9pm wrote:
>Well, first we have to be able to read it...
>
>Hey, this forum is for general Windows XP issues. I doubt any hee even cares about
>this. Whatr is this thing do?
>

>
>
>
>

Geek9pm
>

[Reply or follow-up to this message]

re: How to make shortcut run correctly!
Thursday, April 6, 2006 at 4:29 am
Posted by geek9pm (1438 messages posted)

Well, I will try. It seems that you are wanting to write a program in C and then you want to make a shortcut to it.
In Windows XP shortcuts normally run programs that are ready to go. The shortcut can not prepare the program or make a compilation of it.
In the Windows XP system there are a number of ways to write simple programs to do things. If speed is not very important, there are "scripts" and "macros" that work with programs that have a full set of features.
Programs written in C or similar forms are more primitive and rquire much attention to detail.
Becausae of the limitations of this forum, I can not whow you a full program, becaue some special symbols interfere with the HTML features used here in this message box.
The program you wrote requires a compilar and thne has to be linked with a library for the Windws API.
Simple scipts and jobs in Windows XP can be written without the need of many special symbols . Would you like to see some simple scripts used in Windows XP?

Geek9pm




On Thursday, April 6, 2006 at 1:33 am, Thanhbinh wrote:
>I know this forum is for general WinXP issues.However,I still hope someone can help
>me. Thanks alot
>
>
>

[Reply or follow-up to this message]

re: How to make shortcut run correctly!
Thursday, April 6, 2006 at 5:27 am
Posted by Thanhbinh (6 messages posted)

Oh,Thank you very much.I really want to have a simple script to solve my problem Thanks again


On Thursday, April 6, 2006 at 4:29 am, geek9pm wrote:
>Well, I will try. It seems that you are wanting to write a program in C and then
>you want to make a shortcut to it.
In Windows XP shortcuts normally run programs
>that are ready to go. The shortcut can not prepare the program or make a compilation
>of it.
>In the Windows XP system there are a number of ways to write simple programs to do
>things. If speed is not very important, there are "scripts" and "macros" that work
>with programs that have a full set of features.
>Programs written in C or similar forms are more primitive and rquire much attention
>to detail.
>Becausae of the limitations of this forum, I can not whow you a full program, becaue
>some special symbols interfere with the HTML features used here in this message box.
>
>The program you wrote requires a compilar and thne has to be linked with a library
>for the Windws API.
>Simple scipts and jobs in Windows XP can be written without the need of many special
>symbols . Would you like to see some simple scripts used in Windows XP?
>
>
>
>
>

Geek9pm
>

[Reply or follow-up to this message]

re: How to make shortcut run correctly!
Thursday, April 6, 2006 at 8:02 am
Posted by geek9pm (1438 messages posted)

A simple type of script used before windows becam popular is called "batch" and here is a simple exxample.

@echo hello world
pause

To here is more about this kind of progra go to this:.
http://www.computerhope.com/batch.htm
In Windows XP the batch can only appear in a black box on the screen. But in Windows XP, a more pretty visual kind of script is call "VB" and is more dificult to learn.
First read over the material about batch and seeif that will do what you want.
I must go now, it is daytime here, and I am only a night geek..

Geek9pm




On Thursday, April 6, 2006 at 5:27 am, Thanhbinh wrote:
>Oh,Thank you very much.I really want to have a simple script to solve my problem
>Thanks again
>
>
>

[Reply or follow-up to this message]

re: How to make shortcut run correctly!
Thursday, April 6, 2006 at 7:19 pm
Posted by Thanhbinh (6 messages posted)

Maybe you're not clear much about my problem. My task is that I have to convert from a GUI application to a Console app. When I creat shortcut for my Console app, it doesn't work well. I found that it was not because of the arguments, so I wrote a simple console app(which I posted), the error was the same. I want to fix this error. Plz help me.

[Reply or follow-up to this message]

re: How to make shortcut run correctly!
Thursday, April 6, 2006 at 11:21 pm
Posted by geek9pm (1438 messages posted)

I would like to help, but I do not know what you program must do. I have written many programs that work in the MS-DOS mode of Windows. As I recall, using a shortcut was never a bproblem. If you wish to work in the CMD mode, the shortcut to use is the shortcut to "Command Prompt".
Example: I have a program called "Hello.exe" and it is in the folder C:\BIN I wud make copy of "command prompt" shortcut, edit it to open in C:\BIN and charge other things needed.
I do not understan why you want the shortcut to go directly to the hello program. The hello progam can not take parameters to control the GUI, becaue it is only a console program. It can not tell the GUI where to place a message. The command shortcut automatically creates a box in the GUI. When you call a console program without a consolem you can not have a console. In this case "console" is often called "Ms-Box". If the purose of the program does not require a lasting visible msbox, then that would be OK.
The example you gave displays a message the user will not see, unless he is superman, the console disapears before the message appers.

Geek9pm




On Thursday, April 6, 2006 at 7:19 pm, Thanhbinh wrote:
>Maybe you're not clear much about my problem.
>My task is that I have to convert from a GUI application to a Console app. When I
>creat shortcut for my Console app, it doesn't work well. I found that it was not
>because of the arguments, so I wrote a simple console app(which I posted), the error
>was the same. I want to fix this error. Plz help me.

[Reply or follow-up to this message]

re: How to make shortcut run correctly!
Friday, April 7, 2006 at 12:20 am
Posted by Thanhbinh (6 messages posted)

Thank you very much! But I think I should tell my problem more clearly.Don't care about the app I have, only care about this: the prgram written in VC++(type Win 32 Console): mypro.cpp #include "stdafx.h" #include "conio.h" int main(int argc, char* argv[]) { int n; printf("Hello World!\n"); scanf("%d",&n); printf("%d",n); getch(); return 0; } I make a shortcut to mypro.exe(in Debug) run the shortcut from cmd (run the .lnk from cmd) You will see the difference between run mypro.exe and run the shortcut, both from cmd.What's reason?????? Why are they different.What make the difference. The problem I have when I write my application is maybe the same.If you can answer the question above, I can solve my problem.

[Reply or follow-up to this message]

re: How to make shortcut run correctly!
Friday, April 7, 2006 at 10:36 am
Posted by geek9pm (1438 messages posted)

I will try to tell you. It does work, but you do not understand how it works. The program, by itself, does do have all the features you want.
The enviroment provides a place for your porgram, when you put it into a different envikroment, there are things yhou do no know about.
The program will work inside the vidual studio enviroment.
It is NOT a qulified program to work in the Windows envikroment as a "stand alone". Visual Studio also creates many other parts of the code for you. In Windows, it is not enough to have a bit of code, the code must be jhave other components that will be joined with a library and then made into a file of type EXE.
If you do not follow the rules for making program, it does not work.
some code will look OK inside the envikroment, and it can be good code, but it is not complete..
In Windows XP there are strict requiements for a program to run freely without a helper or a "sheel".
The development enviroment of sisual studio is a enviroment seperate and inside the envikroment of Windows XP.
For example your program uses "conio". Well, inside Visual Studio it ddoes not really use "conio" as would a valid XP program would. Visual Studio provides a envikromnet the offers a substitute for conio.
You need to pay more attention to the documentation. And the results you get depend on version of C++ you are using, etc.

Geek9pm




On Friday, April 7, 2006 at 12:20 am, Thanhbinh wrote:
>Thank you very much!
>But I think I should tell my problem more clearly.Don't care about the app I have,
>only care about this:
>the prgram written in VC++(type Win 32 Console):
>mypro.cpp
>#include "stdafx.h"
>#include "conio.h"
>int main(int argc, char* argv[])
>{
> int n;
> printf("Hello World!\n");
> scanf("%d",&n);
> printf("%d",n);
> getch();
> return 0;
>}
>
>I make a shortcut to mypro.exe(in Debug)
>run the shortcut from cmd (run the .lnk from cmd)
>You will see the difference between run mypro.exe and run the shortcut, both from
>cmd.What's reason??????
>Why are they different.What make the difference.
>The problem I have when I write my application is maybe the same.If you can answer
>the question above, I can solve my problem.

[Reply or follow-up to this message]

re: How to make shortcut run correctly!
Friday, April 7, 2006 at 6:40 pm
Posted by Thanhbinh (6 messages posted)

Thank you very much! Really appreciate for your attention! Thanks again

[Reply or follow-up to this message]

Tip: Use one of the [Reply or follow-up to this message] links above to add a message to this thread
Return to the Windows XP Discussion Forum


All content at Annoyances.org is Copyright ©1995-2012 Creative Elementtm All rights reserved.
Please do not plagiarize; redistributing these pages without permission is strictly prohibited.