I am trying to create an application which will display two forms, one will "roll" a dice (create a random number) and I will then pass this to the other window/form which will display the result.
Unfortunately I need to be able to do it within another thread so I will be sharing memory between them so I can pass the data across.
So far i've completed the first screen, added menus and the random number side of things and now i'm trying to implement a second form in a similar attempt as the first one to display the results. I'm adding the CreateWindowEx() command in the WM_CREATE section so it is created when the first window starts.
I've been trawling the internet and documents for a few days and I still can't find a solution to what I need.
I've posted the entire solution I have so far (Minus the random number stuff, not really important).
Would anybody be able to help in getting another window up and running? Im primarily from a C# background and i've not used C for long so it's all a bit new to me still.
Thank you for your time.
The application so far
// WINDOWS MAIN //
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst,
LPSTR lpszArgs, int nWinMode)
// Declaration of window class (used to register program),
// handle to window (returned by CreateWindow)
// and windows message (holds messages received from windows)
// Name of window and window class
LPCWSTR szWinName = L"DiceRoller - Producer";
LPCWSTR szClassName = L"DiceRollProd";
// Set up the windows class struct
wcl.hInstance = hThisInst;
wcl.lpszClassName = szClassName;
wcl.lpfnWndProc = WindowFunc;
wcl.style = 0;
wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
wcl.lpszMenuName = NULL;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
// Register the windows class
// Create the main window
hwnd = CreateWindowEx(0,
WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN,
// Show the main window
// Main message processing loop
while(GetMessage(&msg, NULL, 0, 0))
// WINDOWS FUNCTION //
LRESULT CALLBACK WindowFunc(HWND hMainWindow, UINT message,
WPARAM wParam, LPARAM lParam)
struct DiceData storage;
// Act on current message
hwnd = CreateWindowEx(
WS_CHILD | WS_BORDER | WS_VISIBLE,