|
I read link document, dive into many options and disapear.
could you give me some frequently used option?
for example : detect all un-initialized variable or something good.
|
|
|
|
|
if I am not indicate a head file is a library header file, what wrong will arise?
|
|
|
|
|
This is a continuation from my earlier thread so all could respond. When I try to open an executable from my program using the following line it opens the executable then immdiatley closes it.:
ShellExecute(NULL,_T("open"),_T("cd1\\CBTNuggetPlayer.exe"),NULL,NULL,SW_SHOW);
The executable is a GUI and it opens fine if I go to the directory and double click on it, but it wont open the window when I try to open it from my program. As I said earlier, I am using a relative path since my program will be at the root of a CD and the executable will be 1 to 2 layers down as it is here.
Anyone know why?
thanks
|
|
|
|
|
Using relative paths is *always* asking for trouble. The fact that ShellExecute() doesn't appear to be working indicates that it's not finding the EXE
How do you know somebody won't copy your CD to a hard disk and run it from there? How do you know what the *current directory* will be when your main program is run. ShellExecute() starts from the current directory, not where the main program lives.
I always figure out where my main program is using GetModuleFileName() and generate absolute paths relative to that.
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
Yes, I do understand that it starts from the current directory, that is why I start the relative path from the my program will be which is one directory up the tree which would be cd1/CBTNuggetsPlayer.exething I needed to know is the proper format for a relative path so i know I am doing it right.
|
|
|
|
|
CNewbie wrote: ShellExecute(NULL,_T("open"),_T("cd1\\CBTNuggetPlayer.exe"),NULL,NULL,SW_SHOW);
ShellExecute(NULL,_T("open"),_T(".\\cd1\\CBTNuggetPlayer.exe"),NULL,NULL,SW_SHOW);
Nibu thomas
Software Developer
|
|
|
|
|
Just updating, I tried this and it still will not open the window, I just see the executable open in task manager then 1 second later it closes and I never see any window open:
ShellExecute(NULL,_T("open"),_T(".\\cd1\\CBTNuggetPlayer.exe"),NULL,NULL,SW_SHOW);
not sure what else to try. I've gone through the flags to no avail.
|
|
|
|
|
Hey all;
i'm just wondering if any1 can help me with this basketball score board i've create ...
The goal of this is to complete a C++ program that reads from the user
- The current quarter (1,2,3 or 4)
- The remaining time to play in this quarter (in min and sec)
- The score of the home team
- The score of the away team
The program should then be able to determine what should be the scoreboard at the end.
The program should output the scores rounded to the nearest multiple of 5.
Note that 2.5 should be rounded to 5.
|
|
|
|
|
This wouldn't happen to be your homework, would it?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Don't jump to conclusions! Maybe he's really into basketball
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
Hi,
Iam trying to add some controls of MFC to WIN32.
|
|
|
|
|
|
I am getting an error on this line:
ShellExecute(NULL,NULL,"Cisco CCNP Exam 642-801\\cd1\\CBTNuggetPlayer.exe",NULL,"",SW_SHOWDEFAULT);
and the error is:
error C2664: 'ShellExecuteW' : cannot convert parameter 3 from 'const char [48]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
I am using a relative path as my program will be executed from the root of a CD and will attempt to open a file 2 layer down the directory tree.
thanks
|
|
|
|
|
CNewbie wrote: ShellExecute(NULL,NULL,"Cisco CCNP Exam 642-801\\cd1\\CBTNuggetPlayer.exe",NULL,"",SW_SHOWDEFAULT);
ShellExecute(NULL, NULL, _T("Cisco CCNP Exam 642-801\\cd\\CBTNuggetPlayer.exe"), NULL, _T(""), SW_SHOWDEFAULT);
Nibu thomas
Software Developer
|
|
|
|
|
Thanks that fixed the errors and taught me something . Now it opens CBTNuggetPlayer.exe like it is supposed to but then it closes right away. No Window or anything. Why would that happen?
Thanks
|
|
|
|
|
CNewbie wrote: Thanks that fixed the errors and taught me something . Now it opens CBTNuggetPlayer.exe like it is supposed to but then it closes right away. No Window or anything. Why would that happen?
Can't say anything specific. Just a guess, does it require a command line argument?
Nibu thomas
Software Developer
|
|
|
|
|
no, I can go to the exe and double click and it opens fine. it is a GUI based exe. but trying to open it from my program doesnt bring up the window. Just opens the exe and then it closes without a window being drawn.
|
|
|
|
|
Try this...
ShellExecute(NULL, NULL, _T("Cisco CCNP Exam 642-801\\cd\\CBTNuggetPlayer.exe"), NULL, NULL, SW_SHOWDEFAULT);
A suggestion: Check out CreateProcess[^].
A Demo[^]
Nibu thomas
Software Developer
|
|
|
|
|
TEXT("Cisco CCNP Exam 642-801\\cd1\\CBTNuggetPlayer.exe")
or
_T("Cisco CCNP Exam 642-801\\cd1\\CBTNuggetPlayer.exe")
|
|
|
|
|
also set the 2nd parameter to "open"
|
|
|
|
|
I have to face an assertion when i try to delete some component (textbox, button,and these methods) frequently. After delete these componet and methods, i can't compile successful although it's ok before. It's very difficult for me to modify a project. Can you recommend me the best way to modify these component in Visual C++.
Thanks so much.
Thuan Pham, student of Ha Noi university of technology.
|
|
|
|
|
In addition, I use MFC project.
Thuan Pham, student of Ha Noi university of technology.
|
|
|
|
|
I have just try some more. When i try to delete every component which have member variable, the exception: "Access violation" occur. I can delete other components successfully.
Thuan Pham, student of Ha Noi university of technology.
|
|
|
|
|
hai Thuan,
if you are in MFC, better delete the methods and variables in the ClassWizard.
I think no need to modify the program. And then delte the corresponding component in the dialog box.
Helping others satisfies you...
|
|
|
|
|
Thuan_pham wrote: I have to face an assertion when i try to delete some component (textbox, button,and these methods) frequently
Delete from where?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|