FlashCall / SetVariable does not work with WinProc

.NET Edition of the F-IN-BOX
dcoder
Posts: 6
Joined: Thu Oct 02, 2008 3:05 am

FlashCall / SetVariable does not work with WinProc

Postby dcoder » Thu Oct 02, 2008 3:16 am

Hi there,

i have been trying to call methods back n fro from flash/c# but all in vain. It does when i am runing normal from.

My problem is:
i have a customized form in which i have to handle some winproc myself. and inherited this form from fib_form.

now i am trying to invoke c# function from flash which fails even though i try to use setvariable it also deos not work.

Could you please provide me a solution to this problem? as my application security matters if i do not use flashcall/setvariable !!!

thanks

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Re: FlashCall / SetVariable does not work with WinProc

Postby Softanics » Thu Oct 02, 2008 6:26 am

Thank you for your question.

dcoder wrote:My problem is:
i have a customized form in which i have to handle some winproc myself. and inherited this form from fib_form.


Do you call fib_form.winproc from inherited_form.winproc ?

Thank you.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

dcoder
Posts: 6
Joined: Thu Oct 02, 2008 3:05 am

Re: FlashCall / SetVariable does not work with WinProc

Postby dcoder » Thu Oct 02, 2008 7:31 am

Softanics wrote:
Do you call fib_form.winproc from inherited_form.winproc ?

Thank you.


No. I dont. I think i should override it and child form and then call base.winproc... i have not yet tested. But i cant understand why this odd behaviour?

dcoder
Posts: 6
Joined: Thu Oct 02, 2008 3:05 am

Re: FlashCall / SetVariable does not work with WinProc

Postby dcoder » Thu Oct 02, 2008 7:49 am

dcoder wrote:
Softanics wrote:Do you call fib_form.winproc from inherited_form.winproc ?


I see it is not working though inherited and overriden.. let me give you piece of code in here..

class CustomizedForm : f_in_box_form {
// other stuff
protected override void WndProc(ref Message msg)
{
// Some windows message handling
base.WndProc(ref msg);
}
}

// Child Form

public partial class PreviewWindow : CustomizedForm
{
ContextMenu cm = new ContextMenu();
public PreviewWindow()
{
MenuItem tsi = new MenuItem("About Preview Window...", new EventHandler(About_Click));
cm.MenuItems.Add(tsi);
tsi = new MenuItem("-");
cm.MenuItems.Add(tsi);
tsi = new MenuItem("Reload", new EventHandler(Reload_Click));
cm.MenuItems.Add(tsi);
tsi = new MenuItem("Close", new EventHandler(Close_Click));
cm.MenuItems.Add(tsi);
ContextMenu = cm;
FlashProperty_Scale = "ShowAll";
FlashProperty_Movie = @"E:\Development\Home\ABC\ABC\PreviewWindow.swf";
InitializeComponent();
Height = 100;
ShowInTaskbar = false;
OnFlashCall += new OnFlashCallEventHandler(PreviewWindow_OnFlashCall);
FlashMethod_SetVariable("test", "some test from c#");
}

// overriden WndProc after your post but still does not work.
protected override void WndProc(ref Message msg)
{
base.WndProc(ref msg);
}

void PreviewWindow_OnFlashCall(object sender, string request)
{

try
{
FlashMethod_SetReturnValue(GetContent());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);

}
}


private string GetContent() {

List<string> strList = new List<string> ();
strList.Add("some text one");
strList.Add("some text two");
strList.Add("some text three");
string array = "<array>";
int id = 0;
foreach (string str in strList) {
array += "<property id='" + id + "'><string>" + str + "</string></property>";
id++;
}
array += "</array>";
return array;
}

void Close_Click(object sender, EventArgs e)
{
Close();
}

void About_Click(object sender, EventArgs e)
{
MessageBox.Show("Designed and developed by myself");
}

void Reload_Click(object sender, EventArgs e)
{
ReloadContent()
}

private void ReloadContent()
{
FlashMethod_SetReturnValue(GetContent());
}
}

Artim, i would like to you do the same and include some test winproc code in your form and inherit it from fib_form and then inherit this form to another form where you put flash movie and test it.

i hope you would have gotten the idea where the problem actually is or i might be doing soemthing wrong which is preventing me from doing what i want to.

regards,
Last edited by dcoder on Thu Oct 02, 2008 6:00 pm, edited 1 time in total.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Thu Oct 02, 2008 9:27 am

OK... Could you please send me your code to support (at) f-in-box.com so I can build it and test?

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

dcoder
Posts: 6
Joined: Thu Oct 02, 2008 3:05 am

Postby dcoder » Thu Oct 02, 2008 5:55 pm

Softanics wrote:OK... Could you please send me your code to support (at) f-in-box.com so I can build it and test?


Sorry... for replying late and also sorry i cant disclose the code in here due to security concern and the complexity of the code.

Well apart for this, i already have given you the idea what to do with the code. I see it not working even in the simplest form.

if possible can we have livechat? on yahoo with ID : dcoder@ymail.com i am waiting for your response if you could.
(be quick)

Regards,

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Thu Oct 02, 2008 6:58 pm

I've create a sample and it works well:

http://f-in-box.com/TEMP/26F6C0D2-86A7- ... o_send.zip

It would be better if you can provide me a sample to reproduce the problem. Then we can fix it quickly.

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

dcoder
Posts: 6
Joined: Thu Oct 02, 2008 3:05 am

Postby dcoder » Fri Oct 03, 2008 3:49 am

Softanics wrote:It would be better if you can provide me a sample to reproduce the problem. Then we can fix it quickly.


Ok, i will try to give you the exact code which is causing the problem.

dcoder
Posts: 6
Joined: Thu Oct 02, 2008 3:05 am

Postby dcoder » Fri Oct 03, 2008 4:11 am

Softanics wrote:http://f-in-box.com/TEMP/26F6C0D2-86A7-49ce-A94D-3896540690A8/to_send.zip


Hi, Artim!

The problem has been solved. Though your example is a bit different then mine but helped me recall me 1 year back effort that i tried the same and achieved it. I forgot to define and assign events for both fsc and flash call in the form which first inherits the fib_form.

There could be one prime reason. which is the FIB looks into the child form which inherits the fib_form and the child of child. (i might be wrong) but it does happen they way i have figured it.

Well, thanks for your support and understanding. You are great developer.


Return to “.NET Edition”

Who is online

Users browsing this forum: No registered users and 9 guests