Click here to Skip to main content
15,918,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionADODB.Recordset / Oracle / Save / unicode / restore problem Pin
xcavin25-Dec-05 20:33
xcavin25-Dec-05 20:33 
QuestionWho can i get CPU preformance in run time ? Pin
Yanshof25-Dec-05 19:01
Yanshof25-Dec-05 19:01 
AnswerRe: Who can i get CPU preformance in run time ? Pin
khan++25-Dec-05 19:48
khan++25-Dec-05 19:48 
GeneralRe: Who can i get CPU preformance in run time ? Pin
Dudi Avramov25-Dec-05 23:21
Dudi Avramov25-Dec-05 23:21 
QuestionUNDO Move operation in explorer Pin
ragavan25-Dec-05 18:43
ragavan25-Dec-05 18:43 
Questionwindows programming, displaying text Pin
Roy K25-Dec-05 18:41
Roy K25-Dec-05 18:41 
AnswerRe: windows programming, displaying text Pin
khan++25-Dec-05 22:44
khan++25-Dec-05 22:44 
AnswerRe: windows programming, displaying text Pin
John R. Shaw26-Dec-05 12:43
John R. Shaw26-Dec-05 12:43 
It may be a C++ application, but this is almost C compatible code. The only thing that keeps it from being C code it the declaration "char *string1;", after making function calls.

You'll still need to write code like that, but you can simplify by placing the code for drawing the text in a seperate function.
MyTextOut(HDC hdc, int x, int y, char* pStr)

You do not need to allocate any memory for the string in the given code, since you already know what the string contains.
const char *string1 = "";

You would not need to do the above accept that it is easier to use lstrlen than to do some thing like this:
TextOut (hdc, 10, 10, "", lstrlen(""));
or this
TextOut (hdc, 10, 10, "123", 3);

You should restore the previous font to the DC out of habit:
HGDIOBJ hOldFont = SelectObject(hdc, (HFONT)GetStockObject(SYSTEM_FONT));<br />
......<br />
SelectObject(hdc,hOldFont);<br />
EndPaint(hWnd, &ps);


Whoops, I got carried away!Big Grin | :-D

Ways of erasing the text:
1) Invalidate the window and do not draw it again.
2) Call GetTextExtentPoint32 and calculate the window rectangle where you displayed the text. Save the rectangle some where. Then just invalidate that rectangle when you want to earase it and do not draw it again. This method is faster, because you do not need to redraw the entire window (which is slow).
Note: Calling GetTextExtentPoint32 is equivalent to calling MFCs CDC::GetTextExtent method.

There are other ways, just let your imagination run free.


INTP
Every thing is relative...
Questionwebbrowser ctrl and memory problem! Pin
Tcpip200525-Dec-05 18:24
Tcpip200525-Dec-05 18:24 
QuestionCould anyone look below code and errors and explain what I have to do Pin
Commoner25-Dec-05 14:03
Commoner25-Dec-05 14:03 
AnswerRe: Could anyone look below code and errors and explain what I have to do Pin
Commoner25-Dec-05 14:04
Commoner25-Dec-05 14:04 
GeneralRe: Could anyone look below code and errors and explain what I have to do Pin
Commoner25-Dec-05 14:31
Commoner25-Dec-05 14:31 
GeneralRe: Could anyone look below code and errors and explain what I have to do Pin
asdfkjsodifuweior25-Dec-05 18:40
asdfkjsodifuweior25-Dec-05 18:40 
GeneralRe: Could anyone look below code and errors and explain what I have to do Pin
asdfkjsodifuweior25-Dec-05 18:40
asdfkjsodifuweior25-Dec-05 18:40 
AnswerRe: Could anyone look below code and errors and explain what I have to do Pin
PJ Arends25-Dec-05 14:34
professionalPJ Arends25-Dec-05 14:34 
Questionadd PATH in VC IDE Pin
LeeeNN25-Dec-05 8:50
LeeeNN25-Dec-05 8:50 
AnswerRe: add PATH in VC IDE Pin
TheGreatAndPowerfulOz25-Dec-05 16:59
TheGreatAndPowerfulOz25-Dec-05 16:59 
AnswerRe: add PATH in VC IDE Pin
vipinasda26-Dec-05 6:23
vipinasda26-Dec-05 6:23 
QuestionCan Win32 Dll loads menu in demand ? Pin
Subash.k25-Dec-05 4:08
Subash.k25-Dec-05 4:08 
AnswerRe: Can Win32 Dll loads menu in demand ? Pin
vipinasda25-Dec-05 4:39
vipinasda25-Dec-05 4:39 
GeneralRe: Can Win32 Dll loads menu in demand ? Pin
Subash.k25-Dec-05 18:42
Subash.k25-Dec-05 18:42 
GeneralRe: Can Win32 Dll loads menu in demand ? Pin
vipinasda26-Dec-05 5:25
vipinasda26-Dec-05 5:25 
GeneralRe: Can Win32 Dll loads menu in demand ? Pin
ThatsAlok26-Dec-05 17:18
ThatsAlok26-Dec-05 17:18 
GeneralRe: Can Win32 Dll loads menu in demand ? Pin
ThatsAlok26-Dec-05 17:20
ThatsAlok26-Dec-05 17:20 
GeneralRe: Can Win32 Dll loads menu in demand ? Pin
Subash.k10-Jan-06 18:59
Subash.k10-Jan-06 18:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.