|
Thanks Nibu,
I am able to set the icon. But I am getting the assertion error. I'm not able digonse it.
Do you have any other ideas to achieve this?
Thanks Once again,
Sarvan AL
|
|
|
|
|
Click on retry. Debug and find where it's asserting.
Nibu thomas
Software Developer
|
|
|
|
|
Hi Nibu,
This is my code snippet.
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
SetIcon(m_hIcon, FALSE) ;
return TRUE;
}
m_hIcon is CChildFrame's member and I load the icon in the constructor, as follows:
m_hIcon = LoadIcon(AfxGetInstanceHandle(),
MAKEINTRESOURCE(ICON_TEST)) ;
What is wrong with this?
|
|
|
|
|
Yeah, I got it.
I moved the code "SetIcon(..)" into OnPaint(). Now it works.
Thanks a lot Nibu.
Sarvan AL
|
|
|
|
|
Sarvan AL wrote: I moved the code "SetIcon(..)" into OnPaint(). Now it works.
something tells me something is wrong
you must be getting Assertion failures cause the target window is not created yet.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Sarvan AL wrote: I moved the code "SetIcon(..)" into OnPaint(). Now it works.
You are using OnPaint for the wrong reasons.
Nibu thomas
Software Developer
|
|
|
|
|
Sarvan AL wrote: SetIcon(m_hIcon, FALSE) ;
Move this to OnCreate . If you use it here it will assert because the window handle is not created. It is just in PreCreateWindow stage.
Nibu thomas
Software Developer
|
|
|
|
|
I have captured video from webcam and displayed in my dialog.
How can i stop capturing video and disconnect webcam ,when i press Stop button?
JAYARAJ
|
|
|
|
|
J5121982 wrote: I have captured video from webcam and displayed in my dialog.
How?
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
|
MFC doesn't have any functions to handle webcam either you are using DirectX or some third party SDK for this, please specify or paste some code.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Hi All,
I have a small problem with the code snippet below. Can anyone help me out in this. I launched Internet Explorer as a process from my application. I closed the Internet Explorer using the close button and when I use the following code of "OpenProcess", the method still works(meaning that the method is able to the open the process with the specified ID.
HANDLE p = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessIdentifier);
if(p != NULL)
MessageBox(_T("Please check patient context"),_T("EDMS context change"),MB_OK);
can anyone give some info on this please.
|
|
|
|
|
Please try the below method
HANDLE p = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessIdentifier);
DWORD dwEitCode = 0;
if( 0 != hProcess)
{
GetExitCodeProcess( p,&dwEitCode );
if( ( STILL_ACTIVE == dwEitCode )
{
// process is alive
}
else
{
// process is dead
}
Closehandle( p )
}
nave
|
|
|
|
|
Thanks Naveen. Its working as expected.
Could you please tell me what was wrong with my code that I used. I had also checked for NULL of that Handle returned right?
|
|
|
|
|
I too don't know.
But just think.. if OpenProcess return NULL if the process dosen't exists, what's the significants of GetExitCodeProcess() api..
I too was facing the same problem some months back.
nave
|
|
|
|
|
i want to query to a particular URL and return back to answer from this URL through programming if anybody have idea for this please share with me its urgent.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Bankey Khandelwal wrote: its urgent
ok here it is.
BOOL GetWebContent(LPCTSTR szURL, CString &strData)
{
strData = "";
HINTERNET hConnection = InternetOpen("Microsoft Internet Explorer",
PRE_CONFIG_INTERNET_ACCESS,
NULL,
INTERNET_INVALID_PORT_NUMBER,
0);
if (hConnection == NULL)
return FALSE;
DWORD dwSize;
CHAR szHead[] = "Accept: */*\r\n\r\n";
char *szbuf;
HINTERNET hConnect;
if (!(hConnect = InternetOpenUrl(hConnection,
szURL,
szHead,
lstrlen(szHead),
INTERNET_FLAG_DONT_CACHE,
0)))
{
InternetCloseHandle(hConnection);
return FALSE;
}
BOOL bReadInParts = FALSE;
DWORD dwNumberOfBytes = 0;
if (InternetQueryDataAvailable(hConnect,
&dwNumberOfBytes,
0,
0)){
if (dwNumberOfBytes < 0){
bReadInParts = TRUE;
}
else{
szbuf = new char[dwNumberOfBytes+1];
if (!InternetReadFile(hConnect, szbuf, dwNumberOfBytes, &dwSize)){
bReadInParts = TRUE;
}
if (dwSize < dwNumberOfBytes+1)
szbuf[dwSize] = '\0';
strData = szbuf;
delete []szbuf;
}
}
if (bReadInParts){
szbuf = new char[512];
do{
if (!InternetReadFile (hConnect, szbuf, 512, &dwSize)){
return FALSE;
}
if (!dwSize)
break;
if (dwSize < 512)
szbuf[dwSize] = '\0';
strData += szbuf;
} while(1);
delete []szbuf;
}
InternetCloseHandle(hConnect);
InternetCloseHandle(hConnection);
return TRUE;
}
*sorry about the crappy formating copied from production code
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
thanks.
but now problem is that ,this code return html conversion of given url but i want server side script output.
for example:
i have to passed a url and on the server script will run and then i want output of this script.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
what is the script output?
can't you embbed the script in a webpage and output html itself.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Is there any way to change the colour of a HICON object at runtime without creating a new bitmap? Is there any way to get a pointer/reference to a HICON's colour palette info to modify?
Essentially what I need is for the users of a program to be able to change the colours of individual item icons on a tree control at their will.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
typdef struct
{
BITMAPINFOHEADER icHeader;
RGBQUAD icColors[1];
BYTE icXOR[1];
BYTE icAND[1];
} ICONIMAGE, *LPICONIMAGE;
you can use it to modify the bitmap
this[^] page gives more info.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Thanks for the link.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
What is WindowProc and how can i use it. Can anyonepls show a sample code where it is used.Is it a callback function?
|
|
|
|
|
WndProc[^]
Nibu thomas
Software Developer
|
|
|
|
|
AS far as I can understand what you want to ask is that who call's WindowProc function.Is it right?
The Operating system calls a callback function as it receives WM_TIMER message time and again
The syntax of the function is
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|