PDA

View Full Version : Adding girder support to my C++ application



glimt
March 31st, 2006, 01:06 AM
Hi,

I was hoping someone could point me to some documentation on enabling a C++ application to be controlled by girder.

I tried accessing the developer section, but when I agree to the terms of service by pushing the agree button it just shows the terms of service again. So, I came here in the hopes that I might be able to find some direction.

I purchased Girder 3.3.10 a while back, and would no like to add support to my application so that it can be controlled by girder. Is there a document for developers that describes what is necessary to make the app girder controllable?

My application is a pure win32 c++ application that currently has no COM, OLE, Automation, MFC, etc. I'm trying to keep it as light as possible.

Thanks for the help,
Craig

birty
March 31st, 2006, 03:27 AM
the two best ways to control an applcaition with girder are using windows messages or keystrokes. the developer section is for plugin developers. you should need no special code to allow girder to control your application. If you want your applciation to communicate with girder then you will probably need either com or a web server to do so

Promixis
March 31st, 2006, 09:14 AM
Craig,

you could also have Girder just send messages to your app.

glimt
March 31st, 2006, 01:58 PM
Craig,

you could also have Girder just send messages to your app.

As in regular old windows messages?

A lot of the functionality I have in my application I won't have any GUI equivilant. E.g. I want the infrared remote to completely handle the operation without having to have a "button" that girder clicks. Windows messages sound like they would work good for this.

Is there a simple tutorial that demonstrates this from end to end? It sounds straight forward enough, but it would be nice to see it in a simplified environment first.

Thanks,
--Craig

birty
March 31st, 2006, 04:39 PM
getting girder to send mesages is quite straight forward, just add a sendmessage action and fill in the parameters.

glimt
April 1st, 2006, 01:06 AM
Yep, this was simple. Here's the quick rundown for the next girder c++ newbie.

- Setup a series of constants as:

const int MODE_UP = 1; // Wasn't sure about 0 with what could be an empty field.
const int MODE_DOWN = 2;
const int NEXT = 3;
const int PREV = 4;
const int VOL_UP = 5;
const int VOL_DOWN = 6;

- For each of these I defined a girder "command" with the type of command being "command" and the wparam value being the same as the constant.

- Targetted the command on my application window

In my C++ code for my primary application window:
// ------------------------------------------------------------------------
// Our application window procedure.
// Here we'll process the messages sent to the application window,
// ------------------------------------------------------------------------
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
{

switch(uMessage)
{

// Keypress
case WM_KEYDOWN:
{
// ---------------------------------------------------------
// pressing ESC will finish the app.
// ---------------------------------------------------------
switch (wParam)
{
case VK_ESCAPE:
PostQuitMessage(0);
break;
}
break;
}

// Alt-F4
case WM_DESTROY:
PostQuitMessage( 0 );

case WM_COMMAND:
{
// ---------------------------------------------------------
// Determine if a MODE button was pushed.
// ---------------------------------------------------------
switch (wParam)
{
// switch on Tuner specific button ids here.
// The ones that are shown are global.
case MODE_UP:
{
::MessageBox(NULL,"MODE_UP", "Mode",MB_OK);
break;
}
case MODE_DOWN:
{
::MessageBox(NULL,"MODE_DOWN", "Mode",MB_OK);
break;
}
case NEXT:
{
::MessageBox(NULL,"NEXT", "Mode",MB_OK);
break;
}
case PREV:
{
::MessageBox(NULL,"PREV", "Mode",MB_OK);
break;
}
case VOL_UP:
{
::MessageBox(NULL,"VOL_UP", "Mode",MB_OK);
break;
}
case VOL_DOWN:
{
::MessageBox(NULL,"VOL_DOWN", "Mode",MB_OK);
break;
}
}

}
// One time initialization.
case WM_CREATE :
{
}
}

// ---------------------------------------------------------
// call the default window procedure to keep things going.
// ---------------------------------------------------------
return DefWindowProc(hWnd,uMessage,wParam,lParam);
}