|
How can I use the GetDeviceGammaRamp/ SetDeviceGammaRamp APIs to adjust the gamma for a dual monitor system with the display set to one screen stretched over two monitors? (Each monitor has its own slightly different gamma adjustments.
I've seen these examples:
http://www.codeproject.com/miscctrl/gamma_manager.asp?msg=1598211&mode=all&userid=16251#xx1598211xx
http://www.codeproject.com/csharp/Gammit.asp
but they don't actually address the issue I am unsure of which i guess is how i get a device context for each monitor even though they are being treated as one screen. Is this possible?
Stephen
|
|
|
|
|
Try using the EnumDisplayMonitors and the HDC is returned in the MonitorEnumProc.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
Gosh, I know this is a dreadful title, and probably a dreadful thread, so please feel free to direct me elsewhere if appropriate.
I'm just thinking about adding some simple (peer to peer?) network functionality that will allow two users to run a dialog application and send small packets of data, perhaps from controls to each others dialog with a view to some very simple gaming/strategy apps.
Is this something that requires a humongous amount of effort, or can it be cobbled together quite quickly. Assume that the user base for this is likely to be no more than 10 people in the whole world, all friends so it can be quite rough and ready!
ideally if there was a way to "sync" the exchange of data such that Dialog A sent some data but Dialog B couldn't see the result until Dialog B itself had sent a corresponding data item, that would be great.
|
|
|
|
|
Hi,
I am printing a piece of text to the printer. By using "GetDeviceCaps", I can get the physical height and width of the paper (PHYSICALHEIGHT and PHYSICALWIDTH). I can also get the left and top margins to the printable area (PHYSICALOFFSETX and PHYSICALOFFSETY), but how do I know the bottom and right margins? (or the width and height of the printable area) I can of course assume a safe margin (like an inch or so), but this would only be a gueass. It does seem strange that the printer can give information about the top and left "non-printable area" size, but says nothing about bottom or right. Does anyone have an idea?
Thanks in advance.
William
|
|
|
|
|
Hi all,
i am creating a Cirlcle with
CDC::Ellipse(...).
In the View the Circle is Created in MouseDown(...),MouseUp(..) and MouseMove(...) Functions,
But i want to Drag that Circle what i have created when the mouse is in between the Circle.
Please give me a Solution.
uday.
|
|
|
|
|
Hi,
What you do is that you create a compatible device context (CreateComaptibleDC), and you create a bitmap, the size of your original bitmap (CreateCompatibleBitmap). You select this bitmap into your compatible DC.
Now, you have an area in which you can save your original background.
First, you copy the information on the screen (from the original device context) into your compatible device context, using BitBlt.
Then you draw your circle. When you act on a mouse-move event, you restore the original background again (using BitBlt, copying from your compatible DC to your original DC) and then you re-draw the circle on its new location.
If you need some more info on the subject, I could probably cut and paste some sample code from an existing project.
Have fun!
William.
|
|
|
|
|
Hi Edinburg,
Please help me out. I am sending the code what i have written to draw the Circle.
//========================================================================
void CPaintingView::OnLButtonDown(UINT nFlags, CPoint point)
{
Anchor.x = point.x;
Anchor.y = point.y;
OldPoint.x = Anchor.x;
OldPoint.y = Anchor.y;
CScrollView::OnLButtonDown(nFlags, point);
}
void CPaintingView::OnLButtonUp(UINT nFlags, CPoint point)
{
DrawTo.x = point.x;
DrawTo.y = point.y;
CClientDC dc(this);
if(bEllipseFlag)
{
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1));
dc.SelectStockObject(NULL_BRUSH);
dc.Ellipse(Anchor.x, Anchor.y, DrawTo.x, DrawTo.y);
}
CScrollView::OnLButtonUp(nFlags, point);
}
void CPaintingView::OnMouseMove(UINT nFlags, CPoint point)
{
int nOldMode;
CClientDC* pDC = new CClientDC(this);
if((nFlags && MK_LBUTTON) && bEllipseFlag)
{
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1));
nOldMode = pDC->GetROP2();
pDC->SetROP2(R2_NOT);
pDC->SelectStockObject(NULL_BRUSH);
pDC->Ellipse(OldPoint.x, OldPoint.y, Anchor.x, Anchor.y);
pDC->Ellipse(Anchor.x, Anchor.y, point.x, point.y);
OldPoint.x = point.x;
OldPoint.y = point.y;
pDC->SetROP2(nOldMode);
szPosx.Format("%d",point.x);
szPosy.Format("%d",point.y);
Res = "x=";
Res += szPosx;
Res += ",";
Res += "y=";
Res += szPosy;
CMainFrame* pFrameParent = (CMainFrame *)GetParentFrame();
pFrameParent->m_wndStatusBar.SetPaneText(4,Res);
}
delete pDC;
CScrollView::OnMouseMove(nFlags, point);
}
void CPaintingView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
if(bEllipseFlag == true)
{
CRect rect;
ClientToScreen(&rect);
GetClientRect(&rect);
InvalidateRect(rect,TRUE);
}
CScrollView::OnLButtonDblClk(nFlags, point);
}
//===========================================================================
Please help me out.
uday
|
|
|
|
|
Hi Uday,
I would be thinking along the following lines:
//=======================================================
// Existing variables:
CDC * m_pDC;
CDC m_CompatibleDC;
CBitmap * m_pBitmap;
RECT m_Rect;
// constructor initialization:
m_pDC = (CDC *)NULL;
m_pBitmap = (CBitmap *)NULL;
// OnLButtonDown (draw the first circle)
void CPaintingView::OnLButtonDown(UINT nFlags, CPoint point)
{
if (m_pDC == (CDC *)NULL) // first time?
{
m_pDC = GetDC (); // create the device context
m_CompatibleDC.CreateCompatibleDC (m_pDC); // and a helper context
}
GetClientRect (&m_Rect); // get the required size
if (m_pBitmap != (CBitmap *)NULL) // we want a fresh bitmap
delete m_pBitmap; // so delete any old stuff
m_pBitmap = new CBitmap; // and create the new one
m_pBitmap->CreateCompatibleBitmap (m_pDC, m_Rect.right, m_Rect.bottom);// create the helper bitmap with the correct size
m_CompatibleDC.SelectObject (m_pBitmap); // and select it into the DC
m_CompatibleDC.BitBlt (0,0,m_Rect.right,m_Rect.bottom,m_pDC, // copy the current screen content
0,
0,
SRCCOPY);
Anchor.x = point.x;
Anchor.y = point.y;
CScrollView::OnLButtonDown(nFlags, point);
}
void CPaintingView::OnMouseMove(UINT nFlags, CPoint point)
{
m_pDC->BitBlt (0,0,m_Rect.right,m_Rect.bottom, // restore original screen content
&m_CompatibleDC,
0,
0,
SRCCOPY);
m_pDC->Ellipse(Anchor.x, Anchor.y, point.x, point.y); // and redraw the circle
}
void CPaintingView::OnLButtonUp(UINT nFlags, CPoint point)
{
// Draw definitive circle
m_pDC->BitBlt (0,0,m_Rect.right,m_Rect.bottom, // restore original screen content
&m_CompatibleDC,
0,
0,
SRCCOPY);
DrawTo.x = point.x;
DrawTo.y = point.y;
m_pDC->Ellipse(Anchor.x, Anchor.y, DrawTo.x, DrawTo.y);
m_CompatibleDC.DeleteDC (); // remove helper DC
m_pBitmap->DeleteObject (); // and bitmap
}
//======================================================
|
|
|
|
|
Hi edenburg,
very very thanks to you, you have solved my problem.
i am really thankful to you.
uday
|
|
|
|
|
Hai all,
I am working with MFC Vc++ 6.0.I wanted to add some external header files in to extenal dependencies fileview.How is it possible.Please help me
Thanks in advance
vinod
|
|
|
|
|
open your project properties
in the C/C++ section, there might be a "Additional Include Directories" section. then add the folder which contains the headers you need. be sure to add it on both debug and release configurations
|
|
|
|
|
if u include a file say #include"Iostream.h" in any of ur project files, it will automatically get added in the external dependencies fileview.
nave
|
|
|
|
|
|
But why u want to add that files in the external dependencies?
nave
|
|
|
|
|
Hi All,
I was trying with Michael Dunn's article on Introduction to COM
I had a try with my own console application. But in the beginning itself, it said that IActiveDesktop is undeclared. I included shlobj.h but no use at all.
But the sample he provided working fine in VC++ 7.0 but mine is not working well
could you please help me in this regard?
|
|
|
|
|
Did you see StdAfx.h in example form Mr Michael Dunn's if you see you can solve your problem
|
|
|
|
|
I created an application which is using precompiled header.
Even I copied his code to a new project file with same name, it's not working.
I think i have to do something wtih project settings.. can't find what it is
|
|
|
|
|
I dont understand why you cant find your problem its not hard I see this article and see stdafx.h I suggest you check all include files in this article I hope you find your problem
|
|
|
|
|
Look in the header files. I've had a look and it seems that:
- WIN32_IE needs to be defined >= 0x400.
- _WININET_ needs to be defined.
You get _WININET_ defined by #include ing <WinInet.h> before you #include <ShlObj.h> . You typically define WIN32_IE in your "stdafx.h" with code something like the following:
#define _WIN32_IE 0x0400
Do this before you include any files.
Steve
|
|
|
|
|
Can I pass a parameter to the function if I have a worker thread and use AfxBeginThread?
|
|
|
|
|
From MSDN[^]:
CWinThread* AfxBeginThread(
AFX_THREADPROC pfnThreadProc,
LPVOID pParam,
int nPriority = THREAD_PRIORITY_NORMAL,
UINT nStackSize = 0,
DWORD dwCreateFlags = 0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL
);
pParam<br />
Parameter to be passed to the controlling function as shown in the parameter to the function declaration in pfnThreadProc.
|
|
|
|
|
I've also read that but I still don't understand??!!?
|
|
|
|
|
Then ask a clear question. What is your problem ?? We cannot guess it.
Why don't you just pass your data (as a pointer for example) using this parameter ?
|
|
|
|
|
This is my controling function
UINT CMina_sView::run(LPVOID p)<br />
{<br />
<br />
CMina_sView * me = (CMina_sView *)p;<br />
me->ascultarea();<br />
return 0;<br />
<br />
}
And this is how I start the thread
void CMina_sView::OnList() <br />
{ <br />
running = TRUE;<br />
AfxBeginThread(run, this);<br />
}
I want to pass a paramater to ascultarea. How do i do it?
|
|
|
|
|
You already passed a parameter to your thread: it's the address of the class (the this parameter). So, you cannot pass two parameters.
But, why do you want to pass a parameter to this function ? Why don't you just have a member variable that hold this variable so that the function ascultarea can use it ?
|
|
|
|
|