|
you must call the function that is responsible for drawing inside the
OnDraw()
the OnDraw function is called by the operating system when any update occurs in the program so if you resize the window this is update so the windows will call the OnDraw function inside which will call your drawing function. by this way it wont disapear
|
|
|
|
|
Hello,
I am using VC++ 6 and I can't figure out why a ComboBox will not show list of items with a vertical scroll bar. I have the Type set to Dropdown, Ownerdraw set to No, and Vertical scroll checked.
When I click on the dropdown, I get the first item in the list with a VERY tight vertical scroll bar.
I have six items in my list, but all I can see is one at a time in the dropdown.
What am I doing wrong?
Thanks,
Murrah Boswell
|
|
|
|
|
|
Well shoot a monkey! How simple it is!
Thanks!
|
|
|
|
|
What happens when a critical secion is deleted while a thread is waiting for it?
Is this even documented?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|
|
From what I can read from MSDN docs (see docs for EnterCriticalSection ):
- If a thread terminates while it has ownership of a critical section, the state of the critical section is undefined.
- If a critical section is deleted while it is still owned, the state of the threads waiting for ownership of the deleted critical section is undefined.
|
|
|
|
|
Hi guys,
I am wondering whether wht I am doin is right or not... first one is....
1) I am trying to read an IMAGE file through fstream class. (donno whether it is right or not)
2) If i used it, how can i read the data in it, so that I can use tht data to create another image file.
3) I know the header information of tht file, so that I can skip its header information block and start off with the actual image data.
4) but how can i tell tht i have skipped off the header info and then the current reading data is the actual image data. But i can say tht it is having a 128byte header.
more info... each pixel is stored in 2 bytes... since line offset is twice the width.... and it is a 12bit grey scale image...
any suggestions or ideas are appreciated...
thanks in advance....
Suman
|
|
|
|
|
Hi everyone,
I'm programming database using ODBC and Access. I try to bind data from database to a ComboBox. I have added a new class CProductSet derived from CRecordset, and a member variable of type CProductSet in the Dialog. When I compiled the program, VC++ appeared alot of error messages:
c:\temp\control\productset.h(14) : error C2504: 'CRecordset' : base class undefined
c:\temp\control\productset.h(16) : error C2629: unexpected 'class CProductSet ('
c:\temp\control\productset.h(16) : error C2238: unexpected token(s) preceding ';'
c:\temp\control\productset.h(33) : error C2061: syntax error : identifier 'CFieldExchange'
C:\Temp\Control\ProductSet.cpp(17) : error C2653: 'CRecordset' : is not a class or namespace name
C:\Temp\Control\ProductSet.cpp(17) : error C2065: 'classCRecordset' : undeclared identifier
C:\Temp\Control\ProductSet.cpp(19) : error C2065: 'CDatabase' : undeclared identifier
C:\Temp\Control\ProductSet.cpp(19) : error C2065: 'pdb' : undeclared identifier
C:\Temp\Control\ProductSet.cpp(20) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
C:\Temp\Control\ProductSet.cpp(20) : error C2143: syntax error : missing ';' before ':'
C:\Temp\Control\ProductSet.cpp(21) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
C:\Temp\Control\ProductSet.cpp(42) : error C2065: 'CFieldExchange' : undeclared identifier
C:\Temp\Control\ProductSet.cpp(42) : error C2065: 'pFX' : undeclared identifier
C:\Temp\Control\ProductSet.cpp(43) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
C:\Temp\Control\ProductSet.cpp(58) : error C2653: 'CRecordset' : is not a class or namespace name
C:\Temp\Control\ProductSet.cpp(63) : error C2653: 'CRecordset' : is not a class or namespace name
I think there is something wrong with my program. Could you please tell me how to fix and the steps how to bind data from database to a specific control?
Thank you very much.
Thanks for reading!
|
|
|
|
|
Hi,
I am a new to the vc++. I am working on a project which will make the 3-D object(four characters) rotated. I used the CFont function and create the object, I didn't know how to change the color of the background and the object, see my ((codes as follows:
font.CreateFontIndirect(&lf);
CFont *pFont = pDC->SelectObject(&font);
pDC->SetTextColor(RGB(110, 185, 250));
CFont* pOldFont = (CFont*)pDC->SelectObject(&font);
pDC->SetBkMode(APOQUE);
pDC->SetTextColor(::GetSysColor(COLOR_3DDKSHADOW));
pDC->TextOut(100, 100, "PLAY", 4);
pDC->SetTextColor(::GetSysColor(COLOR_BTNHIGHLIGHT));
pDC->TextOut(97, 97, "PLAY", 4);
Meanwhile, I am wondering how can I rotate the object, can I use "lfOrientation or lfEscapement"
Thank you for any suggestion!
|
|
|
|
|
huffmancoding wrote:
Meanwhile, I am wondering how can I rotate the object, can I use "lfOrientation or lfEscapement"
Yes
However using GDI it's not possible to render text in 3D, except maybe using a simple drop shadow effect by drawing a dark font first then drawing your colored font over top, but 3 pixels up and to the left(or something to that effect).
All you can do using GDI is rotate fonts on the (I wanna say???) Z axis...meaning...left-right (or visaversa) but not the X or Y axis giving your text the depth required for a 3D look.
For that you would have to load the font and draw it out yourself, which wouldn't be easy...or atleast quick to implement.
Just MHO
Cheers
How do I print my voice mail?
|
|
|
|
|
Hi, Hockey,
Thank you for your suggestion. Do you have some source codes samples that are related to my question?;)
|
|
|
|
|
Hi,
I’ve been playing around with the Beginner’s DialogBox One tutorial on this site:
http://www.codeproject.com/dialog/dialogapptute.asp
and I was wondering how to get the text from a combo box. In the tutorial, we populated the IDC_TITLE combo box with some data(using the Data tab of the Combo Box Properties we accessed by right clicking the control):
Mr.
Mrs.
Dr.
Ms.
Then, for the combo box we added a member variable called m_nTitle, Category: Value, Type: int. I assume that when UdateData(TRUE) is executed, the integer position of the Title chosen by the user is transferred into m_nTitle. Is there a way to use m_nTitle to get the corresponding text from the combo box? I thought maybe if I added a Category: Control variable to IDC_TITLE, like m_controlTitle, then I could use m_controlTitle and m_nTitle to get the text, something like this:
CString strTitle;
strTitle = m_controlTitle.GetText(m_nTitle);
but there doesn’t seem to be a method of the ComboBox class that will do that.
In the tutorial, it says to do this:
CString strTitle;
int nIndex;
nIndex = GetDlgItemText(IDC_TITLE, strTitle);
but that just completely ignores the m_nTitle variable we created for the control.
|
|
|
|
|
Off hand, I would have to say try GetWindowText() and see if that will work for you.
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
Hi,
Thanks for the response.
In the tutorial, this works:
CString strTitle;
int nIndex;
nIndex = GetDlgItemText(IDC_TITLE, strTitle);
The function you posted, GetWindowText() seems to be of the same form as GetDlgItemText() in that it completely ignores the value of the control, m_nTitle, that we already have.
I wondered what was the point of creating a variable to hold the value of the combo box control, if it wasn't going to be used. In turn, I wondered if there is a way to get the text from a combo box using the value of the control.
|
|
|
|
|
CComboBox::GetLBText(int nIndex, CString& rString) const;
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
I spent several minutes reading your sig and wondering what the heck you were trying to tell me before I noticed the line with the method.
Thanks for taking the time to help a beginner.
|
|
|
|
|
is there an ASM instruction (or opcode) that normalizes a double value (i.e. adjusts the exponent so the mantissa is .1xxxxx)
(And - if you don't mind - MSVC C++ inline assembly to normalize a double d )
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|
|
The real numbers are always stored in normalized form. The high-order bit of the mantissa is always 1 and it is not stored in the real*4 and real*8 formats.
More info: MSDN Library Visual Studio 6.0 - "IEEE Floating-Point Representation and Microsoft Languages".
Regards,
Andrzej Markowski
|
|
|
|
|
I have my dll injected into another process. Is there a way from that dll that I can tell what other dll's are mapped into the process, and be able to get the module handle to one of them? Any help is appreciated.
-Dev578
|
|
|
|
|
Dev578 wrote:
Is there a way from that dll that I can tell what other dll's are mapped into the process
EnumProcessModules() will do that for you. MSDN has a page called "Enumerating All Modules For a Process" that should have you the code you need.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
#include "witty-quote.h"
|
|
|
|
|
Hi dudes,
I want to change the default background color of SDI client are to black color. Actually it is in white color now. I mean I want to change the background color of View. In dialog box we have WM_CTLCOLOR. But I don't know what to do in view.
Thanks in advance for helping.
Promise.
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
|
How can this be done? I know how to change its background color but the text I can't get right...
|
|
|
|
|
This is one of the features I plan to add to FooButton[^]. Will let you know when the article is updated.
Meanwhile, you might want to check out (pun intended) some of the other owner drawn buttons here[^].
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
I'm a beginner but I tried to figure it out for you. The following code doesn't work, but it's what I came up with, and maybe it will give you some ideas. I have a simple dialog box with a few controls and I added this function to the Dialog class(CCodeProject_Dialog2Dlg):
HBRUSH CCodeProject_Dialog2Dlg::OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(pWnd->GetDlgCtrlID() == IDC_WIN98)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT);
}
return hbr;
}
How did you set the background color?
I can't believe the previous poster wouldn't help you. I clicked on the link he posted, and any of the author's of those button programs should be able to tell you how to do that.
Also, what's up with a programming forum that doesn't allow you to post indented code?
|
|
|
|