Go Back   Northcode Support > SWF Studio Plugin Development
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 2010-11-10, 04:16 AM   #1
johnflash
Registered User
 
Join Date: Nov 2010
Posts: 5
Unhappy Need help with function parameters

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;
}
and when i call from flash,

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});
i get the beep sound to show that the function works but the sd.output gives undefined while sd reads [object Object]...what am i missing
johnflash is offline   Reply With Quote
Old 2010-11-10, 06:24 AM   #2
AGo
Plugin Developer
 
Join Date: Jun 2002
Location: Germany
Posts: 2,415
well you named your output parameter "result" and not "output"
AGo is offline   Reply With Quote
Old 2010-11-10, 02:44 PM   #3
johnflash
Registered User
 
Join Date: Nov 2010
Posts: 5
Unhappy

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});
i did a hasOwnProperty check on the returnd object and i got a false.meaning my flash variable, sd, isnt getting any thing from d plugin...any ideas why
johnflash is offline   Reply With Quote
Old 2010-11-10, 03:03 PM   #4
Dan
Registered User
 
Dan's Avatar
 
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;
at the beginning of your code, otherwise the call will be asynchronous.
Dan is offline   Reply With Quote
Old 2010-11-10, 03:24 PM   #5
northcode
Tim
 
northcode's Avatar
 
Join Date: May 2001
Location: Ottawa
Posts: 12,054
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});
northcode is offline   Reply With Quote
Old 2010-11-10, 06:49 PM   #6
johnflash
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;
}
i get :
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
johnflash is offline   Reply With Quote
Old 2010-11-11, 03:33 AM   #7
johnflash
Registered User
 
Join Date: Nov 2010
Posts: 5
Smile

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
johnflash is offline   Reply With Quote
Old 2010-11-11, 08:16 AM   #8
northcode
Tim
 
northcode's Avatar
 
Join Date: May 2001
Location: Ottawa
Posts: 12,054
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.
northcode is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes