|
CreateProcess(...) is more better, since you can apply wait on the process created by this API, and also can get the error after execution of your application, but it is slight slower than
winexec(..).
|
|
|
|
|
ShellExecuteEx also provides the ability to wait on the process.
|
|
|
|
|
From the MSDN
CreateProcess:
This function is used to run a new program. It creates a new process and its primary thread. The new process executes the specified executable file.
----------------------
ShellExecute :
Performs an operation on a specified file.
|
|
|
|
|
Thank you for your replies.
Very useful, I forgot how to call an application using VC and now I get it. Thank you.
TRINH.NGUYEN
|
|
|
|
|
I glad you find it
|
|
|
|
|
Win32-based applications should use the CreateProcess function.
You should at least say something such as that and that it is important to read the documentation.
|
|
|
|
|
Sam Hobbs wrote: You should at least say something such as that and that it is important to read the documentation.
but there are 100s of answers look like mine,then why are you telling me only.
|
|
|
|
|
|
You can use also of Winexec or ShellExecute
|
|
|
|
|
Hello,
I was looking at the Video For Windows API. Now I saw the VideoNet tutorial(Gnereral C++ -> Internet -> Peer to Peer) for Video Conferencing. Now to actaully start capturing video frames we use capCaptureSequenceNoFile(m_capwnd)Funtion where m_cpwnd is the driver name for the Webcam. Now I wanted to know what would be the driver name if I wanted to capture my desktop or more importantly to capture a paticular window?
Thanks in advance
|
|
|
|
|
When i am running the application it is crashing .
It is saying that error is at _BLOCK_TYPE_IS_VALID(pHead->nBlockUse).
When i debugged i found that it is crashing at delete[] m_tot.
Object m_tot is having a valid address.But the variables inside are having junk values.
m_tot is declared as TOT* m_tot = new TOT[size],where TOT is the class.
Plz help...its urgent
Thanks in advance.......
|
|
|
|
|
You probably write outside the boundaries of another array whihc has for effect that you overwrite the begining of m_tot. Thus, you get this crash.
|
|
|
|
|
Hello,
A CRecordset object is made whose table is opened after the object is constructed.I don't use Classwizard to make a class derived from CRecortdset.Directly in my class I have an object of type CRecordset.
Now I want to add records to the database for which I wrote an SQL statement using INSERT and
called the CDatabase method ExecuteSQL() which worked fine.
But Now if I want to insert a record whose data is in a variable then I am not able to do it.
How do I do it?
Thanks
Prithaa
|
|
|
|
|
Im sorry do you want to update new record on database?
|
|
|
|
|
I try to draw a line with mouse moves, similar to line-tool of MS Paint-Brush -
see my previous post any idea to draw this line for more.
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&fr=151[^]
I have downloaded several samples, but all of them are incorrect in basic concept, because they all call update function InvalidateRect(0), RedrawWindow(0) etc - if so, there is no neccessary to use Rubber band tech, as my understanding, rubber banding should only update requied pixels (such as a line) and without touching others (right?).
//--- my MFC code is bellow,
//--- I only copy key code for idea.
CPoint ptStart,ptEnd;
BOOL bDraw=0;
OnLButtonDown(UINT nFlags, CPoint pt)
{
bDraw=1;
ptStart=ptEnd=pt;
}
void OnPaint()
{
CPaintDC dc(this);
if(bDraw)
{
CPen penB(PS_SOLID,10,RGB(0,0,0));
CPen*pPenOld=dc.SelectObject(&penB);
dc.MoveTo(ptStart);
dc.LineTo(ptEnd);
dc.SelectObject(pPenOld);
}
}
void OnMouseMove(UINT nFlags, CPoint pt)
{
if(bDraw)
{
CPoint ptT=ptEnd;
ptEnd=pt;
//erase
RenewLine(ptT);
//display
RenewLine(pt);
}
}
RenewLine(CPoint pt)
{
CDC*pDC=GetDC();
CPen penNull(PS_NULL,10,RGB(0,0,0));
CPen*pPenOld=pDC->SelectObject(&penNull);
UINT u=R2_NOT;
// UINT u=R2_XORPEN;
int iROP=pDC->SetROP2(u);
pDC->MoveTo(ptStart);
pDC->LineTo(pt);
pDC->SetROP2(iROP);
pDC->SelectObject(pPenOld);
ReleaseDC(pDC);
}
//ignore mouse up and capure etc.
Result is none of lines can be seen, what is wrong?
|
|
|
|
|
Hi includeh10
includeh10 wrote: have downloaded several samples, but all of them are incorrect in basic concept, because they all call update function InvalidateRect(0), RedrawWindow(0) etc - if so, there is no neccessary to use Rubber band tech, as my understanding, rubber banding should only update requied pixels (such as a line) and without touching others (right?).
I wrote an application that displays multiple models (as boxes) and treats connections between them as rubber bands. I used InvalidateRect(), and although I acknowledge that the technique redraws more of the image than is necessary, I wouldn't go so far as to call it incorrect in concept. It does the job and is plenty fast enough to keep pace with mouse moves, even when there are many connections to redraw. It also seems to be the 'windows way'. I'm not sure how to get parts of the view updated without using invalidation.
I had some problems with flickering background rectangles in early versions, but solved this by using a memory device context and blitting to the view's device context.
Best Regards
Cliff
|
|
|
|
|
if u have an image in size of 2000x2000 pixels at background, you will know what happends by calling InvaliadateRect(0) - even 0 is set as a small rect.
incorrect! definitely.
|
|
|
|
|
I have got it work!
you are 100% incorrect!
|
|
|
|
|
Oh well, it's good to score 100% now and again - it's normally just an aspirational target.
I'm sorry that my reply was unhelpful and glad you have solved the problem.
What's the key to updating the view without invalidation?
Best Regards
Cliff
|
|
|
|
|
didn't i ever already asked you to post your code sample within <pre></pre> tags when you ask or answer something ?
|
|
|
|
|
I tried to connect char myvar[] with + operator.
But it's not work.
This is my code.
// Connect 2 char variables.
char myvar1[]="Hello ";
char myvar2[]="World!";
char myvar3[]=myvar1+myvar2; // It's wrong.
Please help me to solve.
Thank you.
|
|
|
|
|
toeh wrote: I tried to connect char myvar[] with + operator.
The word you are looking for is concatenate.
toeh wrote: char myvar3[]=myvar1+myvar2; // It's wrong.
Because no memory has been set aside for myvar3 . Try:
char myvar3[13];
strcpy(myvar3, myvar1);
strcat(myvar3, myvar2);
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You cannot concatenate C-style strings like that. Either use strcat() or a string wrapper class (std::string , CString , etc.)
|
|
|
|
|
I tried to specify file name with CreateFile().
It requires char* only.
But I would like to form file name from string.
So I have to convert it to char* and take it into function.
Well, how can I convert string to char* ?
Thank you.
|
|
|
|
|