FSDeveloper Community

Go Back   FSDeveloper Community > Other > Tools programming

Tools programming Use this forum to discuss anything related to creating tools for addon developers

Reply
 
Thread Tools Display Modes
  #21  
Old 09 Feb 2008, 13:24
ziporama ziporama is offline
  unitedstates
Location: Ohio
Join Date: Sep 2006
Posts: 203
What type of data are you sending through SimConnect? Does the code work outside of FSX?
Reply With Quote
  #22  
Old 10 Feb 2008, 09:59
vodaley vodaley is offline
  israel
Join Date: Nov 2006
Posts: 6
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....
Reply With Quote
  #23  
Old 10 Feb 2008, 10:26
ziporama ziporama is offline
  unitedstates
Location: Ohio
Join Date: Sep 2006
Posts: 203
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
Reply With Quote
  #24  
Old 10 Feb 2008, 11:00
vodaley vodaley is offline
  israel
Join Date: Nov 2006
Posts: 6
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.
Reply With Quote
  #25  
Old 26 Jun 2012, 05:30
KWB KWB is offline
  germany
Join Date: May 2012
Posts: 38
Question Window never on top

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")); 
	}
Reply With Quote
  #26  
Old 26 Jun 2012, 06:16
vodaley vodaley is offline
  israel
Join Date: Nov 2006
Posts: 6
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.
Reply With Quote
  #27  
Old 27 Jun 2012, 03:59
KWB KWB is offline
  germany
Join Date: May 2012
Posts: 38
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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:31.

Kirsch designed by Andrew & Austin


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.