|
As the other replies said, the trick is to take a snapshot of the desktop, then put a window on top using that image.
To make the area outside your selection be a bit darker, rather than black, I used GDI+:
In the following, I've already attached a Graphics object to a HDC, pts is an array of PointF's, and nPoints is the size of that array.
You could just make a rectangular exclude-from-shading area too, of course.
CRect rcClient;
GetClientRect (&rcClient);
Color clrBrush (128,0,0,0);
SolidBrush brush (clrBrush);
GraphicsPath path;
path.AddPolygon (pts, nPoints);
Region region (Rect (rcClient.left, rcClient.top, rcClient.Width (), rcClient.Height ()));
region.Exclude (&path);
gfx.FillRegion (&brush, ®ion);
This does the effect over the whole of a window - your window will probably be larger than mine, but the point remains.
I hope that helps,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Thanks Iain, see my reply to ARJ 09 above.
|
|
|
|
|
I want to modify MSPaint's Save file dialog's default file type to JPG using SetWindowsHookEx In the hook function what message should I look for to get at GetSaveFileName ?
|
|
|
|
|
Patcher32 wrote: I want to modify MSPaint's Save file dialog's default file type to JPG using SetWindowsHookEx
I don't know that you can hook into another program without replacing a dll that is used by the application. And even if you did, you still need to figure out what message MSPaint uses to signal File Save. However, if you do figure out how to do this I would be very interested in the solution.
|
|
|
|
|
I have following header file defines
test2.h ----------> header file
template<class T>
class temp2
{
public:
temp2();
virtual ~temp2();
};
test1.h ----------> header file
template<class T>
class temp1
{
public:
temp1(temp2<T> (temp2<T> *temp2ptr);
~temp1(temp2<T> ();
protected:
temp2<T> *tempptr;
};
test3.h -------------> header file
class test3
{
public:
test3();
virtual ~test3();
};
template<class T> temp1<T>::temp1(temp2<T> *temp2ptr)
{
tempptr = temp2ptr;
}
main.h ----------> header file
temp1 *maintemp1;
temp2<test3> maintemp2;
and in main.cpp -------> source file I am creating an object for this like given below
maintemp1 = new temp1(&maintemp2);
Now when I compile I am getting error
error C2955: 'temp1' : use of class template requires template argument list
can any body tell me what is the wrong with my code block ..
modified on Monday, October 19, 2009 4:13 PM
|
|
|
|
|
Please format properly the code snippet using the code block button.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
temp1 is a class template. You haven't provided any template arguments when using temp1. How could the error message possibly be any clearer?
You need to declare maintemp1 as:
temp1<test3> *maintemp1;
and use it like this:
maintemp1 = new temp1<test3>(&maintemp2);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Is it possible for a service under windows XP to hook for example mouse or keyboard?
I have tried to call SetWindowsHookEx inside a windows service but the callback
function receives no messages. If yes how can it be done.
I know already about desktop interactive option for a service and SetTheadDesktop etc but none
of them work. I also tried impersonation, to give the hooking thread a specific process token
no luck there too.
Thanx
|
|
|
|
|
I guess it will not work in the default SYSTEM account.
Check it by running the service in another user context.
|
|
|
|
|
I have the same problem.
Service sets out under the Admin account.
SetWindowsHookEx does not intercept the message, what's the problem?
|
|
|
|
|
I have the same trouble too.
|
|
|
|
|
I am writing a WinAPI app and trying to use some code to make a systray icon. However, when I pass in the HWND into the class as below:
.h
public:<br />
HWND m_hParentWnd;
.cpp
void CTrayIcon::OnCreate(HWND parent, UINT uCallbackMessage, HICON icon)<br />
{<br />
m_hParentWnd = parent;
there is an unhandled exception:
Unhandled exception at 0x00415799 in blueline.exe: 0xC0000005: Access violation writing location 0x00000004.
The contents of parent is:
parent: 0x000b0d30 {unused=??? }
unused = CXX0030: Error: expression cannot be evaluated
It wuld be amazing if someone could suggest a direction to look in. I have found somebody with a similar problem, but they didn't get a responce.
Nicola.
|
|
|
|
|
can you show us the code where you create your CTrayIcon instance, and when you call Create ?
|
|
|
|
|
In most of the cases, this is due to the fact that you are manipulating a pointer to a CTrayIcon instance, and this pointer is NULL.
|
|
|
|
|
Do you mean if you comment out this line
m_hParentWnd = parent; then everything works fine?
parent: 0x000b0d30 looks like a valid windows handle. no problem with that.
Since you are getting write access violation, it means you are trying to write to an invalid location, now which location is that and why it is invalid seems hard to tell with the information you have provided..
|
|
|
|
|
Okay, I was looking in the wrong place for issues. The CTrayIcon object isn't being set up correctly. Thank you all for your help, it's really appreciated!
Nicola.
|
|
|
|
|
Dear All,
I am not able to Find the Wrong with the Following Code.
Please Help me out.
SQLHENV envHandle;
SQLHDBC ConnHandle;
SQLHSTMT StmtHandle;
SQLRETURN Ret;
SQLSMALLINT szConnStroutlen;
SQLCHAR sZ_AuthorName[50];
SDWORD sdoutputDataLen;
unsigned char szConnStrout[255];
Ret = ::SQLAllocEnv(&envHandle);
Ret = ::SQLAllocConnect(envHandle,&ConnHandle);
Ret = ::SQLDriverConnect(ConnHandle,
NULL,(SQLWCHAR *)_T("Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\\Uday.mdb"),
SQL_NTS,(SQLWCHAR*)szConnStrout,sizeof(szConnStrout),&szConnStroutlen,SQL_DRIVER_NOPROMPT);
Ret = ::SQLAllocStmt(ConnHandle,&StmtHandle);
//To Fetch a Relative Record.
Ret = SQLFetchScroll(StmtHandle,SQL_FETCH_FIRST,0); //The Code is Failing here.
Thanks & Regards,
Uday.
|
|
|
|
|
janaswamy uday wrote: Ret = SQLFetchScroll(StmtHandle,SQL_FETCH_FIRST,0); //The Code is Failing here.
Why?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
janaswamy uday wrote: Ret = SQLFetchScroll(StmtHandle,SQL_FETCH_FIRST,0); //The Code is Failing here.
According to thedocumentation[^], you should be looking into the return value of the function, and then based on the return value, you should be able to identify the reason for failure (if any). Have you done the diagnostics? Why does it fail?
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Dear Rajesh,
If i really know why should i post this message. I have really Struk with this. If you have any Idea please Help me Out. I am in deep trouble. I want to know this Concept. Please Help Me Out with proper Solution.
Thanks & Regards,
Uday.
|
|
|
|
|
janaswamy uday wrote: If i really know why should i post this message. I have really Struk with this. If you have any Idea please Help me Out. I am in deep trouble. I want to know this Concept. Please Help Me Out with proper Solution.
I'm sorry to know that you're in deep trouble.
The said function returns a value that you should check. If the function fails, the return value actually tells why did it fail so. Take a look at the "diagnostics" section of the documentation page to know more.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
I use Win32 Dynamic-Link Library and I would like to create a member that can show something like a MessageBox with OK button (Exit), it also shows a message (ie: "Please enter your comments in the User Input") and a TextBox input.
After the user entering his/her comments then hits OK button, it will return the user input!
Do we have any thing available like that? If not, might anyone help me on this?
Thanks in-advanced
|
|
|
|
|
THAQCD wrote: Do we have any thing available like that? If not, might anyone help me on this?
Yes it's called a Dialog Box[^] (CDialog if MFC).
|
|
|
|
|
Hi Richard,
I am trying to get any codes related to your link (only information) & others in order to create a Dialog box from my Win32 Dynamic-Link Library project ... but couldn't find any thing yet!
Any suggestion?
Thanks for help
|
|
|
|
|
The link he gave you was a good one. The fact you're asking a basic question (nothing wrong with being at the start of something) means you have a lot of learning to do. The link he gave you is Microsoft's explanation of the concepts.
There are many links throughout that article pointing to more specific things.
As for an actual function?
Try: DialogBox, or CreateDialog.
You'll also need a Dialog resource. And if you're in pure Win32, you'll have to learn about instance handles.
(All of this is googlable - I'm trying to give you search terms)
If you're starting from nothing, then this is not easy stuff. Don't expect to solve it in 10 minutes.
Also, you cannot expect someone here to write "codez" for you that will do exactly what you want. What he was trying to do was to steer you at learning material so you can do it yourself - or at least start to, and ask more detailed questions later.
Good luck,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|