Open Side Menu Go to the Top

05-11-2014 , 03:49 PM
I stopped using password confirmations about a year ago. It's unnecessary complexity IMO.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
05-12-2014 , 05:17 AM
Quote:
Originally Posted by noname6520
Hey guys,

How does one go about handling events that cannot be accessed from the ribbon visual designer in visual studio? I know that I can generate event handlers for the ribbon controls in microsoft excel from the ribbon designer. How do I get event handlers that don't involve ribbon controls?

For example I would like to handle a mouse movement into the activesheet, or if a user switches between worksheets. How do I go about subscribing to these events? Is there any way to generate an event handler for these kinds of events (that don't involve controls in the ribbon) automatically in visual studio.

Ive spent quite a few hours trying to figure this out (I am new to VSTO and c#) with no luck.

Thanks a lot
If you have a variable with proper type info, use intellisense.

so if you have a variable named sheet, try

sheet.

and see what choices you have from autocomplete. The ones with a lightning bolt are events. select one of those, like MouseMove

sheet.MouseMove +=

then hit tab twice and it fills in

sheet.MouseMove+=new MouseEventHandler(sheet_MouseMove);

Go put your code inside sheet_MouseMove
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-13-2014 , 09:28 AM
Quote:
Originally Posted by Chips Ahoy
If you have a variable with proper type info, use intellisense.

so if you have a variable named sheet, try

sheet.

and see what choices you have from autocomplete. The ones with a lightning bolt are events. select one of those, like MouseMove

sheet.MouseMove +=

then hit tab twice and it fills in

sheet.MouseMove+=new MouseEventHandler(sheet_MouseMove);

Go put your code inside sheet_MouseMove
Nice.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-13-2014 , 01:00 PM


** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-13-2014 , 02:04 PM
Thanks for the previous answer:
Another question:

I am trying to write a MS excel addin and I have the following code:

Code:
namespace MatBalAddin
{
    public partial class ThisAddIn
    {   
         public static Microsoft.Office.Interop.Excel.Application CurrentApplication = new Microsoft.Office.Interop.Excel.Application();

...
     }
}
When I try to build and run the addin without the bolded line, it runs fine. When I run it with the bolded line, excel has a message box pop with "An addin could not be found or could not be loaded".

Here are the error details:
Code:
Could not create an instance of startup object MatBalAddin.ThisAddIn in assembly MatBalAddin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.


************** Exception Text **************
Microsoft.VisualStudio.Tools.Applications.Runtime.CannotCreateStartupObjectException: Could not create an instance of startup object MatBalAddin.ThisAddIn in assembly MatBalAddin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'MatBalAddin.ThisAddIn' threw an exception. ---> System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {00020819-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
   at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
   at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
   at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at MatBalAddin.ThisAddIn..cctor() in c:\Users\Ishai\Documents\Visual Studio 2013\Projects\MatBalAddin\MatBalAddin\ThisAddIn.cs:line 18
   --- End of inner exception stack trace ---
   at MatBalAddin.ThisAddIn..ctor(ApplicationFactory factory, IServiceProvider serviceProvider)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.CreateEntryPoint(String entryPointTypeName)
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.CreateEntryPoint(String entryPointTypeName)
   at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.LoadEntryPoints(IntPtr serviceProvider)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18444 built by: FX451RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Office.Runtime
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.40820.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Runtime.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Security
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Hosting
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.40820.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Hosting.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.40820.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
----------------------------------------
System.Deployment
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Deployment/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.ServerDocument
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.40820.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Xml.Linq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
Microsoft.Office.Tools
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.40820.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.dll
----------------------------------------
Microsoft.Office.Tools.Excel.Implementation
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.40820.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Excel.Implementation/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Excel.Implementation.dll
----------------------------------------
Microsoft.Office.Tools.Common.Implementation
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.40820.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Common.Implementation/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.Implementation.dll
----------------------------------------
Microsoft.Office.Tools.Common
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.40820.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
----------------------------------------
MatBalAddin
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Ishai/documents/visual%20studio%202013/Projects/MatBalAddin/MatBalAddin/bin/Debug/MatBalAddin.DLL
----------------------------------------
Microsoft.Office.Tools.Common.v4.0.Utilities
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.30319.1
    CodeBase: file:///C:/Users/Ishai/documents/visual%20studio%202013/Projects/MatBalAddin/MatBalAddin/bin/Debug/Microsoft.Office.Tools.Common.v4.0.Utilities.DLL
----------------------------------------
Microsoft.Office.Tools.Excel
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.40820.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Excel/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Excel.dll
----------------------------------------
Microsoft.Office.Interop.Excel
    Assembly Version: 14.0.0.0
    Win32 Version: 14.0.4756.1000
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Interop.Excel/14.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Excel.dll
----------------------------------------
office
    Assembly Version: 14.0.0.0
    Win32 Version: 14.0.4760.1000
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/office/14.0.0.0__71e9bce111e9429c/office.dll
----------------------------------------
Anyone know why this is happening?

thanks in advance

Last edited by _dave_; 05-13-2014 at 02:53 PM. Reason: use code tags for code! :)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-13-2014 , 03:47 PM
The bolded line of code appears to create a brand new instance of excel. However, you are writing something called an add-in, so my expectation would be excel starts and then loads your code. Which would give you 2 excels, so it seems like a bad idea and just removing the line seems like a good idea. However, let's look at why it doesn't work.

The error though was a COM error: class not registered. As in there is no excel registered on your computer. Even though you obviously have an excel installed! A hint is down below:

mscorlib
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

There's a 64 in your .net path.

Is your c# code targeting a 64 bit version of .net? I suspect yes, and that you have only a 32 bit version of office.

How does it work at all? Well, COM has complete type info to marshall so it's probably fine with that 32/64 interop between excel and your addin. But, when your code does a CoCreateInstance it's mapping to the 64 bit version of that API which looks for 64 bit COM in the registry and doesn't find an excel.

Note, I'm just guessing on pretty much all of this.

In Visual Studio, go build/configuration manager/active solution platform and set it to x86. You may have to create those with "new".
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-13-2014 , 07:20 PM
Quote:
Originally Posted by Chips Ahoy
The bolded line of code appears to create a brand new instance of excel. However, you are writing something called an add-in, so my expectation would be excel starts and then loads your code. Which would give you 2 excels, so it seems like a bad idea and just removing the line seems like a good idea. However, let's look at why it doesn't work.

The error though was a COM error: class not registered. As in there is no excel registered on your computer. Even though you obviously have an excel installed! A hint is down below:

mscorlib
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

There's a 64 in your .net path.

Is your c# code targeting a 64 bit version of .net? I suspect yes, and that you have only a 32 bit version of office.

How does it work at all? Well, COM has complete type info to marshall so it's probably fine with that 32/64 interop between excel and your addin. But, when your code does a CoCreateInstance it's mapping to the 64 bit version of that API which looks for 64 bit COM in the registry and doesn't find an excel.

Note, I'm just guessing on pretty much all of this.

In Visual Studio, go build/configuration manager/active solution platform and set it to x86. You may have to create those with "new".
Hi, thanks for the response. The code didn't run at all when I selected x86 but it did when I selected x64 (without that line though). I am just trying to assign the current application to a field in the thisaddin class so that I can access its properties. For example, later in the my code I would like to say CurrentApplication.Cursor = Microsoft.Office.Interop.Excel.x1MousePointer.x1Wa it

How am I to do that without setting a variable to a microsoft excel application object somewhere?

Thanks for bearing with me, I am new to this
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-13-2014 , 08:14 PM
Code:
Microsoft.Office.Interop.Excel.Application excel; // class member
//in ThisAddIn_Startup
excel = this.Application as Microsoft.Office.Interop.Excel.Application;
http://msdn.microsoft.com/en-us/library/bb157876.aspx
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-13-2014 , 09:24 PM
Quote:
Originally Posted by Chips Ahoy
The bolded line of code appears to create a brand new instance of excel. However, you are writing something called an add-in, so my expectation would be excel starts and then loads your code. Which would give you 2 excels, so it seems like a bad idea and just removing the line seems like a good idea. However, let's look at why it doesn't work.

The error though was a COM error: class not registered. As in there is no excel registered on your computer. Even though you obviously have an excel installed! A hint is down below:

mscorlib
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

There's a 64 in your .net path.

Is your c# code targeting a 64 bit version of .net? I suspect yes, and that you have only a 32 bit version of office.

How does it work at all? Well, COM has complete type info to marshall so it's probably fine with that 32/64 interop between excel and your addin. But, when your code does a CoCreateInstance it's mapping to the 64 bit version of that API which looks for 64 bit COM in the registry and doesn't find an excel.

Note, I'm just guessing on pretty much all of this.

In Visual Studio, go build/configuration manager/active solution platform and set it to x86. You may have to create those with "new".
I know where to go for my C# and .NET questions. Good stuff.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-14-2014 , 10:47 AM
Quote:
Originally Posted by KatoKrazy
One more question...
In the book we are given the following 3 equations:

"Energy ∝ CapacitiveLoad X Voltage^2 This equation is the energy of a pulse during the logic transition of 0 → 1 → 0 or 1 → 0 → 1.

The energy of a single transition is then Energy ∝ 1/2 X CapacitiveLoad X Voltage^2

The power required per transistor is just the product of energy of a transition and the frequency of transitions: Power ∝ 1/2 X CapacitiveLoad X Voltage^2 X FrequencySwitched"

The professor went on in an email that by power it means dynamic power.

If the problem is:

"The Pentium 4 Prescott processor, released in 2004, had a clock rate of 3.6 GHz and voltage of 1.25 V. Assume that, on average, it consumed 10 W of static power and 90 W of dynamic power.

The Core i5 Ivy Bridge, released in 2012, had a clock rate of 3.4 GHz and voltage of 0.9 V. Assume that, on average, it consumed 30 W of static power and 40 W of dynamic power.

For each processor find the average capacitive loads."

My solutions are:

CL = DynamicPower / (0.5 X V^2 X ClockRate)

P4: CL = 90 / (0.5 * 1.25^2 * 3.6E9) = 3.2*10^-8

I5: CL = 40 / (0.5 * 0.9^2 * 3.4E9) = 2.90486565*10^-8

I think I might be off by a factor of 2 but I'm not sure? Is clock rate the same as frequency?
Can anyone help with this? I posted it in the Science/Math HW Help thread last night but no replies yet and it is due in a little more than an hour.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-14-2014 , 11:46 AM
Is it bad practice to couple my end points for my own origin web app with end points for a mobile app?

Basically, I'm building a phonegap app and it's hitting most of the same end points as my angular app. So I don't want to build them twice on the backend. I'm checking for a custom header with my generated csrf protection token on forms on my web app to see if it's a same origin request. If it's not (in the case of the APIs), I check that there's a valid token passed along in the header and find the associated user for the action. Is this all I need to do? I guess I'm not sure of the security implications of a native android/iOS app (are they reverse engineerable?). Am I covering my ass just checking for an API token from the app? It's being stored in the local storage on whatever device the app logs in on.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-14-2014 , 12:10 PM
Quote:
Originally Posted by KatoKrazy
Can anyone help with this? I posted it in the Science/Math HW Help thread last night but no replies yet and it is due in a little more than an hour.
Looks right.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-14-2014 , 12:34 PM
Clock rate is indeed the same as frequency. I have no idea with those equations however, sorry
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-14-2014 , 04:55 PM
Quote:
Originally Posted by clowntable


I like this
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-14-2014 , 05:06 PM
I don't get it
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-14-2014 , 05:49 PM
Quote:
Originally Posted by suzzer99
I don't get it
Big Unix time milestone (round number in decimal not all that impressive but still)

Felt like I should get a screen shot of such a historic moment
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-14-2014 , 06:14 PM
ah
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-14-2014 , 10:40 PM
Im back with another c# question:

I am trying to cast:

System.Windows.Forms.Form ActiveSheetAsForm = this.Application.ActiveSheet as System.Windows.Forms.Form;

Because I would like to use the Form's Event like

ActiveSheetAsForm.MouseMove += MyEventHandler(params)

Basically I would like the cursor to change (which I plan on doing in the event handler) when the cursor is in the activesheet part of the application.

The problem is I get an invalid cast exception at runtime, which I can understand. It is not necessarily true that one can cast a COM object as a system object.

My question is: How can one predict if a cast will be sucessful? Also, is there any way that I can go about casting the activesheet so that I can access the mousemove, mousehover or mouseenter/leave events in the activesheet?

Thanks in advance
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-15-2014 , 10:56 AM
the way the "as" operator works with classes, you can cast a class as either one of it's parent classes, or as an interface that the class implements or which is implemented by one of it's parents

I don't know what class ActiveSheet is but it's not a Form so you can't do that cast. Casting doesn't work indiscriminately

If I recall correctly, the result of your first line should be that ActiveSheetAsForm is null, and that's often how you check to see if a cast succeeded, but if it's throwing the invalid cast exception on that line I suppose you can't do that. I'm not sure why it would work differently in that case than in the normal case for "as" which just returns NULL on failure: http://msdn.microsoft.com/en-us/library/cscsdfbt.aspx

It looks like ActiveSheet isn't really a UI Control that has mouse event handlers. My very cursory google search isn't making it obvious to me where to look for those events but maybe on the this.Application object itself? You're not going to ever get a .NET Form I doubt, I don't think excel is written in WinForms. You're going to be finding COM events on one of the interop objects like Application
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-16-2014 , 09:20 AM
Quote:
Originally Posted by well named
the way the "as" operator works with classes, you can cast a class as either one of it's parent classes, or as an interface that the class implements or which is implemented by one of it's parents

I don't know what class ActiveSheet is but it's not a Form so you can't do that cast. Casting doesn't work indiscriminately ...
Maybe that would be a good starting point for solving the nonames6520 programming problem, let's have him identify the classes and what they expose. I refrain from stating that the approach he is taking is really screwed up due to the reliance on casting to get his software to work but I am highly skeptical that he is taking a very good approach.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-16-2014 , 10:28 AM
with COM interop it can be a bit of a pain to dig into what is actually there. Or at least fairly arcane. I have never done any office plugins but I've done other things with COM interop between unmanaged C++ code and C#. although it was probably 8 years ago and I've forgotten most of it :P

MSDN docs didn't seem very useful at first glance either, as far as documenting the Excel classes: http://msdn.microsoft.com/en-us/libr...ice.15%29.aspx

My impression is that the event model that is exposed by the developer API does not actually include raw mouse events, and it may not be possible to implement whatever it is he's trying to do that way. It makes sense to me, it's a much higher level API than that.

There is probably some crazy hackery that can be done using Win32 APIs to get those events anyway, maybe? It doesn't seem like an easy task for someone who is inexperienced
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-16-2014 , 03:24 PM
Quote:
Originally Posted by well named
with COM interop it can be a bit of a pain to dig into what is actually there. Or at least fairly arcane. I have never done any office plugins but I've done other things with COM interop between unmanaged C++ code and C#. although it was probably 8 years ago and I've forgotten most of it :P

MSDN docs didn't seem very useful at first glance either, as far as documenting the Excel classes: http://msdn.microsoft.com/en-us/libr...ice.15%29.aspx

My impression is that the event model that is exposed by the developer API does not actually include raw mouse events, and it may not be possible to implement whatever it is he's trying to do that way. It makes sense to me, it's a much higher level API than that.

There is probably some crazy hackery that can be done using Win32 APIs to get those events anyway, maybe? It doesn't seem like an easy task for someone who is inexperienced
I understand the points you are making. On mouse events, at the win32 API level, they come in as Windows messages. An application framework would allow the developer to specify a callback to handle the messages for the mouse. I am not that familiar with .NET and there is a lot of stuff in .NET to know. I'm thinking that the ActiveSheet type might have a way of specifying a callback for mouse events. Not sure and I might do a little research.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-16-2014 , 07:35 PM
COM, win api, what happened to the low content thread?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-16-2014 , 08:21 PM
Quote:
Originally Posted by adios
I'm thinking that the ActiveSheet type might have a way of specifying a callback for mouse events.
It would seem so but there isn't.

Quote:
Originally Posted by well named
There is probably some crazy hackery that can be done using Win32 APIs to get those events anyway, maybe? It doesn't seem like an easy task for someone who is inexperienced
Yeah this is gonna be tough - there are three problems you need to solve, 1) listen to raw Win32 messages from .NET and 2) steal them so that you get them before Excel processes them and 3) make sure Excel works fine despite this - maybe resend them? I don't know.

I think a much easier way to accomplish this is just by polling for mouse position - this seems wasteful but this should be a viable strategy.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-17-2014 , 06:14 AM
I'm playing around with JavaScript a bit and I see Object.create() is not supported by IE<9. I kind of don't want to think about those retrobrowsers anyway.

Do commonly used libraries (jQuery and whatnot) take care of that for me eventually? I want to work with "pure" JS for a bit to get a better feeling for it (mostly because prototype inheritance is neat etc.) since I have been one of those dreaded copy+paste+roughly understand what's going on JS users so far

Since I'm just messing around I can be in honey badger mode but code that is incompatible with IE8 sounds like a meh proposition for later.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m