|
Hello Friends
I want to draw on a image and for that m using FindWindow for its handle and then crating DC and then Graphics Object but after that when I am drawing using drawImage then its drawing above all the windows not on that specific window whose handle m finding.
Here is the code below:
Bitmap gbmp(fileName);
HWND hwnd = FindWindow(...,..);
HDC hdc;
hdc = GetDC(hwnd);
Graphics g(hdc);
g.DrawImage(&gbmp, 500,500, gbmp.GetWidth(), gbmp.GetHeight());
Any Ideas?
Regards
Yogesh
|
|
|
|
|
You will need to convert the coordinates from screen coordinates to window coordinates.
The APIs ClientToScreen and ScreenToClient do this.
Not sure which class/method in GDI+ does this.
|
|
|
|
|
I hope the window you are finding is not the foreground window? Is that correct?
Here is the reason, even though we get separate DC for each window, keep it in mind that the screen space is shared by all the windows.
So if you try to get the DC of window which is not in foreground and when we paint it other than in WM_PAINT cycle then it'll be painted on the shared screen space.
This is why you are seeing the bitmap image at top of all the windows and not in the found window.
Do your Duty and Don't expect the Result
|
|
|
|
|
I have a problem in that the MFC wizard is not generating complete wrapper code for my activex control.
I have a control which I am developing, called CombinedControl. I have in the past added custom properties to that control (and others like it), and generated C++ wrappers using the wizard (select _DCombinedControl interface in Class View, right click; choose Add Property; set property type to DOUBLE, name is Altitude, no params, set 'Get/Set method' check). I build the control, then add an instance of the control to a host dialog in another project, and create a control variable, which appears as a member of the dialog. If all the stars align, the control variable's class will have Get*() and Set*() access methods. The wizard does this by creating a wrapper class (e.g. CCombinedcontrol1) in my host dialog project which implements CWnd and contains the access functions (e.g. CCombinedcontrol1::GetAltitude()).
My problem is that if I return to my ActiveX control and add more properties(e.g. Heading), the wrapper class never generates access functions for them. They are in the IDL for my ActiveX control, and they are in the C++ wrappers for my control class; but the client app's wrapper never generates the access methods (e.g. CCombinedcontrol1::GetHeading()). I get an empty wrapper, with the class defined but access methods absent.
I have done clean builds, deleted and restored the control from the host dialog, unregistered and re-registered the server ... over and over ... all day. I am going nuts.
Any idea what I am doing wrong??
Better yet, what can I do right?
Thanks loads
Eric
PS. VS Pro 2008, particulars follow.
-------------------------------------------------------------------------------------
Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1
Installed Edition: Professional
Microsoft Visual Basic 2008 91605-031-5000002-60582
Microsoft Visual Basic 2008
Microsoft Visual C# 2008 91605-031-5000002-60582
Microsoft Visual C# 2008
Microsoft Visual C++ 2008 91605-031-5000002-60582
Microsoft Visual C++ 2008
Microsoft Visual Studio 2008 Tools for Office 91605-031-5000002-60582
Microsoft Visual Studio 2008 Tools for Office
Microsoft Visual Web Developer 2008 91605-031-5000002-60582
Microsoft Visual Web Developer 2008
..hotfixes deleted .... I have the latest service pack.
|
|
|
|
|
Hi everyone . I have an weird problem : into SDI VC6 application , that compile fine to my work , but at home , with the same VC6 environment give me the follow error :
LINK : fatal error LNK1104: cannot open file "libcmt.lib"
I can't figure out what is the problem .. .can you help me ?
|
|
|
|
|
First, make sure you have libcmt.lib on your hard drive by searching for it.
Next, make sure your VC6 directory path for Lib includes that directory.
|
|
|
|
|
I didn't find it on my computer , I need to get it rom my work PC .... thank you for answer .
|
|
|
|
|
Hey
I have a C++ WIN32 app having a dialog with 5 buttons.
Now i want to call the SetFocus() function to set the focus on each buttons. The focus does get set in a way, i.e., if i press the space key in key board, it will infact click the button to which the SetFocus() function was set. But visually it doesn't work.
i.e., it doesn't draw a blue border on the button giving it a visual feel that the button has focus on it.
Why is this happening? Is there a way to have SetFocus() draw the blue border along the button?
If i open a windows folder on top of it, it will draw the blue border along the button that was called with SetFocus() function.
Thanks in advance.
|
|
|
|
|
May be you have to invalidate the button to enforce a redraw ...
|
|
|
|
|
|
Ok, may be you must follow this by a call to UpdateWindow, 'cause InvalidateWindow simply raise a flag to send a WM_Paint message to the window if the message queue is empty ...
|
|
|
|
|
that's a good question... who actually draws that, the button or button's parent window? maybe invalidate the parent window?
|
|
|
|
|
AFAIK the window (and every control is a window by itself) draws itself until the style is owner-drawn.
If you invalidate the parent window, this will draw itself and then force a redraw of EVERY of its child windows.
(To minimize this effect there is a function InvalidateRegion)
But my knowledge is from old WinAPI32 - may be something changed since then ...
modified on Thursday, March 17, 2011 3:36 PM
|
|
|
|
|
i know every control is a window, but that's why i was asking who really draws the button "highlighting"? ...it would depend on how the framework implemented the highlighting, which i'm not really sure about... but if he says that dragging an explorer window over it does the trick, that has the same effect as invalidating the parent...
|
|
|
|
|
Are CDialog::SetDefID() or CDialog::GotoDlgCtrl() of any help?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Finally i got this working.
What i did was, do a SetFocus(ParentWindow) and then do a SetFocus(ChildWindow) on this order and it worked just fine.
|
|
|
|
|
Seems that is what I replied to another question - is it that this button is the only editable control on the form ?
'Caus then, a SetFocus() will have no effect on painting, 'cause the focus didn't change really ...
|
|
|
|
|
Correct me if I'm wrong, but Visual C++ seems to have gotten properties right (this native Visual C++, non-standard attribute)...
__declspec( property( get=get_func_name, put=put_func_name ) ) declarator
I'm embarassed to say that they've had this for a long time and I'm only now messing with it (yes, I realize there are articles that talk about it here but I had never truly wanted to use this until just recently), but their approach to properties for native Visual C++ development allows the property to be used like a member (assuming proper implementation of the accessor and mutator of course) whereas the C# implementation has the restriction
"A property or indexer may not be passed as an out or ref variable".
So far it seems to work intuitively (and can do things C# properties can't ), but...
Does anyone know of any serious negative aspects to using it besides that it's not standard? Am I missing some caveat?
|
|
|
|
|
Hi All
I am loading multiple object On OpenGL.When i load Only one object ,the object movement is
very smooth.After the increase the number object on screen at that time the movement is going slow.
Please suggest the way how to increase the speed when multiple object on screen.
Thanks
|
|
|
|
|
Are you loading your objects (or textures, or anything) from a file ? If yes, are you loading the file once or for every frame ? If you are loading the files for every frame, you should load them once at the beginning of your program. File I/O is very slow.
It's the only thing I can think that could slow down performance and that has a quick fix. If you already do that, then you will have to look for yourself how you can increase the performances of your program. Your question is so vague that there's no way to give you a correct answer.
|
|
|
|
|
Ok,Here i am sending you my RenderScene function which is continuous call.
I am loading image Once only.The other are text,Line,Point and 3D object.
Void RenderScene()
{
glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT );
float R = (float)GetRValue(m_s3DDispManagerSetting.dwScreenBkColor)/255.0;
float G = (float)GetGValue(m_s3DDispManagerSetting.dwScreenBkColor)/255.0;
float B = (float)GetBValue(m_s3DDispManagerSetting.dwScreenBkColor)/255.0;
::glClearColor(R, G, B, 0.0f);
glPushMatrix();
glLoadIdentity();
glShadeModel(GL_FLAT) ;
glEnable(GL_NORMALIZE) ;
multimap<int , stObjectInfo>::iterator it;
glScalef(m_fScale, m_fScale, m_fScale);
glRotated(m_fRAngle[0],1.0, 0.0, 0.0);
glRotated(m_fRAngle[1],0.0,1.0, 0.0);
glRotated(m_fRAngle[2],0.0,0.0,1.0);
glDepthMask(GL_TRUE);
for(it = m_sMapObjectInfo.begin(); it != m_sMapObjectInfo.end(); it++)
{
stObjectInfo sObjectInfo = (*it).second;
if(sObjectInfo.eObjectType == OBJECT_LINE)
glCallList((*it).first);
}
for(it = m_sMapObjectInfo.begin(); it != m_sMapObjectInfo.end(); it++)
{
stObjectInfo sObjectInfo = (*it).second;
if(sObjectInfo.eObjectType == OBJECT_POINT)
glCallList((*it).first);
}
for(it = m_sMapObjectInfo.begin(); it != m_sMapObjectInfo.end(); it++)
{
stObjectInfo sObjectInfo = (*it).second;
if(sObjectInfo.eObjectType == OBJECT_TEXT)
glCallList((*it).first);
}
for(it = m_sMapObjectInfo.begin(); it != m_sMapObjectInfo.end(); it++)
{
stObjectInfo sObjectInfo = (*it).second;
if(sObjectInfo.eObjectType == OBJECT_IMAGE)
glCallList((*it).first);
}
for(it = m_sMapObjectInfo.begin(); it != m_sMapObjectInfo.end(); it++)
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CW);
for(it = m_sMapObjectInfo.begin(); it != m_sMapObjectInfo.end(); it++)
{
stObjectInfo sObjectInfo = (*it).second;
if(sObjectInfo.eObjectType == OBJECT_3D)
{
glMaterialfv(GL_FRONT_AND_BACK , GL_DIFFUSE, sObjectInfo.fIntensity);
glCallList((*it).first);
}
}
glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
glPopMatrix();
}
|
|
|
|
|
when bmp image is used in the dialog background then the button creates a white border.
how to remove this border.
sample of how it looks is below
http://i55.tinypic.com/25qdj79.png[^]
Some Day I Will Prove MySelf :: GOLD
|
|
|
|
|
Not sure but, try setting Transparent property of button to true. (WS_EX_TRANSPARENT style).
|
|
|
|
|
i have checked it's not working.
Some Day I Will Prove MySelf :: GOLD
|
|
|
|
|
goldenrose9 wrote: http://i55.tinypic.com/25qdj79.png[^]
not able to open the link due to corporate issue. anyways.. if by any mean i can able to see the bitmap, i can comment on same!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|