|
kcynic wrote: I want to do is destroy a child window before its parent would be drawn.
Why create the child window if you want to destroy it before the parent is drawn?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I am sorry I did not explain it clearly.
The child window should be destroyed because it has some initialization did not be done successfully although it was create successfully.
So I must destroy it ,otherwise ,there would be an exception when its parent is about to be drawn.
GOOD LUCK
|
|
|
|
|
CWnd::DestroyWindow() takes care of destroying the HWND associated with the CWnd.
If you want to wait until initialization of the child window succeeds/fails before showing the
child window then create the child without the WS_VISIBLE style. If initialization succeeds call
ShowWindow(SW_SHOW). If it fails, maybe post a message to the parent and let the parent use
DestroyWindow() to destroy the child and also free the CWnd-derived object as well.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Yes,it works well,now.Thanks
|
|
|
|
|
Hi all
I am trying to learn few things like
- remote network management using VC++ . How to manage network elements like routers, masks LAN groups ? (Does WMI provide any classes for it ? I searched Win32 classes and found no reference to such things but I can see more monitoring classes. If not WMI what else gives us the facility ?)
- remote management using WMI . I would like to create/remove user accounts on remote PCs , create/delete folders etc.
Any ideas pls ?
redindian
|
|
|
|
|
|
Hi all.
I have problem wen I try to start process, wen I write:
<br />
try<br />
{<br />
STARTUPINFO lpStartupInfo;<br />
PROCESS_INFORMATION lpProcessInformation;<br />
<br />
memset(&lpStartupInfo,0,sizeof(STARTUPINFO));<br />
lpStartupInfo.cb = sizeof(lpStartupInfo);<br />
<br />
CreateProcess(<br />
L"C:\\vaxo\\My.exe",<br />
NULL,<br />
NULL,<br />
NULL,<br />
FALSE,<br />
CREATE_NEW_CONSOLE,<br />
NULL,<br />
NULL,<br />
LPSTARTUPINFO lpStartupInfo,<br />
LPPROCESS_INFORMATION lpProcessInformation<br />
);<br />
}<br />
<br />
catch()<br />
{<br />
}<br />
<br />
in this code my program starts new process, but if I try to set console string I get some debag error:
"Unhandled exception at 0x77e4ae84 in Process.exe: 0xC0000005: Access violation writing location 0x00418312."
Console string is "C:\\vaxo\\My.exe", I try "C:\vaxo\My.exe", but I stile get this error message
|
|
|
|
|
Did you initialize lpProcessInformation ?
See the example below
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
si.lpReserved = NULL;
si.lpReserved2 = NULL;
si.cbReserved2 = 0;
si.lpDesktop = NULL;
si.dwFlags = 0;
if(!CreateProcess(NULL,
"Yourpathhere",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi))
{
...failed
}
redindian
|
|
|
|
|
Thanks for help.
but I still have this problem.
|
|
|
|
|
did it work ?
redindian
|
|
|
|
|
thanks for help.
but I still have this problem
|
|
|
|
|
Will this even compile? Look at the last two arguments to CreateProcess .
Lose the try /catch blocks; CreateProcess doesn't throw exceptions to indicate errors and any exceptions it does throw (such as access violations) will almost certainly be your fault and should be allowed to propergate to the debugger so the problem can be fixed. I’ll gloss over the issue that the fact that try /catch can even catch access violations (and other such exceptions) is non-standard and later MS compilers have been fixed in this regard (although the old buggy behaviour can be re-enabled via a compiler switch).
Here's an example:
#include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
STARTUPINFO si = {0};
si.cb = sizeof(si);
si.lpTitle = "Use this as the title!";
PROCESS_INFORMATION pi;
BOOL bOK = CreateProcess(
"C:\\Commands\\AnyKey.exe",
NULL,
NULL,
NULL,
FALSE,
CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi
);
if (bOK)
{
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
return 0;
}
Steve
|
|
|
|
|
thanks. it help, but now I get another problem.
I can start my process, but tis process is console and I must set parametrs in command line. and I dont know how to do this.
|
|
|
|
|
hye,
i m trying to record video on motion detection in VC++.
Can anybody tell the exact procedure i should apply
motion detection has started but i dnt know how to write code for recording the video on motion detection.....
Neha
|
|
|
|
|
There isn't a exact procedure to implementing motion detection. There are many algorithms for doing that, and searching the articles on this site anf google should bring up some results.
Good luck
|
|
|
|
|
i have used following four functions for motion detection part only:
1)AdjustMotionDetectPrecision()
2)SetupMotionDetection()
3)StartMotionDetection()
4)MotionAnalyzer()
using these four functions,motion detected has started.
but i dnt knw how to start recording????
i m sending u some code :
here it is::::
if(frameType > 0)
{
if(frameType == PktSysHeader)
{
memcpy(FileHeader[channelNum], DataBuf, Length);
FileHeaderLen = Length;
}
if(frameType == PktIFrames || frameType ==PktSubIFrames)
{
status = 1;
}
else
{
status = 0;
}
if(frameType == PktMotionDetection)
{
int result[4];
if(bOverlayMode)
{
hkdlg->m_VideoWin.DrawVectEx(channelNum, (char *)DataBuf);
}
else
{
hkdlg->m_bMoving[channelNum] = TRUE;
memcpy(motionData[channelNum],(char*)DataBuf,Length);
}
MotionAnalyzer(ChannelHandle[channelNum],(char*)DataBuf,15,result);
if((result[0] + result[1] + result[2] + result[3]))
{
if (channelNum ==0)
TRACE("!!!!!!!CH=%d motion detect result is %d %d %d %d\n",channelNum,result[0],\
result[1],result[2],result[3]);
//The function Trigger() do the following operation: write the video&audio data which are before the motion frame to file
if(!hkdlg->baftermotion[channelNum])
alarmFile[channelNum].Trigger(gFileHandle[channelNum]);
//when the motion frame returns,clear ualreadywriteframes[channelNum] and set it as 0 ,be ready for writing the video&audio data after motion
hkdlg->ualreadywriteframes[channelNum]=0;
hkdlg->baftermotion[channelNum]=TRUE;
}
return 0;
}
if(frameType == PktOrigImage)
{
return 0;
}
In this code should i start recording after motionanalyser() function?????????????
Neha
|
|
|
|
|
I am searching about an object on the codeproject and sudden see Motion Detection Algorithms[^] and remembered that a OP aksed about motion detection so I repled to you.;)
|
|
|
|
|
Is there some way how to disable playing of the system sounds (stored in registry) or any sounds for some process only?
I need to turn off sounds in webbrowser hosted in my application but I don't want to turn them off for IE globally.
Thank you!
rrrado
|
|
|
|
|
|
Thank you but this will disable sounds not only for my webbrowser but also for IE
rrrado
|
|
|
|
|
WhiteSky wrote: and see http://www.codeproject.com/audio/mixerSetControlDetails.asp[^] of DavidCrow is helpfuls for you.
Which would disable all sounds. Not exactly the desired result.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry for my poor English .
There is a way to resolve this issue , but I didn't try it . That is to write a monitor-program hook all playsound funtion and make it(playsound funtion) disabled for the process.
|
|
|
|
|
But how can I hook to PlaySound calls?
rrrado
|
|
|
|
|
Sorry for my poor English .
You should study the hooks .
If you search the hook as the keyword in this website, you could find something.
|
|
|
|
|