![]() |
|
|||||||
| Register | Wiki | Downloads | FAQ | Members List | Social Groups | Calendar | Search | Today's Posts | Mark Forums Read |
| Tools programming Use this forum to discuss anything related to creating tools for addon developers |
![]() |
|
|
Thread Tools | Display Modes |
|
#21
|
|||
|
|||
|
What type of data are you sending through SimConnect? Does the code work outside of FSX?
|
|
#22
|
|||
|
|||
|
The Simconnect calling code works inside the Form (Inside FSX)
I'm successfully subscribe to event "SimStart", but it crashes when the event should be called.... |
|
#23
|
|||
|
|||
|
That error could be just about anything from a stack overflow error, a weird threading error or a mistmatched DLL error (ie, wrong version of .NET running, meaning a manifest somewhere is broken). Welcome to the wonderful world of interop, simconnect and flight simulation
![]() I would first make sure the code works outside of FSX (use your DLL from a standalone EXE, write a simple wrapper) so that will tell you for sure where the problem is. Etienne |
|
#24
|
|||
|
|||
|
Thanks for help!
I didn't try to call my DLL from outside. Also, created form works very slow. Actualy I decided to switch off from .NET to Win32 C++ due to performence issues. When FSX starts my DLL I want to create a child window and assign it to "FS98MAIN", how possible it is and what problems could be? I also saw in this thread that some of you guys have a big progress in that, can I see some code? Pavel Last edited by vodaley; 12 Feb 2008 at 01:19. |
|
#25
|
|||
|
|||
|
I am aware that this thread is somehow outdated, but maybe somebody is still around . The given information is very much related to my issue right now.
When I create a child window in a FSX module (.dll), the window is created but always hidden in background. I have tried several styles (as of the information above) - but never managed to get the window in front. I can see it, but only when resizing the parent. The wndProcChild callback is correctly called, so it seems to be attached to the FSX message loop. Any ideas? Code:
// one time init
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = FSXModule::wndProcChildWindow; // static method
wcex.cbClsExtra = 0;
wcex.cbWndExtra = sizeof(long);
wcex.hInstance = FSXModule::_hInstance;
wcex.hIcon = LoadIcon(FSXModule::_hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
if (!RegisterClassEx(&wcex)) {
FSXModule::displayErrorMessageBox(_T("RegisterClassEx"));
}
// The parameters to CreateWindow explained:
// szWindowClass: the name of the application
// szTitle: the text that appears in the title bar
// WS_OVERLAPPEDWINDOW: the type of window to create
// CW_USEDEFAULT, CW_USEDEFAULT: initial position (x, y)
// 500, 100: initial size (width, length)
// hInstance: the first parameter from WinMain
HINSTANCE test = (HINSTANCE) GetWindowLong (FSXModule::_hFSXWindow, GWL_HINSTANCE); // see below, consistent?
HWND child;
child = CreateWindow(
// WS_EX_TOOLWINDOW,
szWindowClass,
_T("In FSX Win test"),
// WS_CHILDWINDOW | WS_VISIBLE | WS_BORDER, // window invisible in background
// WS_CHILD | WS_VISIBLE, // window invisible in background
// WS_POPUPWINDOW | WS_VISIBLE, // window invisible in background
WS_OVERLAPPEDWINDOW, // window invisible in background
0,0, // CW_USEDEFAULT, CW_USEDEFAULT,
500, 100,
FSXModule::_hFSXWindow, // parent
NULL,
// (HMENU) 1, // child id!
FSXModule::_hInstance, // (HINSTANCE) GetWindowLong (FSXModule::_hFSXWindow, GWL_HINSTANCE),
NULL
);
// could we create the window?
FSXModule::_hModuleWindow = child;
if (FSXModule::_hModuleWindow) {
// the order here seems to be crucial
WNDPROC oldChildWndProc = (WNDPROC)SetWindowLong(FSXModule::_hFSXWindow, GWL_WNDPROC, (LONG)FSXModule::wndProcChildWindow);
SetParent(FSXModule::_hModuleWindow, FSXModule::_hFSXWindow);
} else {
FSXModule::displayErrorMessageBox(_T("CreateWindow"));
}
|
|
#26
|
|||
|
|||
|
Try to play with WS_POPUPWINDOW | WS_VISIBLE flags,
try to search kind of TOPMOSTY flag, actually I don't really remember how it was handeled. |
|
#27
|
|||
|
|||
|
Yep, I continue with trial and error. However, if someone can show how he has done it, it's still appreciated.
![]() Thanks for your feedback. -- Edit -- SetWindowPos(FSXModule::_hModuleWindow, HWND_TOP, x, y, w, h, SWP_DRAWFRAME | SWP_SHOWWINDOW); as well as HWND_TOPMOST does not change anything at all Last edited by KWB; 27 Jun 2012 at 17:16. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|