|
I'm trying to create a dialog window, that becomes opaque when a mouse hovers over it and when
the mouse leaves the window, it should become transparent again.
My problem here is that when a mouse is over a control in the dialog window, it doesn't work the
way I want - the dialog does not recognize that the mouse is hovering over it.
What should I do?
And my second question is: Do you have any how to do the same UI as in Real Player One. I mean:
when a mouse is moved over the display window three zoom buttons appear. I actually would like
to do it a little bit more different: when I move the mouse over the upper-left corner of the
client area of a window the buttons should appear.
I'm doing Win32 programming in my spare time for a few months now and I'm nothing but a beginner
yet. Sorry if my questions are too stupid.
Regards,
Z.
|
|
|
|
|
check out the SetCapture() and ReleaseCapture() stuff
the second point i would solve by putting a static control on the dialog box and make it invisible but use it to capture the mouse and do your button / control thing there
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Anonymous wrote:
I'm trying to create a dialog window, that becomes opaque when a mouse hovers over it and when
the mouse leaves the window, it should become transparent again.
My problem here is that when a mouse is over a control in the dialog window, it doesn't work the
way I want - the dialog does not recognize that the mouse is hovering over it.
What should I do?
You should check for the mouse hover in the controls also. Derive a class fromm your controls and override the mouse events you need to.
Anonymous wrote:
I actually would like
to do it a little bit more different: when I move the mouse over the upper-left corner of the
client area of a window the buttons should appear.
Define a rectangle with in your view in the upper-left corner of the client area and use that rectangle to test if the mouse is over it and act accordingly. Off the top of my head I can't remember the mouse event, on mouse move? Use the point you get to see if that point is in your rectangle and if so, draw your controls.
|
|
|
|
|
|
There is an article in MSJ regarding this.
Peter O.
|
|
|
|
|
Hi,
I simply want to be able to draw a verticle line (1 pixel wide) of a desired length (ex. 134 pixels tall) from the bottom of my screen up. Specifing color would also be nice
Thanks,
~ Selevercin
If you have a problem with my spelling, just remember that's not my fault. I [as well as everyone
else who learned to spell after 1976] blame it on
Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
You want to do this with DirectDraw? Sorry, but that still isn't simple!
|
|
|
|
|
Get the DC from the surface (GetDC) and the use plain GDI functions as usual.
|
|
|
|
|
Sorry, but I'm new to this. How do you "use the plain GDI functions as usual"? Is there a DrawLine() Function?
Thanks,
~ Selevercin
If you have a problem with my spelling, just remember that's not my fault. I [as well as everyone
else who learned to spell after 1976] blame it on
Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
I'm still learning MFC and started a test project that I am using to learn how to enable/disable menu items and toolbar buttons. I did not know whether or not to name the toolbar buttons on the CDialogBar toolbar with the same IDs as the menu items.
After changing some of the toolbar buttons to the same IDs, I got everything to work except one button which the resource editor would not allow me to change because it said I had a duplicate ID. The only difference with this one is that it is for a menu called "IDR_STOPMENU" that gets inserted once the user selects an action and gets removed after the "ID_STOPMENU" menuitem is selected from within this menu.
So, figuring that maybe the order of the buttons on the toolbar were not the same as the menuitems, I started to play around with the order and finally was able to change one other button but then I decided to manually change the command ID used in the OnStopMenu() and ON_UPDATE_COMMAND_UI() functions as well as in the resource editor because I thought ID_MENUSTOP looked stupid when used as an ID on both the menu and button. This screwed everything up so I put everything back and now if I put a breakpoint in either of these two functions they are not called at all. How do I get back? Did I do something that screwed up classwizard or what?
|
|
|
|
|
To further show off my ignorance about STL, how does STL handle errors?
I'd try to error check a vector.reserve call (by other means than calling and comparing against capacity afterwards).
I'd expected it to make use of it's own exception class, but my debugger says I'm mistaken. (Yes, I live with the VC++ 6 STL implem)
Peter
You don't need to sleep to see a nightmare Anne Clark [sighist]
|
|
|
|
|
Show as some code please!
Best regards,
Alexandru Savescu
|
|
|
|
|
class Foo {
std::vector<Bar> vec1;
std::vector<TCHAR> vec2;
void Reserve(int sz1, int sz2) {
vec1.reserve(sz1);
vec2.reserve(sz2);
if (everythingIsOK ) {
...
}
}
}
When one of the reserve calls fail, it's "silent" (i.e. it keeps the old size). I could compare sz1==capacity(), but that doesn't look like STL to me - I thought STL would consistently use exceptions situations like this.
Peter Puzzled
You don't need to sleep to see a nightmare Anne Clark [sighist]
|
|
|
|
|
peterchen wrote:
When one of the reserve calls fail, it's "silent"
This is due to a documented bug with Microsofts implementation of ::operator new.
You have to provide your own implementation of the global operator new function (or provide an allocator to the vector that does the right thing) that throws an exception of type std::bad_alloc when the memory request can't be met.
|
|
|
|
|
I want to populate an edit control with a paragraph. The only way to populate a multiline edit I found is to have
\r\n at the end of each line, so obviously it doesnt look like a paragraph. Do I have to use a CRichEdit, or will my poor CEdit do the task?
Thanks,
ns
|
|
|
|
|
You get automatic text wrapping in en edit control when the ES_AUTOHSCROLL style is not set. this way, you can save your precious \r\n's for the paragraph breaks.
Other than that, you would need to use the RickEdit.
You don't need to sleep to see a nightmare Anne Clark [sighist]
|
|
|
|
|
What's up coders... I am interested in changing the size of the shelltraywnd so that I can have a window similar to the task bar but my own which sits at the top of the screen. Then when any other window is maximized it will think that the bottom of my new task bar or window is the top of the screen and won't go past it.
So in reality I wanna change the height that all windows maximize to on the screen. Right now the go to the top of the screen but I would like to be able to change this so that they only maximize to 200 pixels below the screen and then I can fit an application in there so it sorta simulates what the task bar is doing if it were at the top of the screen.
If anyone could help me or give me some hints as to what this would involve that would be awesome.
Peace
|
|
|
|
|
|
i , all guys here.
I confront a handicap in my VC study , and expect your help.
Now , I am writting a class inheriting CWnd . and I want my class have the function to respond the UI message such as mousedown or keydown etc.
Have some master-hands can solve this problem . If you have some sample classes that can show to me ,please email to me :polosheng@yeah.net. thanks.
Another , I have made a sample class . it can pass the complier,but when linked ,the exe file didn't respond the lbuttondown message.And here is the code. Conld you give me some suggestions?
------------------------------------------------------------------------
#if !defined(AFX_MYMSG_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_)
#define AFX_MYMSG_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MyMsg.h : header file
//
#include <afxwin.h>
/////////////////////////////////////////////////////////////////////////////
// CMyMsg CWnd
class CMyMsg : public CWnd
{
DECLARE_DYNAMIC(CMyMsg)
public:
static WNDPROC m_wndProc;
public:
CMyMsg();
private:
//{{AFX_MSG(CFolderDialog)
// NOTE - the ClassWizard will add and remove member functions here.
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYMSG_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_)
------------------------------------------------------------------------------------------------------------
//implement file
#include "MyMsg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyMsg
IMPLEMENT_DYNAMIC(CMyMsg,CWnd)
WNDPROC CMyMsg::m_wndProc = NULL;
BEGIN_MESSAGE_MAP(CMyMsg , CWnd)
//{{AFX_MSG_MAP(CFolderDialog)
// NOTE - the ClassWizard will add and remove mapping macros here.
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
LRESULT CALLBACK WindowProcNew(HWND hwnd,UINT message, WPARAM wParam, LPARAM lParam)
{
return CallWindowProc(CMyMsg::m_wndProc, hwnd, message, wParam, lParam);
}
CMyMsg::CMyMsg()
{
}
void CMyMsg::OnLButtonDown( UINT nFlags, CPoint point )
{
::Beep(1000,1000);
}
ignorance
|
|
|
|
|
Anybody know it ?
please give me some advise . Thank you
|
|
|
|
|
If my printer set the resolution at 300 dpi and I want to print at the other resolution. How to write code to do that?
|
|
|
|
|
does not changing the scaling mode of the print dc affect the resolution of the output?
if not then maybe you have to send some printer specific codes to the device before printing
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
try to call printer dc (structure) to see printer's characteristics. if it doesn't sucessful you must change printer driver.
Good lack
|
|
|
|
|
I tried:
<br />
void CTrain1View::OnReadin() <br />
{<br />
CString sWriteText;
sWriteText="Rich text is shown here in sample project";<br />
<br />
EDITSTREAM es;<br />
es.dwCookie = (DWORD)&sWriteText;
es.pfnCallback = MEditStreamInCallback;
<br />
m_richedit.StreamIn(SF_RTF,es);
}<br />
<br />
<br />
<br />
DWORD __stdcall MEditStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)<br />
{<br />
CString *psBuffer = (CString *)dwCookie;<br />
<br />
if (cb < psBuffer->GetLength()) cb = psBuffer->GetLength();<br />
<br />
for (int i=0;i<cb;i++)<br />
{<br />
*(pbBuff+i) = psBuffer->GetAt(i);<br />
}<br />
<br />
*pcb = cb;<br />
<br />
*psBuffer = psBuffer->Mid(cb);<br />
<br />
return 0;<br />
}<br />
<br />
but this did not populate the richedit control. Instead it crashed precisely at :
for (int i=0;i<cb;i++)<br />
{<br />
*(pbBuff+i) = psBuffer->GetAt(i);<br />
}<br />
In the debug window I could see that the entire string was retrieved, and it entered the for loop even after that. Then crashed. so is it an indexing problem? How to fix it?
Thanks,
ns
|
|
|
|
|
From the debugger, for some reason (The string is just "Rich text" with length of 9) ,I see that cb =4092, and MSDN said that the loop index is to be less than GetLength = 9. No wonder its crashing. But what is this cb thats being passed in? Helllpp!
Thank you much,
ns
|
|
|
|