https://www.google.com/contributor/welcome/?utm_source=publisher&utm_medium=banner&utm_campaign=2376261057261409

Search This Blog

Search with our Site

Custom Search
Showing posts with label CS410. Show all posts
Showing posts with label CS410. Show all posts

Sunday, July 1, 2012

Graded Discussion Board (GDB) of CS410 Visual Programming


Dear Students, Below in bold, there is topic for GDB. You are required to submit your discussion in a mentioned time and duration. Please make sure that your reply should be precise and to the point.GDB will remain open for two consecutive working days. For this you have choice to post your comments from 5th July to 6th July. GDB Topic: Why it is important to study detailed code or functions of windows / visual programming, rather there are many professional tools like Visual Studio etc. available that do the same in mush less time as compared to write a detailed code. Write your opinion precisely in not more than five lines. 


Friday, January 20, 2012

CS410 Assignment No 5 Solution & Discussion Due Date: 19-01-2012


Visual Programming (CS410)
Assignment # 5
  Total marks = 20
                                                                                       Deadline Date = 19-01-2012

Q1 [Marks: 10]

I've allocated a console window in my GUI program, but if the user closes the console, my program closes too. What to do?

SOLUTION
One method that works well is to disable the close menu option. After the console has been allocated withAllocConsole(), you can do this if you can find the console window's handle.

void DisableClose()
{
char buf[100];

    wsprintf ( buf,
               _T("some crazy but unique string that will ID ")
               _T("our window - maybe a GUID and process ID") );

    SetConsoleTitle ( (LPCTSTR) buf );

    // Give this a chance - it may fail the first time through.

HWND hwnd = NULL;

    while ( NULL == hwnd )
        {
        hwnd = ::FindWindowEx ( NULL, NULL, NULL, (LPCTSTR) buf );
        }

    // Reset old title - we'd normally save it with GetConsoleTitle.

    SetConsoleTitle ( _T("whatever") ); 

    // Remove the Close menu item. This will also disable the [X] button

    // in the title bar.

HMENU hmenu = GetSystemMenu ( hwnd, FALSE );

    DeleteMenu ( hmenu, SC_CLOSE, MF_BYCOMMAND );
}

Q2 [marks: 10]

I am trying to write an application (console based), in which one thread reads information from console and another thread prints the same information back to console. Write the code by applying synchronization logic.

SOLUTION


string content = "";
Thread thRead = new Thread(() =>
{
while (true)
{
content = Console.ReadLine();
}
});
thRead.Start();
Thread thWrite = new Thread(() =>
{
while (true)
{
if (!string.IsNullOrEmpty(content))
{
Console.WriteLine(content);
content = "";
}
}
});
thWrite.Start();

Thursday, January 12, 2012

CS410 Assignment No 5 Solution Due Date: 19-01-2012

Q1 [Marks: 10]

I've allocated a console window in my GUI program, but if the user closes the console, my program closes too. What to do?

Q2 [marks: 10]

I am trying to write an application (console based), in which one thread reads information from console and another thread prints the same information back to console. Write the code by applying synchronization logic.



Read more: CS410 Assignment No 5 Solution & Discussion Due Date: 19-01-2012 - Virtual University of Pakistan http://vustudents.ning.com/group/cs410visualprogramming/forum/topics/cs410-assignment-no-5-solution-discussion-due-date-19-01-2012#ixzz1jK0hQ4Km

please discuss this assigment here please

Sunday, January 8, 2012

CS410 Assignment No 4 Solution & Discussion Fall 2011

Q1 [Marks: 10]
Suppose an application has a window and 2 menu resources, one is IDM_MENU1 and second is IDM_MENU2. While registering the window class in this application, we make IDM_MENU1 the class menu. Now, we have 2 scenarios:
1. We give the menu handle of IDM_MENU2 during creating the window.
2. We give NULL as the menu during creating the window.
You have to tell which menu will be associated to the window in both cases.



Q2 [marks: 10]

Suppose we have an application that creates an overlapped window with a push button on it. We have coded the window procedure of the window in such a way that when the button is pressed a message box appears. A smart user makes a very good observation about our application. He say,” When I click the button, a message box appears. I drag the message box to a side using mouse and try to click the button again only to find that I cannot do it now. Now I click OK button of message box and message box disappears. After it I can again click the push button of the window.”
Explain to the user the reason of his/her observation.