|
I use EnumWindows.
And if WM_CLOSE doesn't work, try WM_SYSCOMMAND with a wParam = SC_CLOSE, or something like that (explorer windows, like 'My Computer', close like that).
There probably is a better way, there must be, if u can afford to search.
|
|
|
|
|
hai...
for each and every process if its starts running then,the name like"outlook.exe" is getting displayed in task manager.
using "CreateToolhelp32Snapshot" you can able to take a snapshot for the process which are running in task manager.
then using this...you do string compare function with the "outlook.exe"...
if both are matches...
then for closing a process "Terminate process " API is available...
use that ....thats all....
|
|
|
|
|
D.Mani wrote: then for closing a process "Terminate process " API is available...
It's sad that you would even suggest this.
"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
|
|
|
|
|
Hi,
How can i close a running apllication through programming.
I have a application ,i want whenever i run my application MS-Outlook should be clode,if running.
How can i do this.
|
|
|
|
|
|
Hi Guys,
I would like to ask u brilliant people that i have a problem in creating and adding a menu at runtime. Till now i have created a menu and also loaded in the output but the problem that i am facing is that i am unable to add menu items to it and the functionality of those.
I am using MFC's CMenu class for doing this
Pls Help me!!
Regards,
Pankaj Sachdeva
|
|
|
|
|
How did you try to insert menu? did you use of CMenu::InsertMenu or CMenu::AppendMenu
|
|
|
|
|
Till now i did this sir
CMenu *pMenu = GetMenu();
pMenu->AppendMenu(MF_POPUP,0,"Heading");
but the problem is that i m unable to add menu items or submenu to it and also not able to attch coress functions to it
|
|
|
|
|
|
used insertmenu function too but it works same as appendmenu
|
|
|
|
|
If you run exmaple of MSDN and use of this code
submenu->AppendMenu(MF_POPUP, (UINT) submenu->m_hMenu, "&File");
it creates a popup menu for you did you try it?
|
|
|
|
|
|
I have many ComboBox on my Dialog Box. I want those ComboBox execute same handler on event ON_CBN_SELCHANGE .Is it possible.Pls help me
Thanx in advance
never say die
|
|
|
|
|
i think this will work for me
ON_CONTROL_RANGE(wNotifyCode, id1, id2, memberFxn )
never say die
|
|
|
|
|
Hi,
I am kind of new for Hooks.
I have to make a keyboard hook for different applications.
But what i wish to do is my hook should be the last one just before the actual application from other hooks (if there is any) even user runs the hooking applications and the actual application in any order.
Thanks in advance
|
|
|
|
|
If you install a hook, your applications hook will be called first. If another application installs a hook after some time, then that applications hook willl be called first and then that application calls your hook using the CallNextHookEx (). So you dont have to mind the hook installed after your application has started.
So in your hook funtion, call the CallNextHookEx() first( this will call all the preinstalled hooks ) then only do the processing you want. Thus your hook will become the last one.
|
|
|
|
|
Thanks Naveen
|
|
|
|
|
Hi, i need draw a fog background, i search Internet find a source, but it run slow, how to optimize these code let it run fast( i nill malloc memory in twice, i want to unite DrawGradient function and ApplyTransformation function). or tell me other draw example.
Thanks.
<br />
#if !defined(AFX_GRADIENTRENDER_H__9B3090DB_F7D0_4D23_8BDA_9CFAC9A64ABE__INCLUDED_)<br />
#define AFX_GRADIENTRENDER_H__9B3090DB_F7D0_4D23_8BDA_9CFAC9A64ABE__INCLUDED_<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
<br />
class CGradientRender <br />
{<br />
private:<br />
unsigned char* m_Data;<br />
void ApplyTransformation(int width, int height);<br />
<br />
public:<br />
void DrawGradient( HDC hDC, RECT& rect, COLORREF startColor, COLORREF endColor);<br />
<br />
CGradientRender();<br />
virtual ~CGradientRender();<br />
<br />
};<br />
<br />
#endif // !defined(AFX_GRADIENTRENDER_H__9B3090DB_F7D0_4D23_8BDA_9CFAC9A64ABE__INCLUDED_)
<br />
#include "stdafx.h"<br />
#include "GradientRender.h"<br />
#include "math.h"<br />
<br />
#ifdef _DEBUG<br />
#undef THIS_FILE<br />
static char THIS_FILE[]=__FILE__;<br />
#define new DEBUG_NEW<br />
#endif<br />
<br />
<br />
CGradientRender::CGradientRender()<br />
{<br />
m_Data = NULL;<br />
}<br />
<br />
CGradientRender::~CGradientRender()<br />
{<br />
if ( m_Data != NULL )<br />
delete m_Data;<br />
}<br />
<br />
void CGradientRender::DrawGradient( HDC hDC, RECT& rect, COLORREF startColor, COLORREF endColor)<br />
{<br />
int i, j;<br />
double r;<br />
int X, Y;<br />
double fi;<br />
int width = rect.right - rect.left;<br />
int height = rect.bottom - rect.top;<br />
int size = height*width*4;<br />
double radius = sqrt( pow(height/2,2) + pow(width/2,2) );<br />
double R = sqrt( pow(width/4,2) + pow(height/4,2) );<br />
<br />
m_Data = new unsigned char[size];<br />
<br />
for ( i=0; i<height; i++ )<br />
{<br />
for ( j=0; j<width; j++ )<br />
{<br />
r = sqrt( pow(double(i-height/2)/radius,2) + pow(double(j-width/2)/radius,2) );<br />
if ( r <= 1.0 )<br />
{<br />
m_Data[i*width*4 + j*4] = (unsigned char)(r*GetBValue(endColor) + (1-r)*GetBValue(startColor));<br />
m_Data[i*width*4 + j*4+1] = (unsigned char)(r*GetGValue(endColor) + (1-r)*GetGValue(startColor));<br />
m_Data[i*width*4 + j*4+2] = (unsigned char)(r*GetRValue(endColor) + (1-r)*GetRValue(startColor));<br />
}<br />
else<br />
{<br />
m_Data[i*width*4 + j*4] = GetBValue(endColor);<br />
m_Data[i*width*4 + j*4+1] = GetGValue(endColor);<br />
m_Data[i*width*4 + j*4+2] = GetRValue(endColor);<br />
}<br />
<br />
}<br />
}<br />
<br />
<br />
ApplyTransformation( width, height );<br />
<br />
HBITMAP hBitmap = (HBITMAP)CreateBitmap( width, height, 1, 32, m_Data );<br />
<br />
HDC hMemDC = CreateCompatibleDC(hDC);<br />
HBITMAP hOldBitmap = (HBITMAP)SelectObject( hMemDC, hBitmap );<br />
<br />
BitBlt( hDC, rect.left, rect.top, width, height, hMemDC, 0, 0, SRCCOPY );<br />
<br />
SelectObject( hMemDC, hOldBitmap );<br />
DeleteDC(hMemDC);<br />
DeleteObject(hBitmap);<br />
delete m_Data;<br />
m_Data = NULL;<br />
}<br />
<br />
void CGradientRender::ApplyTransformation(int width, int height)<br />
{<br />
int X, Y;<br />
double r, fi;<br />
double R = sqrt( pow(width/4,2) + pow(height/4,2) );<br />
<br />
int size = height*width*4;<br />
unsigned char* newBuffer = new unsigned char[size];<br />
memcpy( newBuffer, m_Data, size );<br />
<br />
for ( int i=0; i<height; i++ )<br />
{<br />
for ( int j=0; j<width; j++ )<br />
{<br />
fi = atan(double(i-height/2)/double(j-width/2));<br />
r = sqrt( pow((i-height/2),2) + pow((j-width/2),2) );<br />
X = int((pow(r,2)/R)*cos(fi));<br />
Y = int(fabs((pow(r,2)/R)*sin(fi))) % height;<br />
newBuffer[i*width*4 + j*4] = m_Data[Y*width*4 + X*4];<br />
newBuffer[i*width*4 + j*4+1] = m_Data[Y*width*4 + X*4+1];<br />
newBuffer[i*width*4 + j*4+2] = m_Data[Y*width*4 + X*4+2];<br />
}<br />
}<br />
<br />
memcpy( m_Data, newBuffer, size );<br />
delete newBuffer;<br />
}
|
|
|
|
|
How about the GDI+. check the Graphics classs and LinerGradientBrush in the GDI+.
|
|
|
|
|
Oh, thanks. But i don't want use GDI+.
|
|
|
|
|
|
Those Question source code, copy from CGradientRender.
|
|
|
|
|
HOW WHAT wrote: but it run slow, how to optimize these code let it run fast( i nill malloc memory in twice, i want to unite DrawGradient function and ApplyTransformation function). or tell me other draw example.
Use GradientFill .
|
|
|
|
|
But how to use GradientFill draw fog background...
|
|
|
|
|
How can i set my LAN network bandwidth to a specific value ?
BEST REGARDS
|
|
|
|
|