Konny
09 Sep 2009, 22:40
Hi,
I've read a lot of threads here about how to show a window inside FSX and wanted to try it myself now. I have to admit that I'm not really an expert in WinAPI programming and from what I've seen there's still nobody here who knows how to show a modeless window in fullscreen and window mode.
But I can't even get a modal window to show up inside the FSX. I started off with the SimConnect example which enables the Dialog Mode and then tried to get the handle to the FS window and create a child window, but nothing happens.
Here's what I did when the Dialog Mode is turned on:
hFSimWindow = FindWindow((LPCWSTR)"FS98MAIN", NULL);
hInst = (HINSTANCE)GetWindowLong( hFSimWindow, GWL_HINSTANCE );
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInst;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = (LPCWSTR)L"TestModule";
wcex.hIconSm = NULL;
RegisterClassEx(&wcex);
hWnd = CreateWindowEx(WS_EX_TOPMOST,wcex.lpszClassName, (LPCWSTR)L"TestModule", WS_CHILD | WS_CAPTION | WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 300, 200, hFSimWindow, NULL, hInst, NULL);
What am I doing wrong here? And has anyone made progress regarding modeless windows?
I've read a lot of threads here about how to show a window inside FSX and wanted to try it myself now. I have to admit that I'm not really an expert in WinAPI programming and from what I've seen there's still nobody here who knows how to show a modeless window in fullscreen and window mode.
But I can't even get a modal window to show up inside the FSX. I started off with the SimConnect example which enables the Dialog Mode and then tried to get the handle to the FS window and create a child window, but nothing happens.
Here's what I did when the Dialog Mode is turned on:
hFSimWindow = FindWindow((LPCWSTR)"FS98MAIN", NULL);
hInst = (HINSTANCE)GetWindowLong( hFSimWindow, GWL_HINSTANCE );
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInst;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = (LPCWSTR)L"TestModule";
wcex.hIconSm = NULL;
RegisterClassEx(&wcex);
hWnd = CreateWindowEx(WS_EX_TOPMOST,wcex.lpszClassName, (LPCWSTR)L"TestModule", WS_CHILD | WS_CAPTION | WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 300, 200, hFSimWindow, NULL, hInst, NULL);
What am I doing wrong here? And has anyone made progress regarding modeless windows?