|
system declared in <process.h> or <stdlib.h> compatibility ANSI
system("kill.exe");
NG
|
|
|
|
|
using system() , such as WinExec() is deprecated...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
then him can use... CreateProcess(NULL, "C:\\Program Files\\MyApp", ...)
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
"MyApp.exe", // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
NG
-- modified at 4:52 Monday 5th September, 2005
|
|
|
|
|
|
::ShellExecute() is the function for you.
you could take a look at the MSDN[^] to see how it works
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
bryan523 wrote:
we have to use C++ to call exe program??
In Continuation With Mr. Tox.... you can refer this article too... http://www.codeproject.com/system/newbiespawn.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Thanks for urs information!
i still trying to understand all the function
but its very deep for me to really understand!
i think i need a full example to show hw a simple application can calling out for function like calling out a windows calculator function?
i really need urs help, thanks!
|
|
|
|
|
::ShellExecute(NULL, "open", "myProg.exe", "", "", SW_SHOW);
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
WHen i try below code then got three error!
so, wht should i put as my identifier?
#include "stdio.h"<br />
#include "string.h"<br />
#include<conio.h><br />
<br />
int main(int argc, char *argv[])<br />
{<br />
::ShellExecute(NULL, "open", "myProg.exe", "", "", SW_SHOW); <br />
return 0;<br />
}
-error C2039: 'ShellExecute' : is not a member of '`global namespace''<br />
-error C2065: 'ShellExecute' : undeclared identifier<br />
-error C2065: 'SW_SHOW' : undeclared identifier
|
|
|
|
|
bryan523 wrote:
::ShellExecute(NULL, "open", "myProg.exe", "", "", SW_SHOW);
ShellExecute Api cannot be executed in Console Mode, you have to use system() function
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
2 possibilities :
1- you didn't read the link on the MSDN i gave you describing how ShellExecute() works
2- you didn't see you had to #include <shellapi.h>
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
toxcct wrote:
you didn't see you had to #include <shellapi.h>
Hain Tox,
Sorry for correcting you, Shell Function caanot be executed in dos mode/ console mode
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
yeah, i've seen your previous post.
actually, it depends if he has to execute his program in pure DOS mode, or if it will run under command windows in Win2000, XP, etc, where DOS don't exist anymore, and is emulated... it would work in the later cases...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Thanks toxcct, Neagoe, Alok!
I manage to do it liao!
toxcct,Alok
i still dun knw hw to use shellExecute!
I will be very appreciate if u can show to me hw to use?
i using code below and its ok:
#include "stdio.h"<br />
#include "string.h"<br />
#include<conio.h><br />
#include <stdlib.h><br />
<br />
int main(int argc, char *argv[])<br />
{ <br />
(void)system("C:\\ShutDown.exe");<br />
return 0;<br />
}
-- modified at 6:11 Monday 5th September, 2005
|
|
|
|
|
wow wow wow, don't #include stdio.h and string.h as if they were project local headers...
they are standard files, you have to include them inside <>
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Is there a way for me to get the rect of one cell in CListCtrl when dealing with NM_CUSTOMDRAW (reflect)?
|
|
|
|
|
http://www.codeproject.com/listctrl/lvcustomdraw.asp[^]
NMLVCUSTOMDRAW::rcText is the rectangle.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
If you have a member variable that points to the CListCtrol you can access to each item dimensions through
GetItemRect[^] inside the reflected message.
MArc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CRect rcItem(lpDrawItemStruct->rcItem);
int nItem = lpDrawItemStruct->itemID;
....
}
NG
|
|
|
|
|
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
It even doesn't enter the message handler.
|
|
|
|
|
Override CComboBox::DrawItem .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Custom draw is a feature supported only by the common controls. For the standard builtin Windows controls, you have to implement owner draw, which is a bit more involved.
Software Zen: delete this;
|
|
|
|
|
Hi all,
Can we find programmatically what the FileType(whether it's PC or UNIX) of a text file? Is there any API available?
Please suggest.
Thanks,
Mani
|
|
|
|
|
text files are identical on all operating systems..... UNIX , WINDOWS, LINUX
NG
|
|
|
|