|
Try putting the line dc.SelectObject before the line dc.TextOut .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
thank you <<_Superman_>>...
My problem is solved...
Thanks a lot..
|
|
|
|
|
Your problem may be solved, but you may have made another one.
You are keeping the return value of SelectObject, and Selecting it back in later on aren't you?
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hi all,
Please help me, how to change color and font of push button in visual C++ 6.0?
Any reference that I can learn?
I used dialog based project.
thanks and regards,
|
|
|
|
|
|
I have tried using this codes:
HBRUSH CGambarDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if( pWnd->GetDlgCtrlID() == IDC_BUTTON1 )
{
pDC->SetBkColor( RGB( 255, 0, 0 ));
pDC->SetBkMode( TRANSPARENT );
}
return hbr;
}
but, nothing changes happened...
that codes is not correct?
|
|
|
|
|
If you read the remarks section of the document, it says that button with certain styles always use the default colors. In such cases, you would need an owner draw button.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thank you for your answers.
Sorry if I confiscating your time. But, I still confuse.
I have read the documents and link to using button on MSDN when I clicked owner-drawn button.
Is it right that these changes possible to do if I use it on Win32App project, not a MFCApp(.exe)?
I have no idea, where I should used this message (WM_CTLCOLORBTN) in Dialog Based Project.
I looked for WM_CTLCOLOR on parent window, I just found OnCtlColor(^).
Please give me explanations.
Thanks a lot.
|
|
|
|
|
Eka Candra wrote: Is it right that these changes possible to do if I use it on Win32App project, not a MFCApp(.exe)?
Of course.
Eka Candra wrote: I looked for WM_CTLCOLOR on parent window, I just found OnCtlColor.
MFC maps the OnCtlColor method to the WM_CTLCOLOR message.
So you just need to write your code into the OnCtlColor method.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Eka Candra wrote: but, nothing changes happened...
Is OnCtlColor() called?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
?????????
WM_CTLCOLORBTN has never been for buttons !
Use either OD button or Undocumented Shell buttons.
|
|
|
|
|
Hi there
I want to create a modeless dialog but have it act like a child window (never gets out of my client area, moves with my window, etc) of a MDI Frame window. The dialogs must stay within the MDIClientWnd of the main frame.
I need to create several children like that all based on different dialog templates.
So, I dont want to use CFormViews as I will have to create several documents and children frames.
Any suggestions?
THanxx guys
NAngelGr
|
|
|
|
|
I believe creating documents and views will be easier and more straight forward than what you're trying to do here.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I agreed with u, and the CFormView is a plus.
|
|
|
|
|
Hi,
I am looking for an experienced DirectX 10 programmer who could be able to create code for terrain, water and the sky. A team of programmers have already built the foundation of the game as now we just need to start working with DirectX.
Thanks
Andrew McIntyre
|
|
|
|
|
This is a forum for technical questions. If you need to advertise, then please use the proper channels; even though it may cost you money.
Please read and abide by these guidelines[^].
|
|
|
|
|
MrMcIntyre wrote: I am looking for an experienced DirectX 10 programmer
And I need a cup of coffee.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
So could someone please help me. The reason why I posted it in the C++ section because I could not find the DirectX message boards.
Thanks
Andrew McIntyre
|
|
|
|
|
You actually don't need a DirectX forum. If you need to post a job advertising, there is a Job Board [^] (however you have to pay for). There's even a Collaboration / Testing [^] one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I just need someone maybe on here to help me with the DirectX or someone could point me to a website where I can post a job advertisement for FREE.
Andrew McIntyre
|
|
|
|
|
MrMcIntyre wrote: I just need someone maybe on here to help me with the DirectX or someone could point me to a website where I can post a job advertisement for FREE.
You may try the Collaboration/Testing forum (I've already given you the link).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Suppose I have a parent class CParent. Suppose I have two other classes, CChildA and CChildB, which both inherit from CParent. Suppose I need to load two instances in memory, but other application conditions affect whether I'm working with CChildA or CChildB. This is obviously do-able with polymorphism like this:
CParent *pChildX = 0, *pChildY = 0;
At some point later I can make the appropriate assignments according to my application conditions:
pChildX = new CChildA();
pChildY = new CChildB();
My question is, what happens when run this code:
delete pChildX;
delete pChildY;
Is the child object fully deleted? I think it would, but it I'm confusing myself by thinking somehow only the CParent component of the data would be deleted, and that there would be a memory leak since the "delete" was not called on explicit CChildA or CChildB variables.
Please someone tell me I'm overthinking this.
|
|
|
|
|
Never mind. I just answered my own question. The answer is my application has memory leaks coming out of my ears. I just found an article that explains you need the keyword "virtual" in your destructor declaration. I haven't been doing that. Shame, shame, shame!
In case anyone else finds it useful, here's the link to the article.
|
|
|
|
|
My code was compiled correctly, no errors or bugs. but when I run the program by the time I get to the end I get a fatal exception. Here is my code:
#include "stdafx.h"
#include <iomanip>
#include <iostream>
#include <fstream>
#include <conio.h>
#include <windows.h>
#include <string>
#include <stdio.h>
using namespace std;
struct resident{
char firstName[64];
char lastName[64];
char middleName[64];
unsigned short int ageRes;
string dob;
unsigned long int social;
string eyeColor;
string hairColor;
int height;
char gnd[12];
};
struct family {
string gContact_F;
string gContact_L;
string gContact_f;
string gContact_l;
};
struct term {
char Term[12];
unsigned short int monthTerm;
};
void Resident();
void Stats();
void Term();
void ouFstream();
int _tmain(int argc, _TCHAR* argv[])
{
Resident();
Stats();
Term();
ouFstream();
_getch();
return 0;
}
void Resident(){
resident r;
cout << "\n\tPlease input the residents information below." << endl << endl;
cout << " First Name: "; cin >> r.firstName;
cout << " Middle Name: "; cin >> r.middleName;
cout << " Last Name: "; cin >> r.lastName;
cout << " Age: "; cin >> r.ageRes;
cout << " Date of Birth: "; cin >> r.dob;
cout << " SSN#: "; cin >> r.social;
cout << " Eye Color: "; cin >> r.eyeColor;
cout << " Hair Color: "; cin >> r.hairColor;
cout << " Height: "; cin >> r.height;
cout << " Gender: "; cin >> r.gnd;
cout << endl << endl;
}
void Stats(){
family s;
cout << "Family Contact(1)." << endl << endl;
cout << " First Name: "; cin >> s.gContact_F;
cout << " Last Name: "; cin >> s.gContact_L;
cout << "\t---------" << endl;
cout << "Family Contact(2)." << endl << endl;
cout << " First Name: "; cin >> s.gContact_f;
cout << " Last Name: "; cin >> s.gContact_l;
cout << endl << endl;
}void Term(){
term t;
cout << "Long term/Short (L/S)" << endl << endl;
cout << " Term: "; cin >> t.Term;
cout << " Month(s): "; cin >> t.monthTerm;
cout << endl << endl;
}
void ouFstream(){
char MM[64];
char DD[12];
char YYYY[12];
char mm[64];
resident R;
cout << "Input date of application." << endl << endl;
cout << " Month: "; cin >> MM;
cout << " Day: "; cin >> DD;
cout << " Year: "; cin >> YYYY;
strcat (MM, "_");
strcat (MM, DD);
strcat (MM, "_");
strcat (MM, YYYY);
strcat (MM, "_mem#_");
strcat (MM, R.lastName);
ofstream output;
output.open("Healthcare_Statistics.txt");
if(output.fail()){
cout << "Failed opening file: " << output << "!" << endl;
exit(1);}
}
|
|
|
|
|
Well, your best friend is the debugger (see the call stack window). Anyway using cin & strcat that way can easily make exceptions occur.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|