|
Hello,
I'm trying to draw on a dialog but I'm having no luck with the following code. It's my first time doing any gdi/device context stuff. I know there's better ways to display info than writing directly to a dialog but it's a bit of a hack. If anybody can help, thank-you.
John
//in oninitdialog
CPaintDC dc(this); // device context for painting
CPen* oldPen;
CPen pen(PS_SOLID, 1, RGB(0,0,0));
oldPen = dc.SelectObject(&pen);
dc.TextOut(20,20,"Mean Flow Velocity (m/s)");
dc.SelectObject(oldPen);
|
|
|
|
|
Hi,
You r not supposed to use the drawing code in
OnInitDialog and more over CPaintDC should
be used only when processing the WM_PAINT msg
i.e only in OnPaint.(How abt brushing up a bit
on the documentation ?)
So move you code to OnPaint.
|
|
|
|
|
Thanks Prem
It works now.
I'm using the following in OnPaint...
CFont* pFont;
CFont* pOrigFont;
pFont= GetFont();
pOrigFont = pdc->SelectObject(pFont);
pdc->SetBkColor(GetSysColor(COLOR_BTNFACE));
pdc->TextOut(40,40,"Mean Flow Velocity (m/s)");
|
|
|
|
|
hi to all,
do u know how to get message of "copy" from rt click of a mouse.
for getting mouse message we use getkeystate..
|
|
|
|
|
hi all.
i have to Read the data for a Particular Portion of a wave file, as an Integer array or a Byte array.
how i can i use the mmioRead function for above.
Please help me very urgent
thanks in advance.
|
|
|
|
|
Has anyone done a custom-drawn caption & border using WM_NCCALCSIZE, WM_NCACTIVATE, and WM_NCPAINT? I'm trying it this way in a WTL app (as opposed to removing WS_CAPTION, and just drawing the edges of the client area to look like a border) and there are two things I can't solve.- The standard min/max/close buttons get drawn by the system when the mouse moves in the border.
- The buttons get drawn when you r-click in the caption area.
It seems no one has written about using those messages (aside from the neat MFC custom caption article, which alas only helped partway) so I'm stumped as to what to try next. Handling WM_NCMOUSEMOVE does work around problem 1, but I still have no solution to #2.
(Actually, Paul D. glossed over this problem in a C++ Q+A article, and said removing those buttons and the gray line at the bottom of the caption would take "a gazillion lines of code" )
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Did you look at the custom caption aricle by David Lorde?
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
I remember an article using these messages, written by Roger Onslow. It was about Flat toolbars, and WM_NCPAINT was used to draw grippers (in fact, no, but you will understand looking to the article).
The article may be found at codeguru.earthweb.com/toolbar/devstudio_like.shtml
Another implementation on WM_NCPAINT was the fantastic Cristi Posea's docking windows. At the time I've customized it to add a close button on it, drawn flat if mouse pointer wasn't over (the latest version of this article should have this functionnality to). If I remember well I used WM_NCHITTEST to know the mouse position and determin if it was over a "sensitive" area.
HTH,
We do not inherit the Earth from our ancestors. We borrow it from our children.
Antoine de Saint Exupéry (1900-1944)
|
|
|
|
|
Hi!
In my progect i use ListCtrl with multi selection items.If user select any items from ListCtrl and then press on button "Delete" i delete selected items from ListCtrl(i use GetFirstSelectedItem,GetNextSelectedItem).The problem is when ListCtrl lost focus.Because user after many action can again press button "Delete" and ListCtrl "Remember" selected items.I want to do if ListCtrl lost focus clear all selected items.And when ListCtrl recieve focus to do that user will can select again many items.Help me,please,how can i do this!!!
Ira.
|
|
|
|
|
Have you tried to call
CListCtrl::SetItemState(mySelectedItemIndex, !LVIS_SELECTED, LVIS_SELECTED); ?
where mySelectedItemIndex belongs to your selected items index ?
We do not inherit the Earth from our ancestors. We borrow it from our children.
Antoine de Saint Exupéry (1900-1944)
|
|
|
|
|
hi all,
I am using "mciSendString" api function to record the wave audio through
microphone.
My question is how can i capture the audio data in Integer array while recording?
Because I have to Plot the line graph(spectrum) by using these values while recording(real Time)
Please help me.
Is there any other method to Plot the graph while recording(realTime)
Thank in advance.
|
|
|
|
|
How do you open a file dialog with modern buttons like "desktop", "My documents", "Network place" etc? I can't seem to get those with CFileDialog...
|
|
|
|
|
See this article.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
i want to clear the clipboard.i used the fn Emptyclipboard.but i am able to paste the text once and then only it is emptying.why is it so.Also i am checking openclipboard().
|
|
|
|
|
Im creating an ATL Exe application, then i create an ATL object on it called CHi, but i cant create an instance of it, i dont know why, i do this
CComPtr<ichi> object;
object.CoCreateInstance(CLSID_CHi);
it compile but it fails at the moment of try to create it,any idea why?, if i do the same with an mfc project it works.
and another question, how can i add an ATL Object in a WTL App?
|
|
|
|
|
Myself wrote:
Im creating an ATL Exe application, then i create an ATL object on it called CHi, but i cant create an instance of it, i dont know why, i do this
First question comes up, did you register it? Second, what do you mean by 'fails', what kind of error or problem do you get?
|
|
|
|
|
hres = -2147221164
|
|
|
|
|
-2147221164 = "class not registered"
you might want to verify that the class really is registered correctly.
-c
Being just contaminates the void. --Robyn Hitchcock
|
|
|
|
|
if i do that with an mfc project it works, i just add a new atl object and create it in there and it works.
|
|
|
|
|
are you calling CoInitialize somewhere before trying to create the object?
-c
Being just contaminates the void. --Robyn Hitchcock
|
|
|
|
|
Yes CoInitialize(NULL), in the _tWinMain and then try to create the object
|
|
|
|
|
i have tried many things to make this function work correctly.
the problem only occurs if i have a duplicate record in the recordset. if
there are no duplicates the function is fine.
i following function deletes all the records in the recordset.
if i have a duplicate log on file i get the error
"Multiple rows were updated"
is there a way i can avoid this error. Or is there a way i can call a function
to delete all the records.
My limitations are - I am using a VFP table and can only open it as a snapshot.
m_pSet->MoveFirst();
if(!m_pSet->IsEOF()){
m_pSet->MoveLast();
m_pSet->GetBookmark(endbookmark);
}
if(endbookmark.m_iVal>0){
m_pSet->MoveFirst();
do{
m_pSet->Delete();
m_pSet->MoveNext();
}while(!m_pSet->IsEOF());
}
thank you.
|
|
|
|
|
LPTSTR GetBuffer( int nMinBufLength );
I don't understand the parameter "nMinBufLength". What's the point of this parameter? what kind of value I should pass in? "The minimum length"?? I thought asking for a "maximum length" would make a lot more sense, oh well. Any help? Thanks in advance.
|
|
|
|
|
nMinBufLength specifies the minimum size of the buffer that you can safely play with.
If you do a GetBuffer with nMinBufLength = 10, you can do whatever you want with the first 10 characters of the LPTSTR that is returned. If you do something with the 11th character, let the devil save you!!!
[newly added]Of course that's assuming the actual buffer is smaller than 10 characters. Whatever you specify for nMinBufLength , if the actual buffer is bigger, that's what is returned [/newly added]
Use nMinBufLength = 0 to get a buffer that is the current size of the underlying CString buffer
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Ok so is I'm using a CString object to store contents read from a text file, whose size is unknown yet, I'd better make it: LPTSTR lpBuffer = str.GetBuffer(A_HUGE_NUMBER_HERE); ?
|
|
|
|