|
Well, that depends which path you took, if you checked out this[^] link and read the Using Layered Windows section you can either simply paint it blue in OnPaint or create a bitmap, paint it blue and use UpdateLayeredWindow . It mostly depends on your needs. Since you want a blue triangle, as i understood, you could use the WM_PAINT aproach with SetLayeredWindowAttributes[^] and next to the alpha value specify a colorkey, then fill your dialog in WM_PAINT with the "hollow color" and then paint a blue triangle onto this.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Quote: "Hit testing of a layered window is based on the shape and transparency of the window. This means that the areas of the window that are color-keyed or whose alpha value is zero will let the mouse messages through."
I think layered windows is JUST what I need, thank you so much.
It might sound odd, but since I am really new to all this, would you know of a place where I can find a project for Layered windows so I can explore it a bit more ?
|
|
|
|
|
Well, not really, sorry, but Google[^] is your friend and your search is as good as mine, and also you can look around here at Codeproject, there should be such articles or examples like this one[^] for example. Good luck.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
ok, thanks a bunch Code-o-mat !
|
|
|
|
|
Hi,
In a nutshell: I need to display the location of the cursor when I click somewhere in the Windows Calculator window (or any other app beside my own).
I need to get the cursor position on the click event (WM_LBUTTONDOWN) when the click occurs in another window. In my test I am using calculator. I display with GetMessagePos or GetCursorPos the coordinates in 2 textboxes under the mouse move but whenever it goes beyond my app window, of course, my app message loop stop receiving those mouse move events.
This is in a barebone win32 no MFC app.
Thanks!!!
Antoine
|
|
|
|
|
Orchus wrote: In a nutshell: I need to display the location of the cursor when I click somewhere in the Windows Calculator window (or any other app beside my own).
You will need a global mouse hook to trap mouse events that occur outside of your application window. The following tutorial describes about hooks and DLLs in general, and has a sample mouse hook as well: http://www.flounder.com/hooks.htm[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Are you looking for SetCapture() ?
"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
|
|
|
|
|
Hi,
Thank you for answering.
In this case I may have done something wrong it did not work...
case WM_MOUSEMOVE:
SetCapture(hWndTarget);
TCHAR temp[256],temp2[256];
long x,y;
x=LOWORD(GetMessagePos());
y=HIWORD(GetMessagePos());
wsprintf(temp,_T("%d"),x);
SetWindowText(hX,temp);
wsprintf(temp2,_T("%d"),y);
SetWindowText(hY,temp2);
Should this work?
I am running Windows 7 b7600 and VS2010 beta 1.
Thank you,
|
|
|
|
|
Call SetCapture() when your app first starts up.
"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
|
|
|
|
|
|
Orchus wrote: It did not work either...
Which means what exactly? Does SetCapture() return NULL ? Are you not receiving any WM_MOUSEMOVE messages? Does the window handle belong to the current thread? Is it a foreground or background window?
"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
|
|
|
|
|
When I move the window out of my application's area, the two textboxes stop displaying coordinates. The calculator window is sitting next to my application, plainly visible. If I give focus to the calculator, I also do not get any mouse_move message as the two textboxes are not displaying anything.
I also noticed that I do not get any notifications when the cursor is hovering controls in my app such as buttons or edit boxes.
I don't know if the window handle (calc.exe) belongs to the current thread.
Thank you for your time,
|
|
|
|
|
I always run VisualStudio as admin, but when I debug the application I am developing, I would like it to launch the app at the normal user privilege level. Is there any setting available for doing this? (I know I could launch my app, then attach the debugger, but I would like to avoid this to make debugging convenient for other members of my team.)
Thanks.
Wayne
|
|
|
|
|
Hi,
In my app I need to set selection for files in windows explorer view. I just need to bring that blue background like the one we see when we click an item inside a folder. Please tell me how to do this using VC++.
Thanks,
J
|
|
|
|
|
Hello.
I'm trying to capture a screen shot while in full-screen mode in a game. The game can use either Direct3D (directx) or OpenGL as its displaying driver. while trying to get the screenshot in both drivers (in fullscrteen mode) the image is black or unuseful. I'm aware that the problem is known, but I don't have any solution for it.
I'm searching for the solution to this problem in C\C++ (though other languages will do aswell). I've tried to use GDI+, use a robot for the printscreen (btw it doesn't work even without the robot) and a bit more options, and still no idea how to get a screenshot of the fullscreen game in win vista\7.
I'd appreciate any help.
Sincerely,
Me.
|
|
|
|
|
Has anyone figured out the problem atleast? has its name or any info about it?
It would really help me alot, thanks.
|
|
|
|
|
I use satellite DLL for localization purposes in my application. And loading the dll with AfxSetResourceHandle. This works fine for all of my dialogs that doesn't use a custom control.
For those with custom control the constructor is called but not OnInitDialog or DoDataExchange
And DoModal returns -1
Any suggestion?
Thanks.
|
|
|
|
|
The system probably cannot create the custom control on your dialog. The custom control has to be registered before you can try to create a dialog which contains it, otherwise when the system gets to the custom control (when loading the resource and creating the dialog from it) and checks its class it won't find it among the known control/window classes and thus fail to create it which leads to the whole dialog creation process' fail.
Also check if you specified the right window class name in the resource editor for your custom control, if you forgot to do it or if you made a typo then you get the same result as above.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Ok, checked the window class name and it's not misspelled
But how do I check if my custom control is registered, I just know that if I place it "normal" resourcefile - not in the satellite file everything works fine
|
|
|
|
|
So you say that if you have the same custom control in a resource inside a DLL, and you load the resource from the DLL and try to create the dialog, it fails, but if you have the very same resource in the exe, not in an external DLL, without otherwise changing anything on your code, it works? You said other dialogs which do not have the custom control on them work fine, you load these from the DLL too?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Yes that is correct and other dialogs in the satellite DLL works fine as long isn't any custom controls in it. I have also tried with an other custom control and I got the same result.
|
|
|
|
|
Call GetLastError[^] after your DoModal returned (with -1) and see the System Error codes[^]. Which error does it report? Also another question, how/where do you register your custom control?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
void CMultiLangApp::OnAppAbout()<br />
{<br />
CAboutDlg aboutDlg;<br />
aboutDlg.DoModal();
}<br />
<br />
<br />
INT_PTR CDialog::DoModal()<br />
{<br />
&<br />
&<br />
&<br />
if (CreateDlgIndirect(lpDialogTemplate, CWnd::FromHandle(hWndParent), hInst))
}<br />
<br />
<br />
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,<br />
CWnd* pParentWnd, HINSTANCE hInst)<br />
{<br />
&<br />
&<br />
&<br />
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,<br />
pParentWnd->GetSafeHwnd(), AfxDlgProc);<br />
}
The registration of my custom control is done in the the constructor in the control class by calling RegisterWindowClass
|
|
|
|
|
When you register your custom control, using the WNDCLASS[^] or WNDCLASSEX[^] structures, for the hInstance member, do you specify an instance handle of your application? If yes, try giving it the DLL's handle instead and see if it changes anything. You still didn't tell me what GetLAstError() gives you.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
The call to returns NULL and The GetLastError() is 0 after CreateDialogIndirect. as shown below
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate, pParentWnd->GetSafeHwnd(), AfxDlgProc);<br />
Well I register my custom control using WNDCLASS and a specify the hInstance, by calling AfxGetInstanceHandle but I don't know how to change it to point to the DLL.
WNDCLASS wndcls;<br />
HINSTANCE hInst = AfxGetInstanceHandle();<br />
<br />
if (!(::GetClassInfo(hInst, BITMAPVIEWER_CLASSNAME, &wndcls)))<br />
{<br />
wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;<br />
wndcls.lpfnWndProc = ::DefWindowProc;<br />
wndcls.cbClsExtra = wndcls.cbWndExtra = 0;<br />
wndcls.hInstance = hInst;<br />
wndcls.hIcon = NULL;<br />
wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW);<br />
wndcls.hbrBackground = (HBRUSH) (COLOR_3DFACE + 1);<br />
wndcls.lpszMenuName = NULL;<br />
wndcls.lpszClassName = BITMAPVIEWER_CLASSNAME;<br />
if (!AfxRegisterClass(&wndcls))<br />
{<br />
AfxThrowResourceException();<br />
return FALSE;<br />
}<br />
}<br />
<br />
return TRUE;
|
|
|
|