1 / 38

Windows Operating Environment

Windows Operating Environment. Windows Operating Environment. 32 bit operating environment – Windows XP Microsoft Visual Studio.net, .net2005, 6.0 STB Rooms 460, 462, 464 75 machines – P4 class Personal storage on remote machines Q: drive (60 MB), Y: drive (100MB)

Télécharger la présentation

Windows Operating Environment

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Windows Operating Environment

  2. Windows Operating Environment • 32 bit operating environment – Windows XP • Microsoft Visual Studio.net, .net2005, 6.0 • STB Rooms 460, 462, 464 • 75 machines – P4 class • Personal storage on remote machines • Q: drive (60 MB), Y: drive (100MB) • Most programs on local hosts

  3. Windows Operating Environment • Tools Available on SCE machines: • Web Browsers (Netscape, Explorer) • Business tools (MS Office) • Math tools (Maple, Matlab) • Programming tools ( MSVC++6.0, etc. ) • ftp • telnet • etc.

  4. Find IP Address of XP Machine • Start -- Programs -- Command Prompt • Brings up a text window • At text prompt: route print C:\users>route print Active Routes: Network Address Netmask Gateway Address Interface Metric 0.0.0.0 0.0.0.0 134.193.2.254 134.193.2.253 1 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1 134.193.2.0 255.255.255.0 134.193.2.253 134.193.2.253 1 134.193.2.253 255.255.255.255 127.0.0.1 127.0.0.1 1 134.193.255.255 255.255.255.255 134.193.2.253 134.193.2.253 1 224.0.0.0 224.0.0.0 134.193.2.253 134.193.2.253 1 255.255.255.255 255.255.255.255 134.193.2.253 134.193.2.253 1

  5. Using ipconfig: Q:\>ipconfig Windows 2000 IP Configuration Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : ddns.umkc.edu IP Address. . . . . . . . . . . . : 134.193.2.253 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 134.193.2.254 Q:\>

  6. Windows Programming Environment - MS Dev Studio

  7. Visual Studio .NET

  8. Windows ProgrammingStart New Project • Microsoft Visual Studio .Net • Start -- Programs -- MS Visual Studio -- MS Visual Studio • To create a new project: • From Start Page: Create -- Project • Identify storage location for new project • Provide Project name • OK

  9. New Project Window

  10. Windows ProgrammingAdd / Create files • Project – Add Existing Item – C++ File • Locate desired files. • Repeat for all needed files • For new files: • Project -- Add New Item – C++ File • Identify file.

  11. Windows ProgrammingAdd Libraries • Project -- Properties • linker tab -- category = Input -- add library names to “Additional Dependencies” • for sockets, add “wsock32.lib”

  12. Add Libraries

  13. To support Multi-threaded Programs: • Select Project  Program Properties • Select C/C++ tab • Code Generation subtab • Runtime Library item: • Default is “Single-threaded Debug (/MLd)” • Select “Multi-threaded Debug DLL (/MDd)”

  14. Windows ProgrammingSelect Active Configuration • Two compile configurations available • Release • Debug • Build – select “Configuration Manager” • Select either Debug or Release • Note that debug versions create large (megabyte) files.

  15. Active / Debug Configuration

  16. Windows ProgrammingBuild and Execute Project • Build -- Build “project_name” • Check message window for compile and link status. • If no errors are indicated, execute program. • Debug – “Start Debugging” or “Start Without Debugging”

  17. Windows Threads • Similar in concept to processes, but designed to identify multiple activities that can be scheduled independently. • All programs have at least 1 thread -- main ( ) program • Any thread can create new threads.

  18. Windows Threads • In C language (console mode): unsigned long _beginthread ( void(_cdecl *start_address)(void *), unsigned stack_size, void *arglistv ); Required Header: <process.h> Required Libraries: LIBCMT.LIB or MSVCRT.LIB

  19. _beginthread ( ) • void(_cdecl *start_address)(void *), • Start address of the routine that will begin the thread • The routine must have no return value • unsigned stack_size, • Provide either a stack size for new thread or, if value is 0, use the same stack size as “parent thread” uses. • void *arglist • Address of data item passed to new thread or NULL if nothing passed

  20. consum.cpp - multithreading #include <stdlib.h> #include <stdio.h> #include <process.h> void addem(void *); int main(int argc, char *argv[]) { int number = 4; _beginthread( addem, 0,(void *)&number); number++; addem(&number); return 0; }

  21. consum.cpp - multithreading void addem(void * vcount) { int i, count, sum; sum = 0; count = *(int *)vcount; for (i=0; i<=count; ++i) { printf("The value of i is %d\n", i); fflush(stdout); sum += i; } printf("The sum is %d\n", sum); fflush(stdout); }

  22. consum.cpp - Results The value of i is 0 The value of i is 1 The value of i is 2 The value of i is 3 The value of i is 4 The value of i is 5 The sum is 15

  23. consum2.cpp - multithreading #include <stdlib.h> #include <stdio.h> #include <process.h> #include <windows.h> void addem(void *); int main(int argc, char *argv[]) { int number = 4; _beginthread( addem, 0,(void *)&number); Sleep (100L); number++; addem(&number); return 0; }

  24. consum2.cpp - multithreading void addem(void *vcount) { int i, sum, count; count = *(int *)vcount; sum = 0; for (i=0; i<=count; ++i) { printf("The value of i is %d\n", i); fflush(stdout); sum += i; } printf("The sum is %d\n", sum); fflush(stdout); }

  25. consum.cpp - Results The value of i is 0 The value of i is 1 The value of i is 2 The value of i is 3 The value of i is 4 The sum is 10 The value of i is 0 The value of i is 1 The value of i is 2 The value of i is 3 The value of i is 4 The value of i is 5 The sum is 15

  26. consumfloat.cpp #include <windows.h> , <stdlib.h, <stdio.h>, <process.h> void p_func(void *); int flag; int main(int argc, char *argv[]) { float num, num2; num = 9.0f; num2 = 12.0f; flag = 0; _beginthread(p_func, 0, (void *)&num); while (flag == 0) ; p_func((void *)&num2); return 0; } 35 cs423-cotter

  27. consumfloat.cpp void p_func(void * vcount) { float *numptr; int number, i, prod; flag = 1; numptr = (float*) vcount; number = (int) *numptr; prod = 1; for (i = 1; i <= number; i++) prod = prod * i; printf("The number is %d\n", number); printf ("The factorial product is %d\n", prod); printf("The float is %5.2f\n", *numptr); fflush(stdout); } cs423-cotter 36

  28. Consumfloat.cpp Results The number is 9 The factorial product is 362880 The float is 9.00 The number is 12 The factorial product is 479001600 The float is 12.00 Press any key to continue . . .

  29. Summary • Many Windows Integrated Development Environments (IDEs) available to develop C++ programs. • UMKC Labs provide Microsoft Visual Studio • Multi-threading supported in Windows IDEs. • Just remember to correctly load the correct runtime libraries.

More Related