Creating a DirectX Project
|
|
- Elwin Thornton
- 6 years ago
- Views:
Transcription
1 Creating a DirectX Project A DirectPLay Chat Program Setting up your Compiler for DirectX Install DirectX SDK Make sure your compiler has path to directx8/include Directx8/lib Directx8/samples/multimedia/common/src Directx8/samples/multimedia/common/incl ude 1
2 Create a new win 32 application with Visual C++ Under the Project Settings menu, select Link In the Object/Libraries edit box, enter winmm.lib and dplay.lib Select C/C++ tab From the Category drop down menu, select Code Generation In the Use Run-Time Library drop-down menu, select Multi-Threaded Select OK Under the Project Menu, select Add To Project and then select Files. Browse to where you installed DirectX. Under Directx8/samples/multimedia/common/src, you will find dxutil.cpp. Select this file and then select OK. Repeat the step to add dxutil.h from Directx8/samples/multimedia/common/includ e 2
3 Now, create DpChat.cpp The add new header file called DPChat.h The files will contain global vars declaration, function prototypes, and preprocessor definitions The DPChat Header File 1. #define INITGUID 2. #include <windows.h> 3. #include <dplay8.h> 4. #include <stdio.h> 5. #include "DXUtil.h" Initialize all GUID, must be defined at the beginning of all DirectX application Needs for DirectPlay 6. // // Windows Globals 8. // // Icon Resource 10. #define IDI_ICON1 Button used to join the session // ID's for child windows List box output text 12. #define IDC_hBU_Join #define IDC_hLB_Output Button used to host the session 14. #define IDC_hBU_Host #define IDC_hEB_InputServerIP #define IDC_hEB_InputServerPort #define IDC_hEB_InputName
4 18. #define IDC_hST_TextServerIP #define IDC_hST_TextServerPort #define IDC_hST_TextName #define IDC_hEB_InputField // Handles to child windows 23. HWND hbu_join = NULL; 24. HWND hbu_host = NULL; 25. HWND hlb_output = NULL; 26. HWND heb_inputserverip = NULL; 27. HWND heb_inputserverport = NULL; 28. HWND heb_inputname = NULL; 29. HWND heb_inputfield = NULL; 30. HWND hst_textserverip = NULL; 31. HWND hst_textserverport = NULL; 32. HWND hst_textname = NULL; Static text Edit box to accept chat text 33. // Timer Ids 34. #define TIMERID_CONNECT_COMPLETE 1 Set Windows timer (see later) Run guidgen from command 35. // set the GUID, Needed to identify application prompt 36. GUID DP_CHAT = { 0x2ae835d, 0x9179, 0x485f, { 0x83, 0x43, 0x90, 0x1d, 0x32, 0x7c, 0xe7, 0x94 } }; 37. // Class name & app name 38. LPCTSTR lpszapplicationname = "DPChat"; 39. LPCTSTR lpsztitle = "DPChat"; 40. // // Direct Play Objects 42. // Used for both join and host 43. IDirectPlay8Peer* g_pdp; 44. IDirectPlay8Address* g_pdeviceaddress; 45. IDirectPlay8Address* g_phostaddress; 46. DPNHANDLE g_hconnectasyncop; 47. DPNID g_dpnidlocalplayer = 0; 48. #define MAX_PLAYERS struct PLAYER_INFORMATION 50. { Is this slot being used? 51. bool bactive; 52. DPNID dpnidplayer; Player s unique DirectPlay identifier 53. char szplayername[32]; 54. }; 55. PLAYER_INFORMATION PlayerInfo[MAX_PLAYERS]; 56. // // Multi-Threading Variables 58. // HANDLE g_hconnectcompleteevent; 60. HRESULT g_hrconnectcomplete; 61. CRITICAL_SECTION g_csmodifyplayer; 4
5 62. // // Miscellaneous Variables 64. // LONG g_lnumberofactiveplayers = 0; 66. BOOL bhost = 0; 67. // // Packet Structures 69. // struct PACKET_CHAT 71. { 72. char sztext[256]; 73. }; 74. // // Functions for our Windows Interface 76. // // Message Loop CallBack Function prototype ( REQUIRED FOR ALL WINDOWS PROGRAMS ) 78. LRESULT CALLBACK fnmessageprocessor (HWND, UINT, WPARAM, LPARAM); 79. // Function to display text in the output box 80. void vshowtext(hwnd hchildhandle, char *sztext); 81. // Function to setup display of GUI 82. void vcreateinterface(hwnd hwnd,hinstance hinstance); 83. // Function called when program exits, cleans up allocated objects 84. void vcleanup(void); 85. // // DirectPlay Functions 87. // // Function to initialize direct play system 89. HRESULT hrinitializedirectplay( HWND hwindow ); 90. // Function to send chat message 91. HRESULT hrsendchatmessage(int player, char *szmessage); 92. // Function to handle all incoming Dplay messages 93. HRESULT WINAPI DirectPlayMessageHandler( PVOID pvusercontext, DWORD dwmessageid, PVOID pmsgbuffer ); 94. // Function to host a game 95. HRESULT hrhostgame( HWND hwnd ); 96. // Function to join a game 97. HRESULT hrjoingame( HWND hwnd ); 98. // Function called when a player joins the game 99. HRESULT hrcreateplayer( PVOID pvusercontext, PVOID pmsgbuffer ); 100. // Function called when a player leaves the game 101. HRESULT hrdestroyplayer( PVOID pvusercontext, PVOID pmsgbuffer ); 5
6 DPChat.cpp (main()) 1. #include "dpchat.h" 2. // 3. // Function to Create the Window and Display it ( REQUIRED FOR ALL WINDOWS PROGRAMS ) 4. // 5. int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) 6. { 7. MSG msg; 8. WNDCLASSEX wndclass; 9. HWND hwnd; 10. HRESULT hreturn; 11. // Set up window attributes 12. wndclass.cbsize = sizeof(wndclass); 13. wndclass.style = CS_HREDRAW CS_VREDRAW; 14. wndclass.lpfnwndproc = fnmessageprocessor; 15. wndclass.cbclsextra = 0; 16. wndclass.cbwndextra = 0; 17. wndclass.hinstance = hinstance; 18. wndclass.hicon = LoadIcon( hinstance, MAKEINTRESOURCE(IDI_ICON1) ); 19. wndclass.hcursor = LoadCursor( NULL, IDC_ARROW ); 20. wndclass.hbrbackground = (HBRUSH)(COLOR_WINDOW); 21. wndclass.lpszmenuname = NULL; 22. wndclass.lpszclassname = lpszapplicationname; // Registered Class Name 23. wndclass.hiconsm = LoadIcon( hinstance, MAKEINTRESOURCE(IDI_ICON1) ); if( RegisterClassEx( &wndclass ) == 0 ) { 26. // Do error logic here 27. exit(1); 28. } 6
7 29. // Create the main window 30. hwnd = CreateWindow( lpszapplicationname,// Application Name 31. lpsztitle, // Name Displayed on Title Bar 32. WS_OVERLAPPEDWINDOW, , , , , 37. NULL, 38. NULL, 39. hinstance, 40. NULL ); 41. // Create Child Objects 42. vcreateinterface(hwnd,hinstance); ShowWindow(hWnd, ncmdshow); 45. UpdateWindow(hWnd); 46. // Initialize Direct Play 47. hreturn = hrinitializedirectplay( hwnd ); 48. if( FAILED(hReturn) ) { 49. vcleanup(); 50. exit(1); 51. } // Process messages until the program is terminated 54. while( GetMessage ( &msg, NULL, 0, 0 ) ) 55. { 56. TranslateMessage( &msg ); 57. DispatchMessage( &msg ); 58. } return(msg.wparam); 61. } Not using PeekMessage() in this example 7
8 vcreateinterface(hwnd,hinstance) 1. void vcreateinterface(hwnd hwnd,hinstance hinstance) 2. { 3. // Server IP Text 4. hst_textserverip = CreateWindow( 5. "static","server IP", 6. WS_CHILD SS_CENTER WS_VISIBLE, 7. 5, 8. 5, , , 11. hwnd,(hmenu)idc_hst_textserverip,hinstance,null); 12. // Port Text 13. hst_textserverport = CreateWindow( 14. "static","port", 15. WS_CHILD SS_CENTER WS_VISIBLE, , 17. 5, , , 20. hwnd,(hmenu)idc_hst_textserverport,hinstance,null); // Name Text 23. hst_textname = CreateWindow( 24. "static","player Name", 25. WS_CHILD SS_CENTER WS_VISIBLE, , 27. 5, , , 30. hwnd,(hmenu)idc_hst_textname,hinstance,null); 8
9 31. // Join Button 32. hbu_join = CreateWindow( 33. "BUTTON", 34. "Join", 35. WS_CHILD WS_VISIBLE BS_PUSHBUTTON, , , , , 40. hwnd,(hmenu)idc_hbu_join,hinstance,null); // Host Button 43. hbu_host = CreateWindow( 44. "BUTTON", 45. "Host", 46. WS_CHILD WS_VISIBLE BS_PUSHBUTTON, , , , , 51. hwnd,(hmenu)idc_hbu_host,hinstance,null); 52. // Output Window 53. hlb_output = CreateWindowEx( 54. WS_EX_CLIENTEDGE, 55. "LISTBOX", 56. NULL, 57. WS_CHILD WS_VISIBLE LBS_NOTIFY WS_VSCROLL WS_BORDER, 58. 5, , , , 62. hwnd,(hmenu)idc_hlb_output,hinstance,null); // Name 65. heb_inputname = CreateWindowEx( 66. WS_EX_CLIENTEDGE, 67. "EDIT","Unnamed", 68. WS_CHILD WS_VISIBLE WS_BORDER ES_LEFT, , , , , 73. hwnd,(hmenu)idc_heb_inputname,hinstance,null); 9
10 74. // Server IP 75. heb_inputserverip = CreateWindowEx( 76. WS_EX_CLIENTEDGE, 77. "EDIT"," ", 78. WS_CHILD WS_VISIBLE WS_BORDER ES_LEFT, 79. 5, , , , 83. hwnd,(hmenu)idc_heb_inputserverip,hinstance,null); // Server Port 86. heb_inputserverport = CreateWindowEx( 87. WS_EX_CLIENTEDGE, 88. "EDIT","6000", 89. WS_CHILD WS_VISIBLE WS_BORDER ES_LEFT, , , , , 94. hwnd,(hmenu)idc_heb_inputserverport,hinstance,null); 95. // Edit field to enter chat messages into 96. heb_inputfield = CreateWindowEx( 97. WS_EX_CLIENTEDGE, 98. "EDIT",NULL, 99. WS_CHILD WS_VISIBLE WS_BORDER ES_LEFT ES_AUTOVSCROLL ES_MULTILINE, , , , , 104. hwnd,(hmenu)idc_heb_inputfield,hinstance,null); 105. } 10
11 hst_textserverport hst_textserverip Screen shot heb_inputserverip heb_inputserverport hst_textname heb_inputname hlb_output hbu_host heb_inputfield hbu_join Output to list box 1. void vshowtext(hwnd hchildhandle, char *sztext) 2. { 3. int Line; // add string to the listbox 6. SendMessage(hChildHandle,LB_ADDSTRING,0,(LPARAM)szText); // determine number of items in listbox 9. Line = SendMessage(hChildHandle,LB_GETCOUNT,0,0); // flag last item as the selected item, to scroll listbox down 12. SendMessage(hChildHandle,LB_SETCURSEL,Line-1,0); // unflag all items to eliminate negative highlite 15. SendMessage(hChildHandle,LB_SETCURSEL,-1,0); 16. } 11
12 fnmessageprocessor() 1. LRESULT CALLBACK fnmessageprocessor ( HWND hwnd, UINT imsg, WPARAM wparam, LPARAM lparam ) 2. { 3. char szmessage[256]; 4. char szcompmessage[256]; 5. HRESULT hreturn; switch (imsg) 8. { 9. case WM_COMMAND: 10. { 11. // Check for child window messages 12. switch(loword(wparam)) 13. { 14. // Check if the user clicked the button 15. case IDC_hBU_Join: 16. hrjoingame( hwnd ); 17. break; 18. case IDC_hBU_Host: 19. hrhostgame( hwnd ); 20. break; 21. } 22. switch(hiword(wparam)) 23. { 24. case EN_UPDATE: 25. // Get the text from the edit box 26. GetWindowText(hEB_InputField,szMessage,256); 27. // Check if they pressed enter 28. if( szmessage[strlen(szmessage)-1] == 10 ) { 29. // Get rid of trailing garbage 30. szmessage[strlen(szmessage)-2] = '\0'; 31. sprintf(szcompmessage,"<%s> %s", PlayerInfo[0].szPlayerName, szmessage); 32. hreturn = hrsendchatmessage(- 1,szCompMessage); 33. // clear input field 34. SetWindowText(hEB_InputField,""); 35. } 36. } 37. break; 38. } 39. case WM_DESTROY: 40. // Cleanup System 41. vcleanup(); 42. // Exit out of Windows 43. PostQuitMessage(0); 44. break; 12
13 45. case WM_TIMER: 46. if( wparam == TIMERID_CONNECT_COMPLETE ) { 47. // Check if the message is telling us our connection is complete 48. if( WAIT_OBJECT_0 == WaitForSingleObject( g_hconnectcompleteevent, 0 ) ) { 49. if( FAILED( g_hrconnectcomplete ) ) { 50. vshowtext(hlb_output,"<<---connection IN- COMPLETE---->>"); 51. } 52. else { 53. vshowtext(hlb_output,"<<----connection COMPLETE---->>"); 54. } 55. KillTimer( hwnd, TIMERID_CONNECT_COMPLETE ); 56. } 57. } 58. break; default: 61. return(defwindowproc(hwnd, imsg, wparam, lparam)); 62. } We set it earlier 63. return(0l); } So far, it s all Windows GUI hrinitializedirectplay() in WinMain 1. HRESULT hrinitializedirectplay( HWND hwindow ) 2. { 3. HRESULT hreturn; 4. int i; // Initialize COM 7. hreturn = CoInitialize( NULL ); 8. if( FAILED(hReturn) ) { 9. MessageBox( hwindow, "Error Initializing COM", "DirectPlay Error", MB_ICONERROR ); 10. return hreturn; 11. } // Initialize critical sections for multi-threading 14. InitializeCriticalSection( &g_csmodifyplayer ); When players join sessions or leave sessions at the same time, the list of players won t be corrupted 13
14 15. // Create IDirectPlay8Peer Object 16. if( FAILED( hreturn = CoCreateInstance( CLSID_DirectPlay8Peer, 17. NULL, 18. CLSCTX_INPROC_SERVER, 19. IID_IDirectPlay8Peer, 20. (LPVOID*) &g_pdp ) ) ) 21. MessageBox( hwindow, "Can't Create DPlayPeer", "DirectPlay Error", MB_ICONERROR ); // Init IDirectPlay8Peer Message Handler 24. if( FAILED( hreturn = g_pdp->initialize( NULL, DirectPlayMessageHandler, 0 ) ) ) { 25. MessageBox( hwindow, "Failed to Message Handler", "DirectPlay Error", MB_ICONERROR ); 26. return -1; 27. } // Create a device address 30. hreturn = CoCreateInstance( CLSID_DirectPlay8Address, NULL,CLSCTX_INPROC_SERVER, IID_IDirectPlay8Address, (LPVOID*) &g_pdeviceaddress ); 31. if( FAILED(hReturn) ) { 32. MessageBox( hwindow, "Failed to Create Device", "CoCreateInstance()", MB_ICONERROR ); 33. return -1; 34. } 35. // Set our service provider to TCP/IP 36. if( FAILED( hreturn = g_pdeviceaddress->setsp( &CLSID_DP8SP_TCPIP ) ) ) { 37. MessageBox( hwindow, "Failed to SetSP() for Device Address", "Invalid Param", MB_ICONERROR ); 38. return -1; 39. } // Create a host address 42. hreturn = CoCreateInstance( CLSID_DirectPlay8Address, NULL,CLSCTX_INPROC_SERVER, IID_IDirectPlay8Address, (LPVOID*) &g_phostaddress ); 43. if( FAILED(hReturn) ) { 44. MessageBox( hwindow, "Failed to Create Host Address()", "Invalid Param", MB_ICONERROR ); 45. return -1; 46. } 47. // Set the host address to TCP/IP 48. if( FAILED( hreturn = g_phostaddress->setsp( &CLSID_DP8SP_TCPIP ) ) ) { 49. MessageBox( hwindow, "Failed to SetSP() for Host Address", "Invalid Param", MB_ICONERROR ); 50. return -1; 51. } 52. // Create connection complete event for later use 53. g_hconnectcompleteevent = CreateEvent( NULL, FALSE, FALSE, NULL ); See next page 14
15 54. vshowtext(hlb_output,"<<--tcp INITED-->>"); 55. // Init miscellaneous variables 56. for( i = 0 ; i < MAX_PLAYERS ; i++ ) { 57. PlayerInfo[i].bActive = 0; 58. } return S_OK; 61. } HANDLE CreateEvent( LPSECURITY_ATTRIBUTES lpeventattributes, //security attributes that can be inherited BOOL bmanualreset, //or auto reset, depending on the boolean BOOL binitialstate, //event should start out signaled or not LPCTSTR lpname //name the event with this string ); DirectPlayMessageHandler() 1. HRESULT WINAPI DirectPlayMessageHandler( PVOID pvusercontext, DWORD dwmessageid, PVOID pmsgbuffer ) 2. { 3. HRESULT hreturn = S_OK; switch( dwmessageid ) 6. { 7. case DPN_MSGID_CREATE_PLAYER: 8. { 9. vshowtext(hlb_output,"creating Player"); 10. hrcreateplayer(pvusercontext,pmsgbuffer); 11. break; 12. } case DPN_MSGID_DESTROY_PLAYER: 15. { 16. hrdestroyplayer(pvusercontext,pmsgbuffer); 17. break; 18. } 15
16 19. case DPN_MSGID_HOST_MIGRATE: 20. { 21. vshowtext(hlb_output,"migrate Host"); 22. Received by the one PDPNMSG_HOST_MIGRATE phostmigratemsg; 23. who will take over at phostmigratemsg = (PDPNMSG_HOST_MIGRATE)pMsgBuffer; 24. hosting. DirectPlay 25. handles host change // Check to see if we are the new host 26. automatically if( phostmigratemsg->dpnidnewhost == g_dpnidlocalplayer ) { 27. vshowtext(hlb_output,"(hosting)"); 28. } 29. break; 30. } case DPN_MSGID_TERMINATE_SESSION: 33. { 34. vshowtext(hlb_output,"<-terminating Session->"); 35. PDPNMSG_TERMINATE_SESSION pterminatesessionmsg; 36. pterminatesessionmsg = (PDPNMSG_TERMINATE_SESSION)pMsgBuffer; 37. break; 38. } If migration is not active and the host terminates the session, everyone gets disconnected 39. case DPN_MSGID_RECEIVE: 40. { 41. PDPNMSG_RECEIVE preceivemsg; 42. Received preceivemsg = (PDPNMSG_RECEIVE)pMsgBuffer; whenever a chat message is sent. vshowtext(hlb_output,(char*)preceivemsg->preceivedata); This msg type is used by all games break; 47. to send custom } 48. messages 49. case DPN_MSGID_CONNECT_COMPLETE: 50. { 51. PDPNMSG_CONNECT_COMPLETE pconnectcompletemsg; 52. pconnectcompletemsg = (PDPNMSG_CONNECT_COMPLETE)pMsgBuffer; g_hrconnectcomplete = pconnectcompletemsg->hresultcode; 55. SetEvent( g_hconnectcompleteevent ); 56. break; 57. } 58. } return hreturn; 61. } Any player who joins a session successfully receives this message Put the event into a signaled state 16
17 hrhostgame() in fnmessageprocessor() 1. HRESULT hrhostgame( HWND hwindow) 2. { 3. HRESULT hreturn; 4. char szpeername[256]; 5. char szsessionname[256]; 6. WCHAR wszpeername[256]; 7. WCHAR wszsessionname[256]; 8. DPN_APPLICATION_DESC dnappdesc; 9. char szport[6]; 10. DWORD dwlength = 256; 11. DPN_PLAYER_INFO dpplayerinfo; 12. DWORD dwport = 9000; Used for player info 13. // Setup our player information Host is a player too, don t forget 14. GetWindowText(hEB_InputName,szPeerName,36);// Get name from Window Edit Box 15. DXUtil_ConvertGenericStringToWide( wszpeername, szpeername ); 16. ZeroMemory( &dpplayerinfo, sizeof(dpn_player_info) ); 17. dpplayerinfo.dwsize = sizeof(dpn_player_info); 18. dpplayerinfo.dwinfoflags = DPNINFO_NAME; //tell it to get info from pwszname 19. dpplayerinfo.pwszname = wszpeername; // Set us up to be non-asynchronous 22. if( FAILED( hreturn = g_pdp->setpeerinfo( &dpplayerinfo, NULL, NULL, DPNSETPEERINFO_SYNC ) ) ) { 23. MessageBox( hwindow, "Failed to SetPeerInfo()", "DirectPlay Error", MB_ICONERROR ); 24. return -1; 25. } // Setup the application description 28. sprintf(szsessionname,"%s's Game",szPeerName); 29. DXUtil_ConvertGenericStringToWide( wszsessionname, szsessionname ); ZeroMemory( &dnappdesc, sizeof(dpn_application_desc) ); 32. dnappdesc.dwsize = sizeof(dpn_application_desc); 33. dnappdesc.guidapplication = DP_CHAT; 34. dnappdesc.pwszsessionname = wszsessionname; 35. dnappdesc.dwmaxplayers = MAX_PLAYERS; Host can migrate 36. dnappdesc.dwflags = DPNSESSION_MIGRATE_HOST; 17
18 37. // Get Port from edit box 38. GetWindowText(hEB_InputServerPort,szPort,6); 39. // Convert the port string to a DWORD 40. dwport = atol(szport); // Add port number to address A host needs port number to accept connection 43. hreturn = g_pdeviceaddress- >AddComponent(DPNA_KEY_PORT,&dwPort,sizeof(DWORD),DPNA_DATATYPE_DWORD); 44. if( hreturn!= S_OK ) { 45. MessageBox( hwindow, "Failed to AddComponent()", "hrhostgame()", MB_ICONERROR ); 46. return -1; 47. } // Host the game Application description address 50. hreturn = g_pdp->host( &dnappdesc, 51. &g_pdeviceaddress, 52. 1, Host address 53. NULL, 54. NULL, Number of host address in &g_pdeviceaddress 55. NULL, 56. NULL ); Player context Optional flags 57. if( FAILED( hreturn ) ) { 58. if( hreturn == DPNERR_INVALIDPARAM ) 59. MessageBox( hwindow, "Failed to Host()", "Invalid Param", MB_ICONERROR ); 60. else if( hreturn == DPNERR_INVALIDDEVICEADDRESS ) 61. MessageBox( hwindow, "Failed to Host()", "Invalid Device Address", MB_ICONERROR ); 62. else 63. MessageBox( hwindow, "Failed to Host()", "DirectPlay Error", MB_ICONERROR ); 64. return -1; 65. } 66. // Let us know we are the host 67. bhost = 1; vshowtext(hlb_output,"<- Hosting ->"); return hreturn; 72. } 18
19 hrcreateplayer() As soon as we finish the Host() function, the program receives a create player message. This function is actually called from DirectPlayMessageHandler() The message type is DPN_MSGID_CREATE_PLAYER 1. HRESULT hrcreateplayer( PVOID pvusercontext, PVOID pmsgbuffer ) 2. { 3. HRESULT hreturn = S_OK; 4. PDPNMSG_CREATE_PLAYER pcreateplayermsg; 5. char strname[256]; 6. char szoutput[256]; 7. DWORD dwsize = 0; 8. DPN_PLAYER_INFO *pdpplayerinfo = NULL; 9. int i; // Get a Create Message pointer to the buffer 12. pcreateplayermsg = (PDPNMSG_CREATE_PLAYER)pMsgBuffer; // Get the peer info and extract its name 15. hreturn = g_pdp->getpeerinfo( pcreateplayermsg->dpnidplayer, pdpplayerinfo, &dwsize, 0 ); 16. if( FAILED(hReturn) && hreturn!= DPNERR_BUFFERTOOSMALL ) { 17. hreturn = -1; 18. } 19. else { 20. // Allocate memory for the player info 21. pdpplayerinfo = (DPN_PLAYER_INFO*) new BYTE[ dwsize ]; ZeroMemory( pdpplayerinfo, dwsize ); 24. pdpplayerinfo->dwsize = sizeof(dpn_player_info); 25. // Load the player info into the newly allocated data 26. hreturn = g_pdp->getpeerinfo( pcreateplayermsg->dpnidplayer, pdpplayerinfo, &dwsize, 0 ); 19
20 Additional note, before we continue Typedef struct _DPNMSGH_CREATE_PLAYER{ DWORD dwsize;//size of this structure DPNID dpnidplayer;//dpnid of new player PVOID pvplayercontext } DPNMSGH_CREATE_PLAYER, * PDPNMSGH_CREATE_PLAYER; HRESULT GetPeerInfo( const DPNID dpnid, //peer id of the one we want to get info DPN_PLAYER_INFO *const pdpnplayerinfo, //info will be stored here DWORD *const pdwsize, //size of the returned data const DWORD dwflags // reserved data, always zero ); 27. if( FAILED(hReturn) ) { 28. hreturn = -1; 29. } 30. else { 31. EnterCriticalSection( &g_csmodifyplayer ); // Convert player name to ANSI 34. DXUtil_ConvertWideStringToGeneric( strname, pdpplayerinfo- >pwszname ); 35. // Add player to list 36. for( i = 0 ; i < MAX_PLAYERS ; i++ ) { 37. if(!playerinfo[i].bactive ) { 38. PlayerInfo[i].bActive = 1; 39. PlayerInfo[i].dpnidPlayer = pcreateplayermsg->dpnidplayer; 40. strcpy(playerinfo[i].szplayername,strname); 41. break; 42. } 43. } 20
21 44. // Check if no free slot found 45. if( i == MAX_PLAYERS ) { 46. vshowtext(hlb_output,"no free slots in game!"); 47. } 48. // Check if we are adding ourselves 49. else if( pdpplayerinfo->dwplayerflags & DPNPLAYER_LOCAL ) { 50. g_dpnidlocalplayer = pcreateplayermsg- >dpnidplayer; 51. sprintf(szoutput,"<slot%d> Added Ourselves",i); 52. vshowtext(hlb_output,szoutput); 53. } 54. else { 55. sprintf(szoutput,"<slot%d><%s> Is In The Game",i,strName); 56. vshowtext(hlb_output,szoutput); 57. // Send them a welcoming message if we are the host 58. sprintf(szoutput,"welcome to the game, %s!",strname); 59. if( bhost ) { 60. hrsendchatmessage(i,szoutput); 61. } 62. } Clean memory 63. SAFE_DELETE_ARRAY( pdpplayerinfo ); Increment global // Update the number of active players in a thread safe way 66. var in a threadsafe way InterlockedIncrement( &g_lnumberofactiveplayers ); 67. LeaveCriticalSection( &g_csmodifyplayer ); 68. } 69. } return hreturn; 72. } 21
22 hrjoingame() in fnmessageprocessor() 1. HRESULT hrjoingame( HWND hwnd ) 2. { 3. HRESULT hreturn = S_OK; 4. WCHAR wszhostname[256]; 5. WCHAR wszpeername[256]; 6. char szpeername[256]; 7. char szip[256]; 8. char szport[256]; 9. DWORD dwport; 10. DWORD dwlength = 256; 11. DPN_APPLICATION_DESC dpnappdesc; 12. DPN_PLAYER_INFO dpplayerinfo; 13. vshowtext(hlb_output,"attempting Connection..."); 14. // Set the peer info 15. GetWindowText(hEB_InputName,szPeerName,36); // Get name from Window Edit Box 16. DXUtil_ConvertGenericStringToWide( wszpeername, szpeername ); 17. ZeroMemory( &dpplayerinfo, sizeof(dpn_player_info) ); 18. dpplayerinfo.dwsize = sizeof(dpn_player_info); 19. dpplayerinfo.dwinfoflags = DPNINFO_NAME; 20. dpplayerinfo.pwszname = wszpeername; 21. // Make this a synchronous call 22. if( FAILED( hreturn = g_pdp->setpeerinfo( &dpplayerinfo, NULL, NULL, DPNSETPEERINFO_SYNC ) ) ) { 23. vshowtext(hlb_output,"failed to set peer info"); 24. return -1; 25. } // Prepare the application description 28. ZeroMemory( &dpnappdesc, sizeof( DPN_APPLICATION_DESC ) ); 29. dpnappdesc.dwsize = sizeof( DPN_APPLICATION_DESC ); 30. dpnappdesc.guidapplication = DP_CHAT; 31. // Get IP from edit box 32. GetWindowText(hEB_InputServerIP,szIP,32); 33. // Get Port from edit box 34. GetWindowText(hEB_InputServerPort,szPort,6); 35. // Convert the IP to a wide string 36. DXUtil_ConvertGenericStringToWide( wszhostname, szip ); 37. // Convert the port string to a DWORD 38. dwport = atol(szport); 22
23 39. // Add host name to address 40. hreturn = g_phostaddress- >AddComponent(DPNA_KEY_HOSTNAME,wszHostName,(wcslen(wszHostName)+1)*siz eof(wchar),dpna_datatype_string); 41. if( hreturn!= S_OK ) { 42. MessageBox( hwnd, "Failed to AddComponent()", "hrjoingame()", MB_ICONERROR ); 43. return -1; 44. } 45. // Add port number to address 46. hreturn = g_phostaddress- >AddComponent(DPNA_KEY_PORT,&dwPort,sizeof(DWORD),DPNA_DATATYPE_DWOR D); 47. if( hreturn!= S_OK ) { 48. MessageBox( hwnd, "Failed to AddComponent()", "hrjoingame()", MB_ICONERROR ); 49. return -1; 50. } 51. // Connect to the session 52. hreturn = g_pdp->connect( &dpnappdesc, 53. g_phostaddress, 54. g_pdeviceaddress, 55. NULL, //reserved 56. NULL, //reserved 57. NULL, //optional user connect data 58. 0, // size of optional connect data 59. NULL, //optional context 60. NULL, //optional user-supplied context 61. &g_hconnectasyncop, //asynchronous handle 62. NULL); // flags if( hreturn!= E_PENDING && FAILED(hReturn) ) { 65. vshowtext(hlb_output,"failed to Connect"); 66. return -1; 67. } 68. SetTimer( hwnd, TIMERID_CONNECT_COMPLETE, 100, NULL ); 69. return(hreturn); 70. } 100 milliseconds timer, to signal program to check for a connection complete indicator-> so we don t have to only loop waiting for connection 23
24 Joiner.. Gets at least 2 create messages, one for the host and one for the joiner If any other players are present, then you also get creation messages for them hrsendchatmessage() HRESULT hrsendchatmessage(int player, char *szmessage) { PACKET_CHAT msgchat; DPNHANDLE hasync; DWORD dwlength = strlen(szmessage); DPN_BUFFER_DESC bufferdesc; // If no message to send, then just return if( dwlength == 0 ) return S_OK; Player to send, -1 for all players Called in fnmessageprocessor() // Copy the message to send into our packet strcpy(msgchat.sztext,szmessage); // Set the size of the packet to send bufferdesc.dwbuffersize = sizeof(packet_chat) + dwlength; // Copy our packet into the send buffer bufferdesc.pbufferdata = (BYTE*) &msgchat; // Send message to everyone including ourselves if -1 passed if( player == -1 ) g_pdp->sendto( DPNID_ALL_PLAYERS_GROUP, &bufferdesc, 1, 0, NULL, &hasync, 0 ); // Send to specific player otherwise else g_pdp->sendto( PlayerInfo[player].dpnidPlayer, &bufferdesc, 1, 0, NULL, &hasync, 0 ); } return S_OK; 24
25 SendTo() HRESULT SendTo( const DPNID DPN_BUFFER_DESC const DWORD DWORD void DPNHANDLE const DWORD dpnid, //player to send to, use DPNIN_ALL_PLAYERS_GROUP // for all players *const pbufferdesc, //the one loaded with message info cbufferdesc, //no.of buffer you are sending dwtimeout, // 0 for no time out *const pvasynccontext, //optional async context *const pasynchandle, //async handle dwflags ); Flags for SendTo() DPN_SEND_SYNC tells the program to process the send synchronously DPN_SEND_NOCOPY Keeps from making an internal copy DPN_SEND_NOCOMPLETE Prevent DPN_MSGID_SEND_NOCOMPLETE message from being received when a message is complete DPN_SEND_COMPLETEONPROCESS Sends a DPN_MSGID_SEND_NOCOMPLETE message to a message handler when the message is received and processed by the target. This can greatly slow down transmission. You must use DPN_GUARANTEED with this flag DPN_SEND_GUARANTEED Guarantees delivery of the message. Can slow down transmission 25
26 Flags for SendTo() cont DPN_SEND_PRIORITY_HIGH DPN_SEND_PRIORITY_LOW DPN_SEND_NONSEQUENTIAL Target receives the message in order they arrive and not in order they were sent DPN_SEND_NOLOOPBACK Keeps you from sending a broadcast message back to yourself hrdestroyplayer() 1. HRESULT hrdestroyplayer( PVOID pvusercontext, PVOID pmsgbuffer ) 2. { 3. PDPNMSG_DESTROY_PLAYER pdestroyplayermsg; 4. HRESULT hreturn = S_OK; 5. int i; 6. char szoutput[256]; // Get a Destroy Message pointer to the buffer 9. pdestroyplayermsg = (PDPNMSG_DESTROY_PLAYER)pMsgBuffer; if( pdestroyplayermsg->dwreason == DPNDESTROYPLAYERREASON_NORMAL ) { 12. vshowtext(hlb_output,"player Left Normally"); 13. } Why the player is destroyed 26
27 14. else if( pdestroyplayermsg->dwreason == DPNDESTROYPLAYERREASON_CONNECTIONLOST ) { 15. vshowtext(hlb_output,"connection Lost w/player"); 16. } 17. else if( pdestroyplayermsg->dwreason == DPNDESTROYPLAYERREASON_SESSIONTERMINATED ) { 18. vshowtext(hlb_output,"player Terminated Session"); 19. } 20. else if( pdestroyplayermsg->dwreason == DPNDESTROYPLAYERREASON_HOSTDESTROYEDPLAYER ) { 21. vshowtext(hlb_output,"player Kicked By Host"); 22. } // Update the number of active players in a thread safe way 25. InterlockedDecrement( &g_lnumberofactiveplayers ); 26. EnterCriticalSection( &g_csmodifyplayer ); 27. // Remove Player from list 28. for( i = 0 ; i < MAX_PLAYERS ; i++ ) { 29. if( PlayerInfo[i].bActive ) { 30. if( PlayerInfo[i].dpnidPlayer == pdestroyplayermsg- >dpnidplayer ) { 31. PlayerInfo[i].bActive = 0; 32. sprintf(szoutput,"<slot%d><%s> Left The Game",i,PlayerInfo[i].szPlayerName); 33. vshowtext(hlb_output,szoutput); 34. break; 35. } 36. } 37. } LeaveCriticalSection( &g_csmodifyplayer ); return(hreturn); 42. } 27
Client and Server (DirectX)
Client and Server (DirectX) Vishnu Kotrajaras Server scalability Your game can handle more players at a time (Over internet, most peer-topeer can only handle about 6 players) All depend on server power
More informationDirectPlay. What is DirectPlay? Vishnu Kotrajaras, PhD
DirectPlay Vishnu Kotrajaras, PhD What is DirectPlay? It is a multiplayer component of DirectX It abstracts communication methods away Same function call for communication by TCP/IP, serial cable and modem
More informationWindow programming. Programming
Window programming 1 Objectives Understand the mechanism of window programming Understand the concept and usage of of callback functions Create a simple application 2 Overview Windows system Hello world!
More information/*********************************************************************
Appendix A Program Process.c This application will send X, Y, Z, and W end points to the Mx4 card using the C/C++ DLL, MX495.DLL. The functions mainly used are monitor_var, change_var, and var. The algorithm
More informationWindows Programming. 1 st Week, 2011
Windows Programming 1 st Week, 2011 시작하기 Visual Studio 2008 새프로젝트 파일 새로만들기 프로젝트 Visual C++ 프로젝트 Win32 프로젝트 빈프로젝트 응용프로그램설정 Prac01 솔루션 새항목추가 C++ 파일 main.cpp main0.cpp cpp 다운로드 솔루션빌드 오류 Unicode vs. Multi-Byte
More informationLSN 4 GUI Programming Using The WIN32 API
LSN 4 GUI Programming Using The WIN32 API ECT362 Operating Systems Department of Engineering Technology LSN 4 Why program GUIs? This application will help introduce you to using the Win32 API Gain familiarity
More informationWe display some text in the middle of a window, and see how the text remains there whenever the window is re-sized or moved.
1 Programming Windows Terry Marris January 2013 2 Hello Windows We display some text in the middle of a window, and see how the text remains there whenever the window is re-sized or moved. 2.1 Hello Windows
More informationGame Programming I. Introduction to Windows Programming. Sample Program hello.cpp. 5 th Week,
Game Programming I Introduction to Windows Programming 5 th Week, 2007 Sample Program hello.cpp Microsoft Visual Studio.Net File New Project Visual C++ Win32 Win32 Project Application Settings Empty project
More informationModern GUI applications may be composed from a number of different software components.
Chapter 3 GUI application architecture Modern GUI applications may be composed from a number of different software components. For example, a GUI application may access remote databases, or other machines,
More informationChapter 15 Programming Paradigm
Chapter 15 Programming Paradigm A Windows program, like any other interactive program, is for the most part inputdriven. However, the input of a Windows program is conveniently predigested by the operating
More informationhinstance = ((LPCREATESTRUCT)lParam)->hInstance obtains the program's instance handle and stores it in the static variable, hinstance.
1 Programming Windows Terry Marris Jan 2013 6 Menus Three programs are presented in this chapter, each one building on the preceding program. In the first, the beginnings of a primitive text editor are
More informationAlisson Sol Knowledge Engineer Engineering Excellence June 08, Public version
Alisson Sol Knowledge Engineer Engineering Excellence June 08, 2011 Public version Information about the current inflection point Mature Mainframe, desktop, graphical user interface, client/server Evolving
More informationWindows and Messages. Creating the Window
Windows and Messages In the first two chapters, the sample programs used the MessageBox function to deliver text output to the user. The MessageBox function creates a "window." In Windows, the word "window"
More informationCourse 3D_OpenGL: 3D-Graphics with C++ and OpenGL Chapter 1: Moving Triangles
1 Course 3D_OpenGL: 3D-Graphics with C++ and OpenGL Chapter 1: Moving Triangles Project triangle1 Animation Three Triangles Hundred Triangles Copyright by V Miszalok, last update: 2011-03-20 This project
More informationReview. Designing Interactive Systems II. The Apple Macintosh
Review Designing Interactive Systems II Computer Science Graduate Programme SS 2010 Prof. Dr. Media Computing Group RWTH Aachen University What is the difference between Smalltalk, Squeak, and Morphic?
More informationUsing DAQ Event Messaging under Windows NT/95/3.1
Application Note 086 Using DAQ Event Messaging under Windows NT/95/3.1 by Ken Sadahiro Introduction The NI-DAQ language interface for PCs is mostly a "polling-oriented" Application Programming Interface,
More informationFront Panel: Free Kit for Prototyping Embedded Systems on Windows
QP state machine frameworks for Microsoft Windows Front Panel: Document Revision D February 2015 Copyright Quantum Leaps, LLC info@state-machine.com www.state-machine.com Table of Contents 1 Introduction...
More informationGetting Started. 1 st Week, Sun-Jeong Kim. Computer Graphics Applications
OpenGL Programming Getting Started 1 st Week, 2008 Sun-Jeong Kim Visual Studio 2005 Windows Programming 2 Visual C++ Win32 Application New Project 3 Empty project Application Settings 4 Solution Prac01
More informationComputer Programming Lecture 11 이윤진서울대학교
Computer Programming Lecture 11 이윤진서울대학교 2007.1.24. 24 Slide Credits 엄현상교수님 서울대학교컴퓨터공학부 Computer Programming, g, 2007 봄학기 Object-Oriented Programming (2) 순서 Java Q&A Java 개요 Object-Oriented Oriented Programming
More informationC Windows 16. Visual C++ VC Borland C++ Compiler BCC 2. Windows. c:\develop
Windows Ver1.01 1 VC BCC DOS C C Windows 16 Windows98/Me/2000/XP MFC SDL Easy Link Library Visual C++ VC Borland C++ Compiler BCC 2 2 VC MFC VC VC BCC Windows DOS MS-DOS VC BCC VC BCC VC 2 BCC5.5.1 c:\develop
More informationWindows Programming in C++
Windows Programming in C++ You must use special libraries (aka APIs application programming interfaces) to make something other than a text-based program. The C++ choices are: The original Windows SDK
More informationGame Programming Genesis Part II : Using Resources in Win32 Programs by Joseph "Ironblayde" Farrell
Game Programming Genesis Part II : Using Resources in Win32 Programs GameDev.net Introduction Game Programming Genesis Part II : Using Resources in Win32 Programs by Joseph "Ironblayde" Farrell Welcome
More informationTask Toolkit Manual for InduSoft Web Studio v6.1+sp3
Task Toolkit Manual for InduSoft Web Studio v6.1+sp3 This manual documents the public Studio Toolkit functions and example program. 1. Introduction The Studio Toolkit is a set of functions provided in
More informationCall DLL from Limnor Applications
Call DLL from Limnor Applications There is a lot of computer software in the format of dynamic link libraries (DLL). DLLCaller performer allows your applications to call DLL functions directly. Here we
More informationDetecting USB Device Insertion and Removal Using Windows API
Written by Tom Bell Detecting USB Device Insertion and Removal Using Windows API When I needed to know how to detect USB device insertion and removal, I was developing an application for backing up USB
More informationAspect-Oriented Programming with C++ and AspectC++ AOSD 2007 Tutorial. Part V Examples. Examples V/1
Aspect-Oriented Programming with C++ and AspectC++ AOSD 2007 Tutorial Part V V/1 AspectC++ in Practice - Applying the observer protocol Example: a typical scenario for the widely used observer pattern
More informationDealing with DirectPlay Environments under DirectX
Iraqi Journal of Statistical Science (9) 2006 P.P. [75-90] Dealing with DirectPlay Environments under DirectX Aseel Waleed A. Al-Niamey * ABSTRACT The idea of this project is based on programming the functions
More informationSocket I/Os in Windows. Dae-Ki Kang
Socket I/Os in Windows Dae-Ki Kang Agenda TCP Server/Client Multi-Threads Synchronization Socket IO Model WSAAsyncSelect Model WSAEventSelect Model UDP Server/Client Overlapped Model Completion Port Model
More informationIntroduction to Computer Graphics (CS602) Lecture No 04 Point
Introduction to Computer Graphics (CS602) Lecture No 04 Point 4.1 Pixel The smallest dot illuminated that can be seen on screen. 4.2 Picture Composition of pixels makes picture that forms on whole screen
More information2. On the main menu, click File -> New... or File -> New -> Other... Windows Fundamentals
Windows Fundamentals http://www.functionx.com/win32/index.htm http://www.functionx.com/visualc/index.htm Introduction to windows Overview Microsoft Windows is an operating system that helps a person interact
More informationCS410 Visual Programming Solved Online Quiz No. 01, 02, 03 and 04. For Final Term Exam Preparation by Virtualians Social Network
CS410 Visual Programming Solved Online Quiz No. 01, 02, 03 and 04 For Final Term Exam Preparation by Virtualians Social Network 1. Ptr -> age is equivalent to *ptr.age ptr.age (ptr).age (*ptr).age 2. is
More informationWe take a look at implementing some file menu options: New, Open, Save, Save As and Exit.
1 Programming Windows Terry Marris Jan 2013 7 Files We take a look at implementing some file menu options: New, Open, Save, Save As and Exit. 7.1 Header File The header file is largely unchanged from chapter
More informationAn overview of how to write your function and fill out the FUNCTIONINFO structure. Allocating and freeing memory.
Creating a User DLL Extend Mathcad Professional's power by writing your own customized functions. Your functions will have the same advanced features as Mathcad built-in functions, such as customized error
More informationAdvantech Windows CE.net Application Hand on Lab
Advantech Windows CE.net Application Hand on Lab Lab : Serial Port Communication Objectives After completing this lab, you will be able to: Create an application to open, initialize the serial port, and
More informationProgramming in graphical environment. Introduction
Programming in graphical environment Introduction The lecture Additional resources available at: http://www.mini.pw.edu.pl/~maczewsk/windows_2004 Recommended books: Programming Windows - Charles Petzold
More informationMulti-core Architecture and Programming
Multi-core Architecture and Programming Yang Quansheng( 杨全胜 ) http://www.njyangqs.com School of Computer Science & Engineering 1 http://www.njyangqs.com Programming with Windows Threads Content Windows
More informationuvi ... Universal Validator Interface Software Developers Kit Revision /29/04 Happ Controls
Happ Controls 106 Garlisch Drive Elk Grove, IL 60007 Tel: 888-289-4277 / 847-593-6130 Fax: 847-593-6137 www.happcontrols.com uvi Universal Validator Interface Software Developers Kit.......... Revision
More informationUFG-10 MC. Frame Grabbers. Easy Programming Guide. Windows
UFG-10 MC Frame Grabbers Easy Programming Guide Windows Copyright Introduction This manual, Copyright 2014 Unigraf Oy. All rights reserved Reproduction of this manual in whole or in part without written
More informationWindows Printer Driver User Guide for NCR Retail Printers. B Issue G
Windows Printer Driver User Guide for NCR Retail Printers B005-0000-1609 Issue G The product described in this book is a licensed product of NCR Corporation. NCR is a registered trademark of NCR Corporation.
More informationMultithreading Applications in Win32
Copyright, 2012 Multimedia Lab., Multithreading Applications in Win32 (Chapter4. Synchronization) Seong Jong Choi chois@uos.ac.kr Multimedia Lab. Dept. of Electrical and Computer Eng. University of Seoul
More informationIFE: Course in Low Level Programing. Lecture 5
Lecture 5 Windows API Windows Application Programming Interface (API) is a set of Windows OS service routines that enable applications to exploit the power of Windows operating systems. The functional
More informationProgrammer s Manual MM/104 Multimedia Board
Programmer s Manual MM/104 Multimedia Board Ver. 1.0 11. Sep. 1998. Copyright Notice : Copyright 1998, INSIDE Technology A/S, ALL RIGHTS RESERVED. No part of this document may be reproduced or transmitted
More informationMOBILE COMPUTING Practical 1: Graphic representation
MOBILE COMPUTING Practical 1: Graphic representation Steps 2) Then in class view select the Global, in global select the WINMAIN. 3) Then write the below code below #define MAX_LOADSTRING 100 enum Shapes
More informationQno.2 Write a complete syantax of "Getparents" functions? What kind of value it return and when this function is use? Answer:-
CS410 Visual Programming Solved Subjective Midterm Papers For Preparation of Midterm Exam Qno.1 How can I use the CopyTo method of the Windows Forms controls collection to copy controls into an array?
More information4 th (Programmatic Branch ) Advance Windows Programming class
Save from: www.uotechnology.edu.iq 4 th (Programmatic Branch ) Advance Windows Programming class برمجة نوافذ المتقدمة أعداد :م.علي حسن حمادي 2006... 2010 >==> 2012 2013 CONTENTS: The Components of a Window
More informationInput and Interaction
Input and Interaction 5 th Week, 2011 Graphical Input Devices Mouse Trackball Light Pen Data Tablet Joy Stick Space Ball Input Modes Input devices contain a trigger which can be used to send a signal to
More informationUFG-10 Family. Frame Grabbers. Easy Programming Guide. Windows
UFG-10 Family Frame Grabbers Easy Programming Guide Windows Introduction Copyright This manual, Copyright 2014 Unigraf Oy. All rights reserved Reproduction of this manual in whole or in part without written
More informationFile System Watcher. Gregory Adam 2015
File System Watcher Gregory Adam 2015 Le minerai de fer peut croire qu'il est torturé sans raison dans la fournaise, mais lorsque la lame de l'acier le plus fin réfléchit à cette torture, elle en comprend
More informationHANNAH HOWARD #ABOUTME
HANNAH HOWARD #ABOUTME Personal @techgirlwonder hannah@carbon Anecdote: I have ve.com a dog she/her REACTIVE PROGRAMMING: A Better Way to Write Frontend Applications 1. PROBLEM STATEMENT WHAT IS A COMPUTER
More information. DRAFT version 0.681
. . D R ve A r F 0. sio T 68 n 1 VULKAN GRAPHICS API IN 20 MINUTES (Coffee Break Series) Kenwright Copyright c 2016 Kenwright All rights reserved. No part of this book may be used or reproduced in any
More informationDeveloper Documentation
Developer Documentation Development of Scanner Applications for ACD Windows CE Second Edition Devices Version: 3.0 Copyright ACD Gruppe This document may not be duplicated or made accessible to third parties
More information[MC-DPL8CS]: DirectPlay 8 Protocol: Core and Service Providers. Intellectual Property Rights Notice for Open Specifications Documentation
[MC-DPL8CS]: Intellectual Property Rights Notice for Open Specifications Documentation Technical Documentation. Microsoft publishes Open Specifications documentation ( this documentation ) for protocols,
More informationx86.virtualizer source code
x86.virtualizer source code author: ReWolf date: IV/V.2007 rel.date: VIII.2007 e-mail: rewolf@rewolf.pl www: http://rewolf.pl Table of contents: 1. Usage 2. Compilation 3. Source code documentation - loader
More informationCS410. Note: VuGujranwala.com is not responsible for any solved solution, but honestly we are trying our best to Guide correctly.
CS410 Note: VuGujranwala.com is not responsible for any solved solution, but honestly we are trying our best to Guide correctly. Prepared By : Exam Term : Mid Total MCQS : 69 page 1 / 12 1 - Choose Command
More informationDesigning Interactive Systems II
Designing Interactive Systems II Computer Science Graduate Programme SS 2010 Prof. Dr. RWTH Aachen University http://hci.rwth-aachen.de 1 Review: Conviviality (Igoe) rules for networking role of physical
More informationCIS 488 Programming Assignment 14 Using Borland s OWL
CIS 488 Programming Assignment 14 Using Borland s OWL Introduction The purpose of this programming assignment is to give you practice developing a Windows program using Borland Object Windows Library,
More informationMultithreading Multi-Threaded Programming. Prof. Lin Weiguo Copyleft 2009~2017, School of Computing, CUC
Multithreading Multi-Threaded Programming Prof. Lin Weiguo Copyleft 2009~2017, School of Computing, CUC Oct. 2017 Note You should not assume that an example in this presentation is complete. Items may
More informationProcessing in Frequency Domain
Will Pirkle FFT Processing (or Frequency Domain Processing) is a complete DSP topic on its own - thick books have been written about using the frequency domain representation of a signal for analysis or
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationWindows to Linux Porting Library
Library Windows to Linux Porting Library ( W2LPL ) ADONTEC, 2012. All Rights Reserved. www.adontec.com This document describes how to use the W2LPL library within a custom application. Technical Support
More informationSIMATIC Industrial software Readme SIMATIC S7-PLCSIM Advanced V2.0 SP1 Readme
SIMATIC Industrial software Readme General information Content This Readme file contains information about SIMATIC S7-PLCSIM Advanced V2.0 SP1. The information should be considered more up-to-date than
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationHands-On Lab. Multitouch Gestures - Native. Lab version: Last updated: 12/3/2010
Hands-On Lab Multitouch Gestures - Native Lab version: 1.0.0 Last updated: 12/3/2010 CONTENTS OVERVIEW... 3 EXERCISE 1: BUILD A MULTITOUCH APPLICATION... 7 Task 1 Create the Win32 Application... 7 Task
More informationCHAPTER 1.2 INTRODUCTION TO C++ PROGRAMMING. Dr. Shady Yehia Elmashad
CHAPTER 1.2 INTRODUCTION TO C++ PROGRAMMING Dr. Shady Yehia Elmashad Outline 1. Introduction to C++ Programming 2. Comment 3. Variables and Constants 4. Basic C++ Data Types 5. Simple Program: Printing
More informationCS11 C++ DGC. Spring Lecture 6
CS11 C++ DGC Spring 2006-2007 Lecture 6 The Spread Toolkit A high performance, open source messaging service Provides message-based communication Point-to-point messaging Group communication (aka broadcast
More informationToday we spend some time in OO Programming (Object Oriented). Hope you did already work with the first Starter and the box at:
maxbox Starter 2 Start with OO Programming 1.1 First Step Today we spend some time in OO Programming (Object Oriented). Hope you did already work with the first Starter and the box at: http://www.softwareschule.ch/download/maxbox_starter.pdf
More informationsystemove programovanie win32 programovanie
systemove programovanie win32 programovanie zakladny princip uzivatel interaguje so systemom klavesnicou, mysou tym generuje udalosti, ktore sa radia do,,message queue" (front sprav) aplikacia vytahuje
More informationAn Introduction to Windows Programming Using VC++ Computer Graphics. Binghamton University. EngiNet. Thomas J. Watson
Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced
More informationUser Guide for Sign Language Video Chat for Deaf People. User Guide. For End Users ( or Deaf people) For Developers ( or Programmers) FAQs
User Guide For End Users (or Deaf people) For Developers ( or Programmers) FAQs For End Users ( or Deaf people) 1. Introduction This application allows two or more Deaf people to communicate with each
More information6.096 Introduction to C++ January (IAP) 2009
MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture
More informationsoftmc Servotronix Motion API Reference Manual Revision 1.0
Servotronix Motion API Reference Manual Revision 1.0 Revision History Document Revision Date 1.0 Nov. 2014 Initial release Copyright Notice Disclaimer Trademarks 2014 Servotronix Motion Control Ltd. All
More informationCSCE 463/612 Networks and Distributed Processing Spring 2018
CSCE 463/612 Networks and Distributed Processing Spring 2018 Introduction Dmitri Loguinov Texas A&M University January 23, 2018 Original slides copyright 1996-2004 J.F Kurose and K.W. Ross 1 Updates Recv
More informationCMPT 212 Introduction to MFC and Windows Programming. Spring 2007
CMPT 212 Introduction to MFC and Windows Programming Spring 2007 What is MFC? MFC: Microsoft Foundation Classes MFC is a framework built on top of standard windows C++ libraries Provides the user with
More information#include <tobii/tobii.h> char const* tobii_error_message( tobii_error_t error );
tobii.h Thread safety The tobii.h header file collects the core API functions of stream engine. It contains functions to initialize the API and establish a connection to a tracker, as well as enumerating
More informationDLL User's Guide for the AlphiDll
DLL User's Guide for the AlphiDll SOFTWARE REFERENCE 745-06-002-4000 Revision G 01/22/01 Copyright 1999-2001 ALPHI Technology Corp. ALPHI Technology Corp. 6202 S. Maple Ave., #120 Tempe, AZ 85283 Tel:
More informationStream Server SDK Programmer s Manual V2.0. Stream Server SDK Programmer s Manual V 2.0
Stream Server SDK Programmer s Manual V 2.0 Index 1. Summary... 1 2. Stream Server System SDK... 2 2.1 Stream Media Server SDK... 2 2.2 Stream Client SDK... 4 2.2.1 DLL Interface... 4 2.2.2 Callback Function
More informationHands-On Lab. Multi-Touch WMTouch - Native. Lab version: Last updated: 12/3/2010
Hands-On Lab Multi-Touch WMTouch - Native Lab version: 1.0.0 Last updated: 12/3/2010 CONTENTS OVERVIEW... 3 EXERCISE 1: BUILD A MULTI-TOUCH APPLICATION... 5 Task 1 Create the Win32 Application... 5 Task
More informationOrbix TS Thread Library Reference
Orbix 6.3.9 TS Thread Library Reference Micro Focus The Lawn 22-30 Old Bath Road Newbury, Berkshire RG14 1QN UK http://www.microfocus.com Copyright Micro Focus 2017. All rights reserved. MICRO FOCUS, the
More informationCSci 4061 Introduction to Operating Systems. Programs in C/Unix
CSci 4061 Introduction to Operating Systems Programs in C/Unix Today Basic C programming Follow on to recitation Structure of a C program A C program consists of a collection of C functions, structs, arrays,
More informationCS349/SE382 A1 C Programming Tutorial
CS349/SE382 A1 C Programming Tutorial Erin Lester January 2005 Outline Comments Variable Declarations Objects Dynamic Memory Boolean Type structs, enums and unions Other Differences The Event Loop Comments
More informationPerforming Background Digital Input Acquisition Using the External Interrupt on a KPCI-PIO24 and DriverLINX
Page 1 of 8 Performing Background Digital Input Acquisition Using the External Interrupt on a KPCI-PIO24 and DriverLINX by Mike Bayda Keithley Instruments, Inc. Introduction Many applications require the
More informationC Review. MaxMSP Developers Workshop Summer 2009 CNMAT
C Review MaxMSP Developers Workshop Summer 2009 CNMAT C Syntax Program control (loops, branches): Function calls Math: +, -, *, /, ++, -- Variables, types, structures, assignment Pointers and memory (***
More informationKey Switch Control Software Windows driver software for Touch Panel Classembly Devices
IFKSMGR.WIN Key Switch Control Software Windows driver software for Touch Panel Classembly Devices Help for Windows www.interface.co.jp Contents Chapter 1 Introduction 3 1.1 Overview... 3 1.2 Features...
More informationDotstack Porting Guide.
dotstack TM Dotstack Porting Guide. dotstack Bluetooth stack is a C library and several external interfaces that needs to be implemented in the integration layer to run the stack on a concrete platform.
More informationUSB Dynamic Industrial Interface V A Universal Application Programming Interface To Data Acquisition Products Users Manual
USB Dynamic Industrial Interface V 2.0.1.1 A Universal Application Programming Interface To Data Acquisition Products Users Manual Design & Implementation by Decision Computer International Company No
More informationLambda Expression & Concurrency API. 김명신부장 Principal Technical Evangelist
Lambda Expression & Concurrency API 김명신부장 Principal Technical Evangelist 완전친절한 Lambda Expression 완전불친절한 Concurrency API 완전간단한 실천적접근 Alonzo Church [lambda-capture] { body } [lambda-capture] (params) {
More informationCommunications API. TEAM A : Communications and Integration Group. April 15, 1995
Communications API TEAM A : Communications and Integration Group April 15, 1995 1 Introduction This document specifies the API provided by the Communications and Integration group for use in the AMC system.
More informationPusleIR Multitouch Screen Software SDK Specification. Revision 4.0
PusleIR Multitouch Screen Software SDK Specification Revision 4.0 Table of Contents 1. Overview... 3 1.1. Diagram... 3 1.1. PulseIR API Hierarchy... 3 1.2. DLL File... 4 2. Data Structure... 5 2.1 Point
More informationA Short Course for REU Students Summer Instructor: Ben Ransford
C A Short Course for REU Students Summer 2008 Instructor: Ben Ransford http://www.cs.umass.edu/~ransford/ ransford@cs.umass.edu 1 Outline Last time: basic syntax, compilation This time: pointers, libraries,
More informationQCOM Reference Guide
QCOM Reference Guide Lars Wirfelt 2002 06 10 Copyright 2005 2016 SSAB EMEA AB Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,
More informationWin32 Multilingual IME Overview for IME Development
1 Win32 Multilingual IME Overview for IME Development Version 1.41 04-01-1999 This documentation introduces the basics on how to develop an IME for Windows 95, Windows 98, and Windows NT/2000. It is also
More informationCS2141 Software Development using C/C++ C++ Basics
CS2141 Software Development using C/C++ C++ Basics Integers Basic Types Can be short, long, or just plain int C++ does not define the size of them other than short
More informationQuestion No: 1 (Marks: 1) - Please choose one For showing Dialog we can use "ShowWindow(...)" function.
MUHAMMAD FAISAL MIT 4 th Semester Al-Barq Campus (VGJW01) Gujranwala faisalgrw123@gmail.com CS410 Mega File of Solved Mid Term Papers CS410 - WINDOWS PROGRAMMING Question No: 1 (Marks: 1) - Please choose
More informationBinghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program
Syntax What the Compiler needs to understand your program 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line Possibly replacing it with other
More informationCisco TSP Media Driver
Cisco Media Driver introduces a new and innovative way for TAPI-based applications to provide media interaction such as play announcements, record calls, and so on. Cisco TSP 8.0(1) includes support for
More informationCisco TSP Media Driver
Cisco Media Driver introduces a new and innovative way for TAPI-based applications to provide media interaction such as play announcements, record calls, and so on. Cisco TSP 8.0(1) includes support for
More informationMulticast Dissemination Protocol (MDP) Developer's Guide
Multicast Dissemination Protocol (MDP) Developer's Guide Brian Adamson Newlink Global Engineering Corporation Joe Macker Naval Research Laboratory 1
More informationPlaying & Recording Audio Audio Queue Services Playback
Playing & Recording Audio Audio Queue Services Playback The most common scenario : basic playing back an on-disk file 11 2010-2 iphone Application 1. 2. Playback Audio Queue Callback 1. Playback Audio
More informationProgramming In Windows. By Minh Nguyen
Programming In Windows By Minh Nguyen Table of Contents **************************************************************** Overview.. 3 Windows Programming Setup..3 Sample Skeleton Program.3 In Depth Look
More informationEthernet Industrial I/O Modules API and Programming Guide Model 24xx Family Rev.A August 2010
Ethernet Industrial I/O Modules API and Programming Guide Model 24xx Family Rev.A August 2010 Designed and manufactured in the U.S.A. SENSORAY p. 503.684.8005 email: info@sensoray.com www.sensoray.com
More information