|
The CString does not contain font information.
BUT
you could use some markup language to tag your text, a little bit like what HTML is doing ..
BUT
you will need a control that can understand that markup language and then draw the string accoring to the different markups.
|
|
|
|
|
Here's something I did for a Dialog Box --- changing the font size and the font type. This was done in the Initializer of the class:
(m_Font is of type CFont() )
// create an Arial font of 11 pixels
m_Font.DeleteObject();
m_Font.CreatePointFont(160, _T("Arial"));
m_canx.SetFont(&m_Font);
m_ok.SetFont(&m_Font);
// set the font to be larger for all the controls on the verify page
GetDlgItem(IDC_TEXT1)->SetFont(&m_Font);
GetDlgItem(IDC_TEXT2)->SetFont(&m_Font);
GetDlgItem(IDOK)->SetFont(&m_Font);
GetDlgItem(IDCANCEL)->SetFont(&m_Font);
GetDlgItem(IDC_NOTICE)->SetFont(&m_Font);
This should help you figure out what to do for your code.
John P.
|
|
|
|
|
hi,
I have wrote a static function and i have declared static int variable in a class.initally i have set the value of variable to zero,in another function which is not static , i have incremented this varible by one,in the first static funtion ,i have written a if condition if(m_inCoun==1){do this };i have decremented the varible count by one ,in the if condition.When i compile the code i getting LNK1120:error..what could be the reason...?
Thanks in before
James
|
|
|
|
|
You need to declare the actual instance of the variable as well as declaring it in class. Typically this is done in the .cpp for the class:
so if the .h had
int m_inCoun;
the .cpp would have (at the top, before the implementation code)
int CYourClassName::m_inCoun = 0;
|
|
|
|
|
I created my own CPrintDialog that I called CMyPrintDialog and I modified it to just show the printers available. Then I added a help and an apply button. Now clicking the OK button works fine and it closes properly, but if I click on the close 'x' button or the Cancel button, I have to click twice before the dialog closes and if I call OnCancel() or OnClose() from the apply button, nothing happens. How do make my subclassed dialog drived from CPrintDialog close properly.
Roj
|
|
|
|
|
i am writing a FormView program. i want drag the window when LButton clicked in a rect of window, and moving the mouse.
i write my codes in OnLButtonUp, OnLButtonDown and OnMouseMove events. but its draging is very bad. please help me.
void CMyView::OnMouseMove(UINT nFlags, CPoint point) <br />
{<br />
if(m_bMoveWindow & ((nFlags & MK_LBUTTON) == MK_LBUTTON))<br />
{<br />
if(GetCapture() == this)<br />
{<br />
ShowWindow(SW_HIDE);<br />
<br />
m_framWnd->MoveForm((point.x - m_ixMove), (point.y - m_iyMove));<br />
<br />
ShowWindow(SW_SHOW);<br />
m_ixMove = point.x;<br />
m_iyMove = point.y;<br />
}<br />
}<br />
<br />
CFormView::OnMouseMove(nFlags, point);<br />
}<br />
<br />
void CMyView::OnLButtonDown(UINT nFlags, CPoint point) <br />
{<br />
if(IsPointToRect(point,CRect (0, 0, FORM_WIDTH-TITLE_BITMAP_SIZE, TITLE_BITMAP_SIZE)))<br />
{<br />
SetCapture();<br />
<br />
m_bMoveWindow = TRUE;<br />
m_ixMove = point.x;<br />
m_iyMove = point.y;<br />
}<br />
<br />
CFormView::OnLButtonDown(nFlags, point);<br />
}<br />
<br />
<br />
void CMyView::OnLButtonUp(UINT nFlags, CPoint point) <br />
{<br />
<br />
m_bMoveWindow = FALSE;<br />
<br />
if(GetCapture() == this)<br />
ReleaseCapture();<br />
<br />
CFormView::OnLButtonUp(nFlags, point);<br />
}
Zo.Naderi-Iran
|
|
|
|
|
Not knowing what MoveForm does, try removing:
m_ixMove = point.x;
m_iyMove = point.y;
from OnMouseMove and see what happens.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
MoveForm is a function that i define in CMainFrame class. in this function i call ::MoveWindow function.
Zo.Naderi-Iran
|
|
|
|
|
Thank you Steve!
i remove this 2 lines and i remove "ShowWindow(SW_HIDE);"
now my window moves very well.
Zo.Naderi-Iran
|
|
|
|
|
i'm writing a program which installs a hook to capture system messages, while capturing messages of top level keys (volume control keys of a multimedia keyboard) the system becomes stuck..the program works fine for all the other keys..me using windows XP sp2..
anybody pls gimme an answer...
|
|
|
|
|
Could some explain, in MFC, how I can display a dialog to the user of my program that the computer is working on something ie: "Loading", "Saving", "Calculating", etc.; so the user knows the computer is not FROZEN, etc.. When the Computer needs a reponse from the user then the Dialog will be removed automatically(when the computer is done doing whatever it was doing).
I really need some good examples(coding) to help me understand how to do this.
Thanks in advance for any help you can offer.
A C++ programming language novice, but striving to learn
|
|
|
|
|
|
Larry Mills wrote: automatically(when the computer is done doing whatever it was doing).
I really need some good examples(coding) to help me understand how to do this.
threading is key to ur solution
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And you
|
|
|
|
|
Can you explain - hopefully with an example. A Simple example will suffice.
Thanks!
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: Can you explain - hopefully with an example. A Simple example will suffice.
Sorry for late reply. actually i want to say.. do you lenghty work in thread.. so that it will not block the main thread and you can easily do you work over there
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And you
|
|
|
|
|
See here[^]
maybe it is some helpful to you
|
|
|
|
|
Hi,
First of all I hope this is the right place for this question, if not please direct me to the appropriate place and accept my apology in advance.
I'm a beginner level programmer and have done some C and C++ in school. My work is more of a sys-admin nature so I unfortunately don't get a chance to polish my coding skills through work either.
I need to write a small windows utility to act as a dhcp server for 4-6 windows clients. This is a private type project and for some reason the requestor does not want to use any existing freeware/shareware or even the windows built-in dhcp server. The scenario is a setup of 4-6 windows machines, one of which would be running this utility to act as a dhcp server. As far as I understand, all machines are running win xp.
As I mentioned above, I'm just a beginner level so this may be out of my scope and I understand that but that is EXACTLY the reason why I want to do this. I have a few weeks so I'm hoping that should be enough time to learn and understand. I think this may be a very good opportunity for me to better my coding skills since its a real project and not book exercises. I have read up on dhcp in the last couple of days and now atleast understand what it is and what it does.
Can someone please guide me on this, so I can atleast have an idea of what I need to learn/understand and where to start. Also, since its code, I'm assuming it could be done a variety of different ways, so if there are multiple suggestions, all are welcome...
Thanks very much...
uzee
|
|
|
|
|
|
Hi every body,
Can somebody please send me a link to learn threads and how to implement it .
Thanks
|
|
|
|
|
Here^
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
|
WhiteSky wrote: See Using Worker Threads
both link by Mr. joseph he he he
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And you
|
|
|
|
|
One of the things that I have been working on for the past couple of days is creating a DLL in VC++ 6.0 and using it in VC#, and it works..... but when I create the dll in VC++ Visual Studio 2005, it doesnt work with the VC# code.(in Visual Studio 2005)...... I get the error message that it could not find the fntest () function in TestDll.dll.
Let me be more specific about how I created the DLL.....( and I followed the same steps for VC++ 6.0 and VC++ 2005).
After following the steps in the link http://www.icynorth.com/development/createdlltutorial.html(I created a project that exports some symbols instead of a simple dll)I created a .def file, specified the test function as EXPORT. Then I went to build->configuration manager. and changed the configuration from debug to release. I then built the project, got the dll and copied it to the folder C:\WINDOWS\system32.
Then I used PInvoke in VC# code and it worked fine for a VC++ 6.0 dll but not for a Visual Studio 2005 dll in VC++. I have a code ( written by someone else) in Visual Studio 2005. It has a lot of libs etc. specific to .NET, so I have to convert this code to a dll and then use it in my VC# program.
I am desperately waiting for a response.
Thanks,
|
|
|
|
|
If you update your VC6 project to 2005, does it still work ?
saania khan wrote: I have a code ( written by someone else) in Visual Studio 2005. It has a lot of libs etc. specific to .NET, so I have to convert this code to a dll and then use it in my VC# program.
If it's specific to .NET then it's managed code, which means you should be building a managed dll ( in fact, you have to ) and you won't p/invoke that, you'll just import it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How To Get All of Desktop Pixel And Copy to one variable
!=Hight Speed
|
|
|
|