Problem is, is that I never subclassed in C++ before so I'm gonna have to study it up
Its probably within a child window as well, which is also what I need to program. So far the IDE is getting there with the little code I have. I just need a splash screen prior to the IDE appearing, add more menu items, and of course a code window to type in:
c++ Code:
#include <windows.h>
HWND hWnd;
MSG msg;
WNDCLASSEX wc;
HBRUSH brush;
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
#define ID_FILE_EXIT 1000
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow)
{
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_VREDRAW|CS_HREDRAW|CS_OWNDC;
wc.lpfnWndProc = WindowProcedure;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 0));
wc.lpszMenuName = NULL;
wc.lpszClassName = "IDE";
wc.hIconSm = NULL;
RegisterClassEx(&wc);
hWnd = CreateWindowEx (0, "IDE", "VB Classic", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, HWND_DESKTOP, NULL, hInstance, NULL);
ShowWindow (hWnd, SW_SHOWMAXIMIZED);
while (1)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE) > 0)
{
if (WM_QUIT == msg.message) break;
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}
return msg.wParam;
}
LRESULT CALLBACK WindowProcedure (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_CREATE:
{
HMENU hFile = CreateMenu();
HMENU hExit = CreateMenu();
AppendMenu(hFile, MF_POPUP, (UINT_PTR)hExit, "File");
AppendMenu(hExit, MF_STRING, ID_FILE_EXIT, "Exit");
SetMenu(hWnd, hFile);
break;
}
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case ID_FILE_EXIT:
{
DestroyWindow(hWnd);
return(0);
break;
}
}
break;
}
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_KEYDOWN:
if(wParam == VK_ESCAPE)
{
DestroyWindow(hWnd);
return(0);
}
break;
default:
return DefWindowProc (hWnd, msg, wParam, lParam);
}
return 0;
}