|
|
|
#1 |
|
Registered User
Join Date: Nov 2010
Posts: 5
|
hi, am good with as2 but my c++ is no where...
i added my function to the sample notify plugin source but each i time i call it, the result yields undefined although the function works... i cant even be sure if its getting the parameters i send from as2...heres my c++ function code Code:
DECLARE_PARAMETERS(CSampleNotify, beepo, L"Bo my math");
IN_PARAMETER(text, L"The number.", L"");
OUT_PARAMETER(result, L"The output parameter for the command.");
END_PARAMETERS;
IMPLEMENT_COMMAND(CSampleNotify, beepo)
{
Beep(100,1000);
LPWSTR tt = pNCCommandParameters->GetParameter(L"text");
pNCCommandParameters->SetParameter(L"result", 700);
return S_OK;
}
Code:
var sd = ssCore.SampleNotify.beepo({text:"hello dll"});
ssCore.App.showMsgBox({icon:"question", buttons:"Ok", defaultButton:"button1", prompt:"Sd:"+sd+"\n Result:"+sd.output});
|
|
|
|
|
|
#2 |
|
Plugin Developer
Join Date: Jun 2002
Location: Germany
Posts: 2,409
|
well you named your output parameter "result" and not "output"
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Nov 2010
Posts: 5
|
sorry about that...pasted wrong code there...
this is what i actually compiled.but it still returns undefined... Code:
var sd = ssCore.SampleNotify.beepo({text:"hello dll"});
ssCore.App.showMsgBox({icon:"question", buttons:"Ok", defaultButton:"button1", prompt:"Sd:"+sd+"\n Result:"+sd.result});
|
|
|
|
|
|
#4 |
|
Registered User
Join Date: May 2003
Location: Ottawa
Posts: 416
|
Have you switched the default calling mode to synchronous? You should have
Code:
ssCore.init(); ssDefaults.synchronousCommands = true; |
|
|
|
|
|
#5 |
|
Tim
Join Date: May 2001
Location: Ottawa
Posts: 11,873
|
You should also check to make sure the call succeeded, so this is what you should be doing...
Code:
ssCore.init();
ssDefaults.synchronousCommands = true;
var sd = ssCore.SampleNotify.beepo({text:"hello dll"});
if (sd.success)
ssCore.App.showMsgBox({icon:"question", buttons:"Ok", defaultButton:"button1", prompt:"Sd:"+sd+"\n Result:"+sd.result});
else
ssCore.App.showMsgBox({prompt:sd.Error.description});
|
|
|
|
|
|
#6 |
|
Registered User
Join Date: Nov 2010
Posts: 5
|
tnx guys...ges i needed to go synchronous
but now am trying to return the serial of a drive and d app keeps crashin when i call...did some deugging and it appears something is wrong with the setParameter line here...keeps giving access violations errors and i dont really dig those address things Code:
DECLARE_PARAMETERS(CSampleNotify, beepo, L"Bo my math");
IN_PARAMETER(text, L"The input parameter for the command.",L"");
OUT_PARAMETER(result, L"The output parameter for the command.");
END_PARAMETERS;
IMPLEMENT_COMMAND(CSampleNotify, beepo)
{
TCHAR volumeName[MAX_PATH + 1] = { 0 };
TCHAR fileSystemName[MAX_PATH + 1] = { 0 };
DWORD serialNumber = 0;
DWORD maxComponentLen = 0;
DWORD fileSystemFlags = 0;
GetVolumeInformation(
_T("C:\\"),
volumeName,
ARRAYSIZE(volumeName),
&serialNumber,
&maxComponentLen,
&fileSystemFlags,
fileSystemName,
ARRAYSIZE(fileSystemName));
pNCCommandParameters->SetParameter(L"result", LPWSTR(serialNumber));
//Beep(100,1000);
return S_OK;
}
Unhandled exception at 0x06d04a81 (SampleNotify.dll) in Anoda.exe: 0xC0000005: Access violation reading location 0x549a3146. and it points to the line with the setParam any clues guys...tnx |
|
|
|
|
|
#7 |
|
Registered User
Join Date: Nov 2010
Posts: 5
|
ok guys....i converted serialNumber to an int and it works just fine....
but how do i now get the drive letter where my app is runnin so i dont have to manually write d drive letter in my volumeinfo function....tnx a million |
|
|
|
|
|
#8 |
|
Tim
Join Date: May 2001
Location: Ottawa
Posts: 11,873
|
Just look at the first character of ssGlobals.ssStarDir. If it's not a UNC path then it will start with a letter from A to Z.
|
|
|
|