Skip to main content

Reading a file using JavaScript

· One min read

To read a file from the browser used the below sample code.

 function ReadFile(filename) {
try {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fh = fso.OpenTextFile(filename,1);
var contents = fh.ReadAll();
fh.Close();
return contents;
} catch (Exception) {
var msg = "ERROR:"+"""+filename+ """+ ": " +Exception.description; alert(msg);
return msg;
}
}

WPF SnippetManager

· One min read

FEATURES

  • To use a snippet:  Drag the title of the snippet to the desired target app.

  • In order to move the app around: Drag the black bottom portion of the window.

  • The topmost checkbox and load/close buttons will work as expected.

Link to complete article SnippetManager

C FAQ

· One min read
  1. How to write a code to count number of characters/Spaces/numbers/special characters present in a sentence.  sentence ="1. GOD IS GREAT !!!"

2. How to insert space between each character in a sentence. sentence ="GOOD MORNING" newsentence = "G O O D  M O R N I N G"

Click here to read complete Article

Tags:

MFC: Fill the Client area with a bitmap

· One min read

In MFC to fill the client area with a bitmap use the following code.

BOOL CMySDIView::OnEraseBkgnd(CDC\* pDC)
{
CDC mymem;
//Create a dc to represent display surface
mymem.CreateCompatibleDC(pDC);

CBitmap bmp;
bmp.LoadBitmap(IDB\_MYBITMAP);
mymem.SelectObject(&bmp);

//BitBlt Copy bitbamp from source (mymem) to destination (pDC)
pDC->BitBlt(0,0,740, 520, &mymem,0,0, SRCCOPY);

return TRUE; // CView::OnEraseBkgnd(pDC);
}

MFC: Fill Client area with a desired color

· One min read

MFC Tip: To fill the Background of the client area with a desired color keeping the text in the client area unchanged

BOOL CMySDIView::OnEraseBkgnd(CDC\* pDC)
{
CRect r;
//GetClientRect gets the width & height of the client area of
//the window
GetClientRect(&r);
CBrush br(RGB(255,250,100));
pDC->SelectObject(br);
pDC->FillRect(r,&br);

return TRUE;
}

Interactive MDX Post

· One min read
NBT
Sr. Software Architect

Blog posts support Docusaurus Markdown features, such as MDX.

tip

Use the power of React to create interactive blog posts.

<button onClick={() => alert("button clicked!")}>Click me!</button>