|
First, sorry.
I thought Dialog based App using win32 was not Doc/View architechture, but yes MFC. As all what I posted is completelly useless I have deleted the messages. I'm going to explain where I did not understand you, if you clarificate a bit, maybe others can help you better.
quote:
"I require to show the dc into the Picture Control as a bitmap"
As I understand it the DC is the intermediate tool to display bitmap or work with the GUI/Printer. So you load a bitmap in it and you put it in somewhere. But the DC itself can not be shown anywhere as a bitmap, and a bitmap selected in it is already a bitmap, so is only a question of load the resource and place it.
quote:
"If I use this I am getting only that bitmap in the Static control and Not the Image of BitBlt."
Which image of the BitBlt? The BitBlt places the Bitmap selected by the DC where you want to place it, copying from the resources, masking or doing whatever you say in its flags. But if you don't have any image in your resources... what is supposed to be copied?...
So... What do you exactly want to be displayed at your picture control?
quote:
"What I want is to display the DC (Device Context ) permanently"
What do u mean with this? If you reload the same resource when the Dialog is being repainted... is not enough permanent?
If the image has to be so permanent... why don't include it in the picture control at design time?
quote:
"I dont know how do show the DC permanent"
???
quote:
"
//If I use getting nothing in the Static picture control
SendMessage(hWndStatic, STM_SETIMAGE , IMAGE_BITMAP,(LPARAM) hb);
//If I use this instead of above it shows the bitmap in the Static picture control
//bitmap means blank image (white image only)
SendMessage(hWndStatic, STM_SETIMAGE , IMAGE_BITMAP,(LPARAM) hb1);
"
is the blank IDB_BITMAP1 not the blank image you are loading?
And if that is not what you want... what do you want to get?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Sorry for the Confusion.
I need to perform the simple thing. I want to show the Captured desktop in the Static Picture Control. And want that it doesn't get erased when Dialod get refereshed.
I know how to capture the Desktop using BitBlt. But don't know how to display it show it doesn't get erased.
|
|
|
|
|
Quote:
"I want to show the Captured desktop in the Static Picture Control"
NOW...
-- modified at 9:19 Thursday 11th October, 2007
quote:
"I know how to capture the Desktop using BitBlt. But don't know how to display it show it doesn't get erased."
You don't have a CDocument to save the datas independantly of what happens around. I would create another class derived from CObject to hold the datas. Once you capture the image... then save it there. Everytime you refresh the Dialog, put the info contained in that class another time in the static control.
Is the only thing I can say will stay as long you don't overwrite the data that is saved.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi, Thnx and sorry, sorry because I am fail to explaing my problem.
Threre is no problem in capturing the desktop Screen. The problem is showing it in such a way that even if the Dialog get refreshed it doesn't get erased. i.e. If someone minimize the dialog and the when resotre it. the image should be threre.
If I will use simple BitBlt() to set show the Image on Dialog the image will be erased.
|
|
|
|
|
Last message I told you.
If you only set the image in your static control once then, you will always lose it when something particular happens (like min / maximize).
So...
One way can it be, create an abstract class derived from CObject. Create a CBitmap member variable inside. Once you have the screen capture, save it in the help-class.
Then include the class to your dialog, and... Write the code to put the bitmap in the control, inside the CDialog::OnPaint ()
If you want to put a image in the control at running time, (I am not 100% sure but...) there is no way to do it permanently but including the desired image everytime the window is refreshed, if not... every time the window is moved, minimized and so on... the intern Invalidate () to clean your screen will erase the pixels that are in the image, and if you dont load them another time... there is nothing to do. Yes there is... look above
In your place... I would do it as I said. Capture the desktop, save the image in an abstract class (or in a intern variable of the dialog) and code the insertion of the image in the static control inside your OnPaint or OnDraw.
If there is another way to do it... I don't know how, so if another one answers you, I will learn something new as well. (Correct answer above)
Good luck
-- modified at 5:01 Tuesday 16th October, 2007
-- modified at 5:02 Tuesday 16th October, 2007
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Nelek wrote: If you only set the image in your static control once then, you will always lose it when something particular happens (like min / maximize).
Where did you get that from? The bitmap stays in the static control until you set another bitmap to it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
As I said... I have learned something new.
I thought that for things that are not in the resources (dinamically charged) that was true. But I actually was wrong, so I apologize and retract what I said.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hello all,
I'm trying to find some info on grid computing and virtualization. I've seen an article about XGE (from Xoreax Incredibuild), I know and use Incredibuild already, but what I'm wondering is how their virtualization environment work. I'm trying to look for some information on the architecture behind this. Do you have any link that could help me, any information ?
Thanks,
Gérald
|
|
|
|
|
I am trying to inplace an edit box in a list control .Whenever I double click the item on the list control I am getting iItem of LPNMITEMACTIVATE as -1. Can any one suggest me regardig this
S.Yamini
|
|
|
|
|
From MSDN:
To obtain the items being activated, the receiving application should use the LVM_GETSELECTEDCOUNT message to receive the number of items that are selected and then send the LVM_GETNEXTITEM message with LVNI_SELECTED until all of the items have been retrieved
|
|
|
|
|
|
"To obtain the items being activated, the receiving application should use the LVM_GETSELECTEDCOUNT message to receive the number of items that are selected and then send the LVM_GETNEXTITEM message with LVNI_SELECTED until all of the items have been retrieved "
How did you use LVM_GETSELECTEDCOUNT, LVM_GETNEXTITEM, and LVNI_SELECTED? Can you give an sample code to solve the problem mentioned?
|
|
|
|
|
Hi all,
I want to get text on a Edit Control in MFC application. On MSDN I found that it is possible by using
GetDlgItemText(Edit_Control_ID)
But I'm confusing how to assign or used on the application. Give a feedback to me.
Thanks.
I appreciate your help all the time...
|
|
|
|
|
Will this helpful ?
CString strStaticText;<br />
GetDlgItem(IDC_EDIT1)->GetWindowText(strStaticText);
Regards,
Paresh.
|
|
|
|
|
Thanks. But I got this error
'CWnd::GetDlgItemTextA' : no overloaded function takes 1 arguments
left of '->GetWindowTextA' must point to class/struct/union
But on the explanation I don't found that more than one argument is passing.
I appreciate your help all the time...
|
|
|
|
|
I prefer to make me a control-variable to access the control in addition to the data variable. Like this:
CNamingDlg.h:
CEdit c_Name;
CString m_Name;
.
.
.
CNamingDlg.cpp:
void CNamingDlg::DoDataExchange( CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control( pDX, IDC_NAME, c_Name);
DDX_Text(pDX, IDC_NAME, m_Name);
}
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Hmm, thanks.
Can you tell me what is the difference, or the advantage using a control-variable rather than member function. Actually using a member function, just within few lines I can done it.
Please explain it.
Eranga
I appreciate your help all the time...
|
|
|
|
|
I got my wisdom from Joseph M. Newcomer (*the* one great Joseph M. Newcomer!) from his Page[^].
Basically, you can substtute
CButton * button = (CButton *)GetDlgItem(IDC_BUTTON);
if(button->GetCheck( ) == BST_CHECKED) ... by
if(c_Button.GetCheck( ) == BST_CHECKED) ... The amount of saved lines sum up with more complicated dialogs.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
That is interesting. I think it can be real helpful to me read that page, lots of resources there. Actually those things are really new for me. I'm switch from Java to C++(console and MFC) because of my project. Lots of things to learn. Sometimes I'm really mess with stuff. But I like to learn.
Thanks
Eranga
I appreciate your help all the time...
|
|
|
|
|
simple,
CString str;
GetDlgItemText(IDC_EDIT1,str);
now, what ever text is typed in edit 1 will be gathered at str.
hope your problem is solved.
|
|
|
|
|
Wow, it works. That mean I have to use two arguments with it.
Thanks.
At the same time I'll try to write that string to a text file. Done it as follows.
<br />
char tempBufferOne[256] ;<br />
<br />
GetDlgItemText(IDC_S_WRITE, readString) ;<br />
AfxMessageBox(readString) ;<br />
openFile.Write(readString, 256) ;<br />
Here I comes with mess. It writes the text to the text file. What happened is after writing text to the file, if it is not fill the buffer size, print some annoying characters. How can I avoid it.
I appreciate your help all the time...
|
|
|
|
|
Use like this.
openFile.Write(readString, readstring.GetLength()) ;
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
chandu004 wrote: Use like this.
openFile.Write(readString, readstring.GetLength()) ;
Thanks. I need an advice from you pal. I know you are a genius on C++. How did you find such point in shot period. Is there any better way to use MSDN. I'm not trivialize your knowledge sir.
chandu004 wrote: Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
Sure, I'll do it right after I get what I want from you guys
I appreciate your help all the time...
|
|
|
|
|
Eranga Thennakoon wrote: How did you find such point in shot period.
your questions resemble my doubts, past four years ago.
but then, i was not aware of codeproject.
so i learnt them on my own.
and regarding msdn,
Eranga Thennakoon wrote: Is there any better way to use MSDN.
i donot use msdn most frequently, because, iam a poor student and i dont learn from books or tutorials.
and i have least patience to search the required topics in msdn or internet.
most of the times, i request my colleagues tofind answer and learn from them.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
chandu004 wrote: your questions resemble my doubts, past four years ago.
but then, i was not aware of codeproject.
so i learnt them on my own.
That's true pal. Coding...and...Coding... gives much confidants in future. Self learning I always appreciate. Others help would more than that.
chandu004 wrote: i donot use msdn most frequently, because, iam a poor student and i dont learn from books or tutorials.
and i have least patience to search the required topics in msdn or internet.
most of the times, i request my colleagues tofind answer and learn from them.
Me too pal. I ask about MSDN because here in my University all the facilities are available. So I use them. It's not bad, I suppose. Actually I refer Indian books, that mean low price editions, I can't spend much. You know that I don't have even a computer as well. Up to now I learn on my University PCs. Nothing worry. One day I'm surly use my own PC
I appreciate your help all the time...
|
|
|
|