|
Does m_font belong to the CWnd -derived class? From where is SetFont() being called? There is an example in the Extras section of this article.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Can you try CreatePointFont??????
The procedure is like this.
// member
CFont m_FontArial;
// Create the font in Constructor
m_FontArial.CreatePointFont( 140, PSIGL_CONTROL_FONT_TYPE_ARIAL );
pWindow->SetFont( &m_FontArial );
yours faithfully
ajeeshcv
|
|
|
|
|
Here is what worked for me:
CClientDC dc(this);
CFont l_font;
l_font.CreateFont(14, 0, 0, 0, FW_NORMAL,
FALSE, FALSE, FALSE, 0, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_ROMAN, "Times New Roman");
CFont* l_old_font = dc.SelectObject(&l_font); dc.TextOut(50, 50, "Hello World");
dc.SelectObject(l_old_font);
l_font.DeleteObject();
except that I got my CDC in the OnraseBackground function of the CStatic class.
Thanks everyone for helping.
sb
|
|
|
|
|
im not sure your problem is this but m_font is global or no i saw if (m_font) isnt global it doesnt work i wrote a program and used like your code but font dosent change then i changed declare my variable from function to class and it worked.
whitesky
|
|
|
|
|
I am wondering if there is any standard convention or guideline to what function should call another. Suppose we have our main() function that will need to call functions setupCalculation() and calculate() in that order. Where should setupCalculation() be called from? Of course if we call it from main(), then we need to call it everytime we want to call calculate(). If we instead call it from calculate() then we may have to pass extra arguments to calculate() that setupCalculation() may require. So, does it come down to a case by case decision, or is there a standard way of going about this? Thanks for help!
|
|
|
|
|
Fame Ketover wrote: So, does it come down to a case by case decision, or is there a standard way of going about this?
No standard that I am aware of. You should strive for loose coupling, however.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If you are making the nested calls ( i Mean calling function inside other function) it grows the stack.
if you call the function seperatly then they have same hiearchy in the stack.
Now efficient way to calling is depends on the Number of paramenters pass and type Vs. Function data.
If Your function work load is large which blocks the parent function in the stack.
For e.g.
void test()
{
while(1)
{
}
};
void mehere()
{
printf("Humm");
test();
};
Here the parent function completes its work but waiting for test() to complete because compiler pops the function data from the stack when it returns and control goes into the parent function.
The point is that you call the functions seperatly which are not related.
As well as it helps to use the stack efficiently for process.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Dear All,
I have alot of old functions that have 'FILE *' as a passing parameter.
Now I am using Compound File...It uses IStream (from IStorage).
Does anybody know how to convert IStream to FILE* ?
Thank's
|
|
|
|
|
Fwzklmn wrote: Does anybody know how to convert IStream to FILE* ?
In general you can't. An IStream is more abstract then a file: while some IStream implementations wrap files most will not.
Steve
|
|
|
|
|
you can use this(use from ISream only) (of course this is only a suggestion
<br />
IStream *m_StreamFile;<br />
SHCreateStreamOnFile(filename,STGM_READ,&m_StreamFile);<br />
whitesky
|
|
|
|
|
Read #1 and #9 here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
This is in my homework.
Can you do it?
|
|
|
|
|
lulu0441 wrote: Can you do it?
While the odds are in my favor, why would I want to? How does me, or anyone else, doing your homework help you at all.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
erfy wrote: how i can create a database for my program?
Microsoft SQL, Access, MySql, Oracle? be specific.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
If you are using MFC, try:
CDatabase Db;
Db.OpenEx("DRIVER={SQL Server};SERVER=(local);UID=sa; PWD=", CDatabase::noOdbcDialog);
Db.ExecuteSQL("CREATE DATABASE MyDB");
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I suggest use Access and you can see Examples from Acess in MSDN
whitesky
|
|
|
|
|
I want to write a software which can automately reply the messages for users.Who can give me some materials.Thank you!
|
|
|
|
|
Look for software related to 'Eliza'
I've seen better runs in my shorts! - Patches O'Houlihan
|
|
|
|
|
I am trying to create a color fill that will change relative to a new value being input from the "OnHScroll" function. When I input a new value for the red color variable in the RGB function and re-display, the color never changes to the new value. See code segment below. How do I change?
...
...
int a=0,b=190,c=230,x;
CMainFrame::CMainFrame()
{
//Set color frame
colorbar.CreateSolidBrush(RGB (a, b, c));
};
void CMainFrame::OnPaint()
{
CPaintDC dc(this);
dc.TextOut (5,40,"Red Color Is:");
//Output color frame
colorbar.DeleteObject();
colorbar.CreateSolidBrush(RGB(a,b,c));
dc.SelectObject(colorbar);
CRect rc(100,150,150,200);
dc.Rectangle (&rc);
}
void CMainFrame::OnHScroll(UINT nSBCode, UINT nPos, CWnd* pCtrl)
{
//Convert pointer to slider pointer
CSliderCtrl *pSld;
pSld = (CSliderCtrl*)pCtrl;
//Get new position
x = pSld->GetPos();
a = x;
CString s; s.Format("%d",x);
//Output value for red
stcred.SetWindowText(s);
}
Note that:
1.) Initialize the colorbar to have values RGB(a,b,c)
2.) Variable "a" read in from the "OnHScroll" function and set to a new value.
3.) "OnPaint" deletes the old colorbar and re-creates with new "a" variable value, should display as output with the new color but doesn't, still displays as original a,b,c values. Please advise, Sid kraft sid_kraft@msn.com Thanks in advance, Sid Kraft.
Sid
|
|
|
|
|
sidkraft wrote: //Output value for red
stcred.SetWindowText(s);
Use InvalidateRect(...) with your colorfill rect as a parameter after stcred.SetWindowText(s); which fires the Onpaint Message and you will get the result
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi!
I have an activeX control, which should send variuous arrays to the client. What I have done, is to wrap these arrays into a CComSafeArray and then send it as a pointer to a VARIANT.
How can I then on client side determine which datatypes the array consists of? Whether it is int, long, double, float and so on?
|
|
|
|
|
The variant type should tell you on the client (if your ActiveX control is putting them together correctly).
For instance, the VT of the VARIANT would be VT_ARRAY | VT_I4 for longs, VT_ARRAY | VT_I2 for shorts, etc. It could be VT_ARRRAY | VT_VARIANT, which means that each element of the array is a variant itself, which agains means you'll have to test the VT.
|
|
|
|
|
thanks for good answer!
I have some other questions as well;
1) Will memcpy be a good approach to this task? If so, how will the code look then? My array consist of approx. 15000 elements.
2) How do I send an array of user defined structure elements?
|
|
|
|