Lets know how much of this makes sence and I can start to help you out as then i'll get a handle on your coding noob status.
I'm assuming you're using c#? If so create a new wpf project and add a reference to the com interface of the SDK. That last bit may be gibberish to you? If you do these steps then you'll be ready to start playing.
Here is the function in my code that tries to create a connection to a cm15 dll and if it works sends a dummy command to see if it's connected.
public override void CheckConnection()
{
if (cm15 == null)
{
try
{//This will still work if the device is not plugged in.
cm15 = new ActiveHomeScriptLib.ActiveHomeClass();
cm15.RecvAction += new ActiveHomeScriptLib._DIActiveHomeEvents_RecvActionEventHandler(cm15_RecvAction);
}
catch (Exception)
{//Driver can not be installed. Whoops.
//I may have to tweek this code so if this happens it waits for the driver to be installed.
//This exception does not happen if the driver is installed but device not plugged in. In that case the allocation will be ok.
}
}
else
{//Cheeky way to test for cm15 connection.
int res = (int)cm15.SendAction("queryplc", "e11 on", null, null);
if (res == -1)
{
//send a "cm15 is disconnected from USB" error to user
}
}
}
//Recive callback from the dll
void cm15_RecvAction(object bszAction, object bszParm1, object bszParm2, object bszParm3, object bszParm4, object bszParm5, object bszReserved)
{
string cmd = bszAction as string;
if (String.Compare(cmd, "recvrf",true) == 0 ||
String.Compare(cmd, "recvplc", true) == 0)
{
string address = bszParm1 as string;
string state = bszParm2 as string;
if (String.Compare(state, "on", true) == 0)
{
OnX10Message_OnReceived(address);
}
else if (String.Compare(state, "off", true) == 0)
{
OnX10Message_OffReceived(address);
}
else if (String.Compare(state, "Bright", true) == 0)
{
OnX10Message_BrightenReceived(address, (int)bszParm3);
}
else if (String.Compare(state, "Dim", true) == 0)
{
OnX10Message_DimReceived(address, (int)bszParm3);
}
}
Debug.WriteLine(
String.Format("{0} \'{1}\' \'{2}\' \'{3}\' \'{4}\' \'{5}\'",
bszAction,
bszParm1,
bszParm2,
bszParm3,
bszParm4,
bszParm5));
}
//My send function.
protected override void ExecuteX10QueuedCommands(List<String> pCommands)
{
if (cm15 != null )
{
foreach (string cmd in pCommands)
{
try
{
Debug.WriteLine("sendplc " + command);
object ret = cm15.SendAction("sendplc", command, null, null);
}
catch (Exception error)
{
Debug.WriteLine("cm15 command failed " + error.Message);
}
}
}
}