need some zone prog help

This is a discussion on need some zone prog help within the Windows Programming forums, part of the Platform Specific Boards category; Hi, im trying to make a trivia game for use in zone spades gaming lobbies, have been asked by a ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    91

    need some zone prog help

    Hi, im trying to make a trivia game for use in zone spades gaming lobbies, have been asked by a host to make one and am looking for some help. I have the following code a cpp , h, and rc files, but when i compile and run the cpp file all i get is a dos box flicker on the screen and off again, shouldnt i see a dialog box appear as the rc file seem to have dialog box code in it?

    Im using devc++, all i do is open the cpp file compile it and run it, do i need to link the rc file to this.

    The code is shown below.

    would really appreciate any help!


    cpp
    Code:
    #include <windows.h>	// Include windows API
    #include "resource.h"	// For the resource declarations.
    HWND ZoneLobbyWindow, AtlAxWin, WindowManager, ChatControl, RichEditA, ZRolloverButton;
    
    
    
    /*****************************************************************************
       If you are like me, you do not want to make a bunch of declares for your
       functions.  So, if you add your functions right here, you can call them
       from your dialog without needing them declared.This is open source and
       I allow you to use my code as you wish. All I ask is that you learn 
       something from this tutorial.
     *****************************************************************************/
    
    
    void SendLobby(char *buff) //  send to lobby, 
    {
    	ZoneLobbyWindow = FindWindow("ZoneLobbyWindow", NULL);					// Get Zone Lobby Window
    	AtlAxWin = FindWindowEx(ZoneLobbyWindow, 0, "AtlAxWin", NULL);			// Find AtlAxWin in Zone Lobby Window
    	WindowManager = FindWindowEx(AtlAxWin, 0, "WindowManager", NULL);		// FInd WindowManager in AtlAxWin
    	AtlAxWin = FindWindowEx(WindowManager, 0, "AtlAxWin", NULL);			// Find AtlAxWin in WindowManager
    	AtlAxWin = FindWindowEx(WindowManager, AtlAxWin, "AtlAxWin", NULL);		// Find AtlAxWin again to get next one
    	AtlAxWin = FindWindowEx(WindowManager, AtlAxWin, "AtlAxWin", NULL);		// Find AtlAxWin again to get next one
    	AtlAxWin = FindWindowEx(WindowManager, AtlAxWin, "AtlAxWin", NULL);		// Find AtlAxWin again to get next one
    	AtlAxWin = FindWindowEx(WindowManager, AtlAxWin, "AtlAxWin", NULL);		// Find AtlAxWin again to get next one
    	/* Now that we have the right AtlAxWin we can get the next windows */
    	ChatControl = FindWindowEx(AtlAxWin, 0, "ChatControl", NULL);			// Get ChatControl from AtlAxWin
    	RichEditA = FindWindowEx(ChatControl, 0, "RichEdit20A", NULL);			// Get Rich Edit in Chat control	
    	RichEditA = FindWindowEx(ChatControl, RichEditA, "RichEdit20A", NULL);	// Get the other one
    	SendMessage(RichEditA, WM_SETTEXT, sizeof(buff), (LPARAM)buff);			// Send Text to Rich Edit
    	ZRolloverButton = FindWindowEx(ChatControl, 0, "ZRolloverButton", NULL); // Move the Send Button on the Stack
    	SendMessage(ZRolloverButton, WM_KEYDOWN, VK_SPACE, 0);					// Push the button
    	SendMessage(ZRolloverButton, WM_KEYUP, VK_SPACE, 0);					// Release the button
    }
    
    /* Okay, there are many ways that you can send to lobby, some of the ways that I know are:
       winsock - Can get you in-trouble if you don't know what you're doing
       ZoneClient - Best method
       Api - The way this tutorial does it. */
    
    
    /* This is the process for the main dialog of the program. */
    BOOL CALLBACK MainProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
        switch (message)										// This is like the case select in BASIC
    	{	
    		case WM_INITDIALOG:									// Initialization of the window
    			{												// Not needed, but good for clean code.
    															// Load code here, such as, SetWindowText.
    			}												// Not needed, but good for clean code.
    			return TRUE;
    
    		case WM_COMMAND:									// Window Manager Command
    			switch (LOWORD(wParam))							// Get dialog messages.
    			{
    				case IDC_BUTTON1:							// What to do when Button1 is pressed.
    					{										// Once again, not needed, but looks good.
    						for (int x = 1; x <= 2; x++) {			// Easy controlled loop method.  Timers are better though.
    						  SendLobby("TEXT HERE");	// Note that you can add GetDlgItemText
    						}									// Ofcourse returns to {
    					}										// Not needed, but good for clean code.
    					return TRUE;
    			}
    		return TRUE;										// Remember, you're in the window manager, return good
    
    		case WM_DESTROY:
    			PostQuitMessage(0);								// This is your simple exit command, Closes process.
    			return TRUE;			
    
    		case WM_CLOSE:	
    			PostQuitMessage(0);								// This will close the process when close button is pressed.
    			return TRUE;
        }
        return FALSE;
    }
    
    /* Basic win32 initialization */
    int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char * cmdParam, int cmdShow)
    {
    	DialogBox (hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)MainProc); // Set the dialog to a proc
    	return 0x1337; // return as new system call
    rc
    Code:
    #include "resource.h"
    
    #define APSTUDIO_READONLY_SYMBOLS
    /////////////////////////////////////////////////////////////////////////////
    //
    // Generated from the TEXTINCLUDE 2 resource.
    //
    #include "afxres.h"
    
    /////////////////////////////////////////////////////////////////////////////
    #undef APSTUDIO_READONLY_SYMBOLS
    
    /////////////////////////////////////////////////////////////////////////////
    // English (U.S.) resources
    
    #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
    #ifdef _WIN32
    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
    #pragma code_page(1252)
    #endif //_WIN32
    
    /////////////////////////////////////////////////////////////////////////////
    //
    // Dialog
    //
    
    IDD_DIALOG1 DIALOGEX 0, 0, 186, 34
    STYLE DS_SYSMODAL | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | 
        WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    CAPTION "Dialog"
    FONT 8, "MS Sans Serif"
    BEGIN
        PUSHBUTTON      "Flood Lobby",IDC_BUTTON1,7,7,172,20,0,
                        WS_EX_DLGMODALFRAME
    END
    
    
    /////////////////////////////////////////////////////////////////////////////
    //
    // DESIGNINFO
    //
    
    #ifdef APSTUDIO_INVOKED
    GUIDELINES DESIGNINFO DISCARDABLE 
    BEGIN
        IDD_DIALOG1, DIALOG
        BEGIN
            LEFTMARGIN, 7
            RIGHTMARGIN, 179
            TOPMARGIN, 7
            BOTTOMMARGIN, 27
        END
    END
    #endif    // APSTUDIO_INVOKED
    
    
    #ifdef APSTUDIO_INVOKED
    /////////////////////////////////////////////////////////////////////////////
    //
    // TEXTINCLUDE
    //
    
    1 TEXTINCLUDE DISCARDABLE 
    BEGIN
        "resource.h\0"
    END
    
    2 TEXTINCLUDE DISCARDABLE 
    BEGIN
        "#include ""afxres.h""\r\n"
        "\0"
    END
    
    3 TEXTINCLUDE DISCARDABLE 
    BEGIN
        "\r\n"
        "\0"
    END
    
    #endif    // APSTUDIO_INVOKED
    
    #endif    // English (U.S.) resources
    /////////////////////////////////////////////////////////////////////////////
    
    
    
    #ifndef APSTUDIO_INVOKED
    /////////////////////////////////////////////////////////////////////////////
    //
    // Generated from the TEXTINCLUDE 3 resource.
    //
    
    
    /////////////////////////////////////////////////////////////////////////////
    #endif    // not APSTUDIO_INVOKED

    header
    Code:
    //{{NO_DEPENDENCIES}}
    // Microsoft Developer Studio generated include file.
    // Used by rsrc1.rc
    //
    #define IDD_DIALOG1                     101
    #define IDC_BUTTON1                     1000
    
    // Next default values for new objects
    // 
    #ifdef APSTUDIO_INVOKED
    #ifndef APSTUDIO_READONLY_SYMBOLS
    #define _APS_NEXT_RESOURCE_VALUE        102
    #define _APS_NEXT_COMMAND_VALUE         40001
    #define _APS_NEXT_CONTROL_VALUE         1002
    #define _APS_NEXT_SYMED_VALUE           101
    #endif
    #endif
    Last edited by joeyzt; 08-18-2003 at 10:09 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help making a dot bounce up and down y axis in this prog
    By redwing26 in forum Game Programming
    Replies: 10
    Last Post: 08-05-2006, 12:48 PM
  2. Replies: 3
    Last Post: 06-29-2003, 05:50 PM
  3. an option at the end of this prog to ask if I want to run again
    By bandito9111 in forum C++ Programming
    Replies: 2
    Last Post: 03-31-2003, 01:30 PM
  4. Try my prog...
    By Commander in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 05-09-2002, 07:43 AM
  5. password prog
    By ihsir in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 01-06-2002, 05:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21