Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to select the text of windows client area Pin
Niklas L10-Feb-11 22:31
Niklas L10-Feb-11 22:31 
GeneralRe: how to select the text of windows client area Pin
sarfaraznawaz11-Feb-11 0:39
sarfaraznawaz11-Feb-11 0:39 
GeneralRe: how to select the text of windows client area Pin
Niklas L11-Feb-11 0:59
Niklas L11-Feb-11 0:59 
GeneralRe: how to select the text of windows client area Pin
sarfaraznawaz15-Feb-11 19:43
sarfaraznawaz15-Feb-11 19:43 
GeneralRe: how to select the text of windows client area Pin
Niklas L16-Feb-11 2:00
Niklas L16-Feb-11 2:00 
GeneralRe: how to select the text of windows client area Pin
sarfaraznawaz21-Feb-11 18:39
sarfaraznawaz21-Feb-11 18:39 
GeneralRe: how to select the text of windows client area Pin
Niklas L21-Feb-11 20:22
Niklas L21-Feb-11 20:22 
GeneralRe: how to select the text of windows client area Pin
sarfaraznawaz21-Feb-11 22:31
sarfaraznawaz21-Feb-11 22:31 
i tried but i confused where to write code of your ......
once you check my code
CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct){
HANDLE hfile;
hfile=CreateFile(_T("\\\\.\\C:"),GENERIC_READ,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if(hfile == INVALID_HANDLE_VALUE)
{
MessageBox(_T("Fail to open the drive"),_T(" "),MB_OK | MB_ICONERROR);
return -1;
}
m_lpData = new BYTE[1024];
DWORD dwNumberofByteToRead =0;
if(!ReadFile(hfile,m_lpData,1024,&dwNumberofByteToRead,NULL))
{
MessageBox(_T("Fail to read the drive"),_T(" "),MB_OK | MB_ICONERROR);
return -2
}
and onpaintcode:


{
CPaintDC dc(this); // device context for painting
CString szFormatted;
CRect rect;
CDC m_pDC;
CBrush m_Brush,m_brush1;
GetClientRect(&rect);
m_pDC.CreateCompatibleDC(&dc);
m_bitmap.CreateBitmap (rect.Width(), rect.Height(),0,0,NULL);
m_pDC.SelectObject(&m_bitmap);
m_Brush.CreateSolidBrush(RGB(255,255,255));
m_pDC.SelectObject(&m_Brush);
m_pDC.FillRect(rect,&m_Brush);
TRACE("\n Left: %d, Top: %d Right: %d Bottom: %d",rect.left, rect.top, rect.right, rect.bottom);
//TRACE("\n Start Line: %d End Line: %d", rect.top /cyChar, rect.bottom / cyChar);
m_pDC.SelectObject(GetStockObject(OEM_FIXED_FONT ));
memset (&si, 0, sizeof (SCROLLINFO));
si.cbSize = sizeof (SCROLLINFO);
si.fMask = SIF_POS | SIF_PAGE |SIF_RANGE;

GetScrollInfo(SB_VERT, &si, SIF_POS | SIF_PAGE | SIF_RANGE);

m_nVScrollBarPos = si.nPos;
GetScrollInfo(SB_HORZ, &si, SIF_POS | SIF_PAGE |SIF_RANGE);
m_nHScrollBarPos = si.nPos;

int Start = rect.top / m_cyChar;
int End = rect.bottom / m_cyChar;

TRACE ("\nStart: %u, End: %u YCord: %d", Start, End);

for(int i = Start; i<= End; i++)
{
GetFormattedData(m_lpData, (i + m_nVScrollBarPos )*BYTE_OFFSET, szFormatted);
m_pDC.TextOut((1 - m_nHScrollBarPos) * m_cxChar , i * m_cyChar, szFormatted);
}
m_bitmap.DeleteObject();
dc.BitBlt(rect.left,rect.top,rect.Width(),rect.Height(),&m_pDC,rect.left,rect.top,SRCCOPY);
CPen pen;
dc.SelectObject(GetStockObject(NULL_BRUSH));
dc.Rectangle(start_pt.x, start_pt.y, end_pt.x, end_pt.y);
rect.SetRect(start_pt,end_pt);
ReleaseDC(&m_pDC);
}
GeneralRe: how to select the text of windows client area Pin
Niklas L21-Feb-11 22:55
Niklas L21-Feb-11 22:55 
GeneralRe: how to select the text of windows client area Pin
sarfaraznawaz27-Feb-11 18:24
sarfaraznawaz27-Feb-11 18:24 
GeneralRe: how to select the text of windows client area Pin
Niklas L27-Feb-11 23:07
Niklas L27-Feb-11 23:07 
GeneralRe: how to select the text of windows client area Pin
sarfaraznawaz4-Mar-11 1:55
sarfaraznawaz4-Mar-11 1:55 
GeneralRe: how to select the text of windows client area Pin
Niklas L4-Mar-11 9:52
Niklas L4-Mar-11 9:52 
QuestionHow to use PostMessage function to Close the Recorder of MS-Window-XP Pin
cerne1840@yahoo.com9-Feb-11 17:05
cerne1840@yahoo.com9-Feb-11 17:05 
AnswerRe: How to use PostMessage function to Close the Recorder of MS-Window-XP Pin
Cool_Dev9-Feb-11 19:06
Cool_Dev9-Feb-11 19:06 
AnswerRe: How to use PostMessage function to Close the Recorder of MS-Window-XP Pin
User 74293389-Feb-11 19:56
professionalUser 74293389-Feb-11 19:56 
AnswerRe: How to use PostMessage function to Close the Recorder of MS-Window-XP Pin
Cool_Dev9-Feb-11 20:11
Cool_Dev9-Feb-11 20:11 
QuestionHeight of combo-box Pin
includeh109-Feb-11 7:07
includeh109-Feb-11 7:07 
AnswerRe: Height of combo-box Pin
User 74293389-Feb-11 7:21
professionalUser 74293389-Feb-11 7:21 
GeneralRe: Height of combo-box Pin
includeh109-Feb-11 22:10
includeh109-Feb-11 22:10 
GeneralRe: Height of combo-box Pin
sarfaraznawaz10-Feb-11 1:35
sarfaraznawaz10-Feb-11 1:35 
AnswerRe: Height of combo-box [modified] Pin
User 742933810-Feb-11 5:14
professionalUser 742933810-Feb-11 5:14 
QuestionAccording to the size of the rectangle how to choose the appropriate font ? Pin
confideman20008-Feb-11 21:49
confideman20008-Feb-11 21:49 
QuestionRe: According to the size of the rectangle how to choose the appropriate font ? Pin
CPallini8-Feb-11 23:51
mveCPallini8-Feb-11 23:51 
AnswerRe: According to the size of the rectangle how to choose the appropriate font ? Pin
confideman20009-Feb-11 0:39
confideman20009-Feb-11 0:39 

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.