Advanced Question Help on making a pop window like for RMS arm

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,767
Reaction score
31
Points
123
Not sure what you mean. Here is my set up you can see:
Could you attach a bigger version to a reply? Also is oapiRegisterCustomControls in your sources red underlined?
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,767
Reaction score
31
Points
123
Here's an example of when VC++ can't define the identifier:

 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
5,737
Reaction score
56
Points
123
Location
Dallas, TX
oh. Well I just commented them out and it works
Code:
DLLCLBK void InitModule(HINSTANCE hModule)
{
	g_Param.hDLL = hModule;
	//oapiRegisterCustomControls(hModule);
	g_Param.tkbk_label = oapiCreateSurface(LOADBMP(IDB_TKBKLABEL));

	// allocate GDI resources
	g_Param.font[0] = CreateFont(-11, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
}

DLLCLBK void ExitModule(HINSTANCE hModule)
{
	//oapiUnregisterCustomControls(hModule);
	oapiDestroySurface(g_Param.tkbk_label);

	// deallocate GDI resources
	DeleteObject(g_Param.font[0]);
}
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,767
Reaction score
31
Points
123
oh. Well I just commented them out and it works
Code:
DLLCLBK void InitModule(HINSTANCE hModule)
{
    g_Param.hDLL = hModule;
    //oapiRegisterCustomControls(hModule);
    g_Param.tkbk_label = oapiCreateSurface(LOADBMP(IDB_TKBKLABEL));

    // allocate GDI resources
    g_Param.font[0] = CreateFont(-11, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
}

DLLCLBK void ExitModule(HINSTANCE hModule)
{
    //oapiUnregisterCustomControls(hModule);
    oapiDestroySurface(g_Param.tkbk_label);

    // deallocate GDI resources
    DeleteObject(g_Param.font[0]);
}
That means either one of two things:

  1. That your project is misconfigured and compiler/linker can't find the proper SDK files
  2. That there's a coding mistake somewhere
My money is on 1. You should be using Property Sheets. This automatically sets up the include and lib paths for you: http://www.orbiter-forum.com/showthread.php?p=468275&postcount=5


Could we see a full size screenshot or better yet, the VC++ project files? That way it should be easy to spot any project configuration errors.


 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,767
Reaction score
31
Points
123
I think I have found the solution: in Linker>Input add DlgCTRL.lib to Additional Dependencies.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
5,737
Reaction score
56
Points
123
Location
Dallas, TX
YES.
now to get the animations to work. I think one arm should move but it doesn't
Code:
	case WM_TIMER:
		if (wParam == 1) {
			t1 = oapiGetSimTime();
			if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
				sts->CENTERARM1_proc = min(1.0, sts->CENTERARM1_proc + (t1 - t0)*ARM_OPERATING_SPEED);
				sts->SetAnimationArm(sts->anim_CENTERARM1, sts->CENTERARM1_proc);
			}
			else if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
				sts->CENTERARM1_proc = max(0.0, sts->CENTERARM1_proc - (t1 - t0)*ARM_OPERATING_SPEED);
				sts->SetAnimationArm(sts->anim_CENTERARM1, sts->CENTERARM1_proc);
			}
			

			t0 = t1;
		}
		break;
Another thing is the display of the control. If I open the atlantis the same. So must be something not set?
https://dl.dropboxusercontent.com/u/71242599/flexcraftarm1.jpg

---------- Post added at 04:41 PM ---------- Previous post was at 06:08 AM ----------

ok if I try to see CENTERARM1_proc I get a much of compiling errors.
Code:
BOOL CALLBACK RMS_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	FLEXCRAFT2 *sts = (uMsg == WM_INITDIALOG ? (FLEXCRAFT2*)lParam : (FLEXCRAFT2*)oapiGetDialogContext(hWnd));
	// pointer to vessel instance was passed as dialog context

	const double step = 0.05*RAD;
	static double t0;
	double t1;
	HICON hIcon;

	switch (uMsg) {
	case WM_INITDIALOG:
		hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_UP));
		SendDlgItemMessage(hWnd, IDC_WRIST_PITCHUP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		SendDlgItemMessage(hWnd, IDC_ELBOW_PITCHUP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		SendDlgItemMessage(hWnd, IDC_SHOULDER_PITCHUP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_DOWN));
		SendDlgItemMessage(hWnd, IDC_WRIST_PITCHDOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		SendDlgItemMessage(hWnd, IDC_ELBOW_PITCHDOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		SendDlgItemMessage(hWnd, IDC_SHOULDER_PITCHDOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_LEFT));
		SendDlgItemMessage(hWnd, IDC_WRIST_YAWLEFT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWLEFT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_RIGHT));
		SendDlgItemMessage(hWnd, IDC_WRIST_YAWRIGHT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWRIGHT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_RRIGHT));
		SendDlgItemMessage(hWnd, IDC_WRIST_ROLLRIGHT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
		hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_RLEFT));
		SendDlgItemMessage(hWnd, IDC_WRIST_ROLLLEFT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);

		SetTimer(hWnd, 1, 50, NULL);
		t0 = oapiGetSimTime();
		return FALSE;
	case WM_DESTROY:
		KillTimer(hWnd, 1);
		return 0;
	case WM_TIMER:
		if (wParam == 1) {
			t1 = oapiGetSimTime();
			
			sprintf(oapiDebugString(), "%2f ", CENTERARM1_proc);
			if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
				sts->CENTERARM1_proc = min(1.0, sts->CENTERARM1_proc + (t1 - t0)*ARM_OPERATING_SPEED);
				sts->SetAnimationArm(sts->anim_CENTERARM1, sts->CENTERARM1_proc);
				
			}
			else if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
				sts->CENTERARM1_proc = max(0.0, sts->CENTERARM1_proc - (t1 - t0)*ARM_OPERATING_SPEED);
				sts->SetAnimationArm(sts->anim_CENTERARM1, sts->CENTERARM1_proc);
			}
			

			t0 = t1;
		}
		break;
	
	}
	return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);
}
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,767
Reaction score
31
Points
123
YES.
now to get the animations to work. I think one arm should move but it doesn't
Code:
    case WM_TIMER:
        if (wParam == 1) {
            t1 = oapiGetSimTime();
            if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
                sts->CENTERARM1_proc = min(1.0, sts->CENTERARM1_proc + (t1 - t0)*ARM_OPERATING_SPEED);
                sts->SetAnimationArm(sts->anim_CENTERARM1, sts->CENTERARM1_proc);
            }
            else if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
                sts->CENTERARM1_proc = max(0.0, sts->CENTERARM1_proc - (t1 - t0)*ARM_OPERATING_SPEED);
                sts->SetAnimationArm(sts->anim_CENTERARM1, sts->CENTERARM1_proc);
            }
            

            t0 = t1;
        }
        break;
Another thing is the display of the control. If I open the atlantis the same. So must be something not set?
https://dl.dropboxusercontent.com/u/71242599/flexcraftarm1.jpg

---------- Post added at 04:41 PM ---------- Previous post was at 06:08 AM ----------

ok if I try to see CENTERARM1_proc I get a much of compiling errors.
Code:
BOOL CALLBACK RMS_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    FLEXCRAFT2 *sts = (uMsg == WM_INITDIALOG ? (FLEXCRAFT2*)lParam : (FLEXCRAFT2*)oapiGetDialogContext(hWnd));
    // pointer to vessel instance was passed as dialog context

    const double step = 0.05*RAD;
    static double t0;
    double t1;
    HICON hIcon;

    switch (uMsg) {
    case WM_INITDIALOG:
        hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_UP));
        SendDlgItemMessage(hWnd, IDC_WRIST_PITCHUP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        SendDlgItemMessage(hWnd, IDC_ELBOW_PITCHUP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        SendDlgItemMessage(hWnd, IDC_SHOULDER_PITCHUP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_DOWN));
        SendDlgItemMessage(hWnd, IDC_WRIST_PITCHDOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        SendDlgItemMessage(hWnd, IDC_ELBOW_PITCHDOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        SendDlgItemMessage(hWnd, IDC_SHOULDER_PITCHDOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_LEFT));
        SendDlgItemMessage(hWnd, IDC_WRIST_YAWLEFT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWLEFT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_RIGHT));
        SendDlgItemMessage(hWnd, IDC_WRIST_YAWRIGHT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWRIGHT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_RRIGHT));
        SendDlgItemMessage(hWnd, IDC_WRIST_ROLLRIGHT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
        hIcon = LoadIcon(g_Param.hDLL, MAKEINTRESOURCE(IDI_RLEFT));
        SendDlgItemMessage(hWnd, IDC_WRIST_ROLLLEFT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);

        SetTimer(hWnd, 1, 50, NULL);
        t0 = oapiGetSimTime();
        return FALSE;
    case WM_DESTROY:
        KillTimer(hWnd, 1);
        return 0;
    case WM_TIMER:
        if (wParam == 1) {
            t1 = oapiGetSimTime();
            
            sprintf(oapiDebugString(), "%2f ", CENTERARM1_proc);
            if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
                sts->CENTERARM1_proc = min(1.0, sts->CENTERARM1_proc + (t1 - t0)*ARM_OPERATING_SPEED);
                sts->SetAnimationArm(sts->anim_CENTERARM1, sts->CENTERARM1_proc);
                
            }
            else if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
                sts->CENTERARM1_proc = max(0.0, sts->CENTERARM1_proc - (t1 - t0)*ARM_OPERATING_SPEED);
                sts->SetAnimationArm(sts->anim_CENTERARM1, sts->CENTERARM1_proc);
            }
            

            t0 = t1;
        }
        break;
    
    }
    return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);
}
Could you post the compiler errors? It's hard to troubleshoot errors we can't see.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
5,737
Reaction score
56
Points
123
Location
Dallas, TX
sure 3 errors but 103 warnings:
Warning 1 The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'YieldDuringToolExecution' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property, AllowUnsafeBlocks, AppConfigForCompiler, ApplicationIcon, ApplicationRevision, ApplicationVersion, AppDesignerFolder, AspNetConfiguration, AssemblyKeyContainerName, AssemblyKeyProviderName, AssemblyName, AssemblyOriginatorKeyFile, AssemblyOriginatorKeyFileType, AssemblyOriginatorKeyMode, AssemblyType, AutoGenerateBindingRedirects, AutorunEnabled, BaseAddress, BootstrapperComponentsLocation, BootstrapperComponentsUrl, BootstrapperEnabled, CharacterSet, CheckForOverflowUnderflow, CLRSupport, UseDebugLibraries, CodePage, Configuration, ConfigurationName, ConfigurationOverrideFile, CreateDesktopShortcut, CreateWebPageOnPublish, CurrentSolutionConfigurationContents, DebugSecurityZoneURL, DebugSymbols, DebugType, DefaultClientScript, DefaultHTMLPageLayout, DefaultTargetSchema, DefineConstants, DefineDebug, DefineTrace, DelaySign, DisableLangXtns, DisallowUrlActivation, CodeAnalysisAdditionalOptions, CodeAnalysisApplyLogFileXsl, CodeAnalysisConsoleXsl, CodeAnalysisCulture, CodeAnalysisFailOnMissingRule.... C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 18 6 Miscellaneous Files
errors
Error 103 error C2065: 'CENTERARM1_proc' : undeclared identifier E:\orbiter2010p1A\Orbitersdk\samples\FLEXCRAFT2\FLEXCRAFT2.CPP 2101 1 FLEXCRAFT2
104 IntelliSense: command-line error: invalid macro definition: (PreprocessorDefinitions) e:\orbiter2010p1A\Orbitersdk\samples\FLEXCRAFT2\FLEXCRAFT2.CPP 1 1 FLEXCRAFT2
105 IntelliSense: identifier "CENTERARM1_proc" is undefined e:\orbiter2010p1A\Orbitersdk\samples\FLEXCRAFT2\FLEXCRAFT2.CPP 2101 39 FLEXCRAFT2
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,767
Reaction score
31
Points
123
The error is a simple one: You have forgotten to to declare the identifier "CENTERARM1_proc". Declare it properly and the error should go away.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
5,737
Reaction score
56
Points
123
Location
Dallas, TX
Ok but why it is not any issue below it and else where.

in the h.

Code:
	double  CENTERARM1_proc;
Code:
sprintf(oapiDebugString(), "%2f ", CENTERARM1_proc);
			if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
				sts->CENTERARM1_proc = min(1.0, sts->CENTERARM1_proc + (t1 - t0)*ARM_OPERATING_SPEED);
				sts->SetAnimationArm(sts->anim_CENTERARM1, sts->CENTERARM1_proc);[CODE]

here are the 2 errors:
	1	IntelliSense: command-line error: invalid macro definition: (PreprocessorDefinitions)	e:\orbiter2010p1A\Orbitersdk\samples\FLEXCRAFT2\FLEXCRAFT2.CPP	1	1	FLEXCRAFT2

	2	IntelliSense: identifier "CENTERARM1_proc" is undefined	e:\orbiter2010p1A\Orbitersdk\samples\FLEXCRAFT2\FLEXCRAFT2.CPP	2101	39	FLEXCRAFT2



I put a break in it and expected to  to stop when I ran the debugger.  But it didn't.  So not sure if it getting there[COLOR="Red"]

[SIZE=1]---------- Post added 09-06-14 at 08:32 AM ---------- Previous post was 09-05-14 at 06:24 PM ----------[/SIZE]

[/COLOR]I am going back to square 1.  
but this is something I don't get.  For some reason it doesn't see the bitmaps.  The top is the error message.  The middle is the code. and the bottom is you can see they are there?

Is there something in the solution that links bitmaps?

[IMG]http://i373.photobucket.com/albums/oo179/gattispilot/flexcraftissue_zps476bfcea.jpg[/IMG]
 
Last edited:

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,767
Reaction score
31
Points
123
I think it's case-sensitive. In your RC file you have "flexcraft2", all lower-case, while the actual path is "FLEXCRAFT2", all upper case.

Try with the all upper case and see if it gets rid of the error.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
5,737
Reaction score
56
Points
123
Location
Dallas, TX
Thanks:
NO . I am not sure if it is seeing the directory
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,767
Reaction score
31
Points
123
After a bit of looking around, try opening the RC file in NotePad and resave, making sure that the encoding is set to ANSI and not UTF-8.
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,767
Reaction score
31
Points
123
Zip the project/code and attach it to a post. I'll take a look at it.
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,767
Reaction score
31
Points
123
After a bit of trial and error, I have found that the problem was a simple path error.

In the RC file, change "FLEXCRAFT2\\Bitmaps\\tkbk_label.bmp" to "Bitmaps\\tkbklabel.bmp".

That should make it build with no further path errors.
 
Top