• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - JJBot

#1
Hello,

I am working on a program and need it so that when you click a button it will bring up a different container that holds static controls/buttons/etc...

For instance, a person clicks Button A so it makes frame A visible and sets other frames to invisible. The person clicks Button B then it makes frame B visible and so on.

I am currently using a static control as my frame, in which I make buttons/other statics child windows of the static control so I only have to set 1 window to visible/not visible rather than the whole group of windows.

The problem is now how do I set the background color/font of the child windows in the static "frame"? I tried using WM_SETFONT but it only works for windows that are childs of the main window.

So basically the structure is like this:

Main Window ----> Child of Main Window: Frame -----> Child of Frame Window: Label 1

Label 1's backcolor/font won't change but if I make Label 1 a child of Main window it will. But that defeats the whole purpose of having a frame control the visibility of all the other windows in it.

Heres a sample of my code:


    //GENERATE CONTAINERS
     for(int i = 1; i < 4; i++)frame[i] = CreateWindow("Static", "", WS_CHILD | WS_CLIPSIBLINGS, 3, 200, 790, 350, hwndMain, (HMENU)FRAME_START + (i * 20),hThisInstance, 0);

    //HOST A TABLE FRAME
    HWND dispHost = CreateWindow("Static", "This is the host a table frame", WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 300, 20, frame[1], (HMENU)FRAME_START + 20 + 1,
                 hThisInstance, 0);
    SendMessage(dispHost, WM_SETFONT,(WPARAM)font,0);
    ShowWindow(dispHost, 1);


Should I be using another method to group the windows? Help is greatly appreciated. Thanks.

Edit: Nvm, problem resolved. Figured out that I had to subclass it.
#2
Hello,

After figuring out how to add a WndProc to a seperate class and handle a window I've come across a problem:

In my main.cpp file I load a window with classname "PokerMain" and then create a class of type CardTable. When CardTable is initialized it is supposed to load a window of classname "PokerTable" but does not appear - that is, unless I change the window so that it's parent is HWND_DESKTOP rather than identifying PokerMain's hwnd as it's parent, then it appears after the PokerMain window is closed.

However, when using PokerMain's hwnd as the parent and loading the application I close PokerMain's window yet the program is not terminated. So the PokerTable window is loaded but not visible?

Heres what I have in main.cpp (PokerMain)

    hwndMain = CreateWindowEx (0, szClassName, "Poker Main", (WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW) & 0xFFFEFFFF,
                              CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, HWND_DESKTOP, 0, hThisInstance, NULL);
    ShowWindow(hwndMain, 1);
    CardTable cd("pokerbgd.dat", 800, 600, hwndMain);


And what I have in the CardTable class initialization:


CardTable::CardTable(char* sBackground, int width, int height, HWND hWndParent){
    HINSTANCE hInst    = GetModuleHandle(NULL);
    char szClassName[] = "PokerTable";
    WND_WIDTH          = width;
    WND_HEIGHT         = height;
    hMemDC             = 0;
    origDC             = 0;
   
    hBackground        = LoadBitmapFile(sBackground);
    cm.gDeck           = cm.createDeck();
    hRichEdit          = LoadLibrary("RICHED32.DLL");
   
    RegisterWindowClass(szClassName, hInst);
   
    hWnd = CreateWindowEx (0, szClassName, "John's Poker Table", (WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW) & 0xFFFEFFFF, CW_USEDEFAULT,
                          CW_USEDEFAULT, WND_WIDTH, WND_HEIGHT, hWndParent, 0, hInst, this);

    ShowWindow (hWnd, 1);
<more code here>
}



Also it seems that if I create 2 CardTable classes after the PokerMain window closes both of them will appear. Yet why can't they appear while the PokerMain window is open? What am I doing wrong?

Any help is greatly appreciated. Thanks!
#3
Battle.net Bot Development / Re: Diablo II
November 18, 2005, 01:01 AM
I think Ringo has pretty much summed it up. HdxBmx27 was right when he said Diablo II does not use UDP. Good luck with your Diablo bot.
#4
Thank you for the information -- this should help me quite a bit in getting to write some bnet bots    :D
#5
/WHOAMI -- Introductions / Hello
November 17, 2005, 01:28 PM
Hello, I'm new here. Hope to learn plenty from you guys as bots are quite interesting  :)

By the way, my name is Jonathon.