|
How do i change the font and the size of the text in a button???
Thank you.
|
|
|
|
|
By doing this
m_Button.SetFont(CFont*,true);
There is a GetFont as well, so you can set one button to have the same font as another using ( example from my code )
m_BPPLabel.SetFont(m_Ext->GetFont(),true);
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I tried researching these issues, but haven't found much to help me. So, I'm reluctantly asking here (*sigh* sorry lauren )
1. I have a bunch of textout->string stuff in my CMyView::OnPrint. The results are fine on machines with small font settings on their display properties. My question is, how do you compensate for those who have large fonts on? I have an idea on how to do it, but I'd rather hear other opinions.
2. I have a CFormView (SDI) view that displays a second dialog when the user double-clicks on a control in the parent window. There are text boxes that the user enters numbers into, and I have added a class that just accepts numbers and not text. On "OK" the data gets spilled into the control in the view, but I get an assertion error, and the debugger points this line in wincore.cpp:
void CWnd::GetWindowText(CString& rString) const
{
-> ASSERT(::IsWindow(m_hWnd));
.
.
.
}
I think I understand what's happening here, but how to fix it is where I need a point in the right direction.
Thanks in advance.
|
|
|
|
|
not sure about 2, but here's how i handle 1:
CPoint textSize;
textSize.y = fontPixels;
pDC->DPtoLP(&textSize, 1);
HFONT useFont = ::CreateFont( textSize.y, ....
i just specify the font size in pixels...
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Ok - I'll try 2... or at least a suggestion for 2...
The call stack will certainly help you here - alt+7 - you'll see where the call to the dead window was made if you track back a bit. I guess the dialog and its controls are gone before the call to GetWindowText, but I think its best to let you track it down rather than speculate on the circumstances.
|
|
|
|
|
It's simple - you can't call getwindowtext after you have destroyed the window. Instead, create variables to hold the data inside the dialog, then set them in OnOK and grab those variables from the calling class.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
rofl ... point taken
i would have answered both points as they have been
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Can someone suggest a method to use the internetsetoption of Wininet for setting the timeout properties of a wininet http connection handle
|
|
|
|
|
I am writing a CSocket server/client application and have found problems with sending data. The server recieves the CSocket, creates the CSocketFile, and initiliazes the CArchive appropriately. The program then reads a string from the archive, attempts to write it to a list control, and then calls the Close member function of CSocket. The Server program hangs after initializing the Archive and repaints slowly. If I close the client app however, the server resumes normal functions and displays the string appropriately. Am I calling the close function in the wrong place? Any other ideas? Thanks for any help.
Brad Chase
|
|
|
|
|
brad ... in the networking section of code project there a few examples of chat applications that use sockets ... might be good to check them over and see if you can spot what you're doing that they're not ... or visa versa
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
A few thoughts...
If you are doing a real C/S project, then leave MFC out of the server side part. If you are doing something trivial, it is not a problem.
That said, try to use CAsyncSocket instead, and wait for data to arrive, instead of jumping though so many hoops.
Also, try debugging the problem: Break the program when you start seeing the spin-like behavior.
-=- James.
|
|
|
|
|
Help:How to use VC++ to actualize the registration number's location of a car's digital image?
PLease help me,my Email: zx8@sina.com
Thank you very much.
|
|
|
|
|
as far as i know the automated speeding ticket type gizmos work in two parts ... a speed detector that detects your speed (geee i'm good huh?) and a camera that snaps your license plate ... the trick to most systems like this is that the camera is in a known position relative to the speed detector gizmo ... now given that most vehicles have a license plate in roughly the same area it isn't total rocket science to figure out where in the picture to look for a rectangular shaped object (an edge detection algorithm will help here) ... once you have the area of the plate it isnt then much more rocket science to have a stab at the contents of the area using a neural network to do the ocr ... we all know these systems work 'cos we all had tickets before no?
sheesh
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
I use in dialog-based application ActiveX object (1) and in ActiveX object (1) second ActiveX object (2). I don`t use events from first ActiveX (1) in second ActiveX (2). Please, help me. Thanks.
Ivan
|
|
|
|
|
are you asking how to reflect a message from the activex object(2) that is embedded in activex object(1)?
where do you want to handle the messages?
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hello,
I don't manage to export a procedure from a DLL.
I created a Win32 Dynamic Link Library with a function which declaration is:
__declspec(dllexport) BOOL Ping(UINT uiTimeout);
When I look at the overview of my resulting dll, I can see my function 'Ping' in
the export table but I can't get its address from another project.
In my project, I load the dll thanks to 'AfxLoadLibrary' but when I use 'GetProcAddress'
to get the address of the 'Ping' function, I get a NULL pointer:
typedef BOOL (* PINGFUNCTION)(UINT);
HINSTANCE hDLL = AfxLoadLibrary(m_szControl);
if (hDLL)
{
// Get the address of the ping function
FARPROC pnProc = GetProcAddress((HMODULE) hDLL, "Ping");
PINGFUNCTION MyPingFunction = (PINGFUNCTION) pnProc;
if (! MyPingFunction)
{
return ((int) GetLastError());
}
}
|
|
|
|
|
i use:
extern "C" int __declspec(dllexport) __stdcall FuncName(param 1, param 2,etc)
the "int" is the data type returned from the function
works for me
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
How can I resize a DataGrid column
|
|
|
|
|
Hi there,
I'm using Access 2000 (mdb file) and connect it to my app. through ODBC Driver.
My problem is that in Access DB there is a field which is autonumber (which means that each new entry this fields gets : Last Entry value + 1).
How can i use this functionality in MFC ODBC when i add a new Record, ie :
m_pSet->AddNew (); and then ... ????
Thanks in advanced,
Ariel.
|
|
|
|
|
you just insert a new record and provide values and column names for each column in the table that requires one ... some are set to allow null while others are not (this is your choice as db designer) ... the autonumber field you don't even have to mention in the add statement as the db will do that for you ... you might need to read it back out after the add if you are updating multiple tables as part of the same action
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
First, Thank you very much for taking the time and answer my question - i really apritiate it !
Well, i just found that this was my error (linked a control to such autonumber field).
Second, I have another question if you can :
I have a table linked to another table by 1 to many, i cant insert a new row to the table because of this link - how can i link the data from the other table to the current one (i managed to fill the combo with all the other table entries but its still not connected) - how do i do it.
Thank you again,
Ariel.
|
|
|
|
|
the table on the one side of the one-to-many must be written to first so that the foreign key field (the many) in the other table can relate to that value ... this is called referentail integrity and ensures that you don't get orphaned records in one table that don't have a partner in a related table
for example, you have a customer record that has cust_id as a primary key and you have another table containing, say, physical address details that are linked to the customer table by the cust_id field ... in the address table cust_id is a foreign key ... the db won't allow you to insert an address record for a customer (cust_id) that doesn't exist in the customer table
unless you turn off the checking of course ... which is a BAD THING generally
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hi there,
First thank you for the answer.
Actually i know about the referentail integrity needed in a 1-to-many connection.
The thing is i don't know how to use it in actual user interface of MFC.
Lets Say as you said i have :
Table1.ID - connected in m_T1_ID linked to a CEdit Value : m_edtVal
Table1.Table2ID - connected in m_T1_T2_ID linked to a CComboBox Value : m_cmbVal
How can i put all Table2 Entries in m_cmbVal and put the Actual Table2.ID inside Table1.Table2ID ?
m_pSet->AddNew();
// Somwhere in here i should reference the 1-to-many, but how ???
Thank you for your answer,
Ariel.
|
|
|
|
|
Does static_cast<> produce any code or
class_A_ptr *a = static_cast < class_B_ptr * > (b);
is equal to
class_A_ptr *a = (class_B_ptr *)b;
?
With the best regards, Vitaly.
|
|
|
|
|
Testing with MS Visual C++, in release build, no difference, code size was the same either way.
|
|
|
|