|
You can find some details here[^], and I seriously doubt you could make a simple application like it. It's a very complicated piece of software (and it's certainly not written in C#).
|
|
|
|
|
Still not figured out how to use Google[^]?
|
|
|
|
|
Still not figured out how to use Google[^]?
Please read my question again..!
Technology News @ www.JassimRahma.com
|
|
|
|
|
|
The Protocol is not simple at all. If you want to do something similar take a look at VNC. If you want to connect clients through firewalls and routers search for hole punching or take a look at azure service bus.
|
|
|
|
|
Using this code. What am I doing wrong? This is my first Add-in and I'm still learning C#, so please forgive stupid mistakes. Thanks.
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.Application.DocumentChange += new ApplicationEvents4_DocumentChangeEventHandler(Application_DocumentChange);
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
private void Application_DocumentChange()
{
this.Application.ActiveDocument.TrackRevisions = true;
int n = this.Application.ActiveDocument.Revisions.Count;
Word.Range[] change = new Word.Range[n];
for (int i = 0; i < n; i++)
{
change[i] = this.Application.ActiveDocument.Revisions[i].Range;
change[i].Select();
change[i].Copy();
string changed = Clipboard.GetText(TextDataFormat.Text);
MessageBox.Show(changed);
}
}
The event handler gets called even before the document is opened.. thats the problem.. Document change occurs when a documentis opened(old/new) right?
Error is in the line:
change[i] = this.Application.ActiveDocument.Revisions[i].Range;
modified 23-Oct-14 2:03am.
|
|
|
|
|
Where in the code does the error occur? I would think this error is rather self-explanatory.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
sorry for the incomplete description.. Please have a look at the modified question..
|
|
|
|
|
Seems like a simple check for ActiveDocument being open is in order here.
There's got to be some property to check to see if there is a document open. Experiment. Look around.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I get what you're saying but what I'm asking is that, why is the DocumentChange event being fired when there is no open document?
|
|
|
|
|
I doubt anyone would be able to tell you that. Software development is full of things like this. The best thing you can do is find a workaround, such as checking to see if there's a document open.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thank you so this problem is not due to a bug in the code I have written right?
|
|
|
|
|
If you look at this line, it's looking for an ActiveDocument. So, if you have no document open, it's not going to work.
|
|
|
|
|
yes, I understand the error.. but that line is inside an event handler.. I'm using the DocumentChange event to trigger the event handler.. But why is the event handler getting triggered even before a document is opened?
|
|
|
|
|
Are you really sure you want to use this event? If you open two documents, and switch backwards and forwards between them, this event will be thrown every time, so the message box will display repeatedly.
|
|
|
|
|
Yep I'm very sure.. But why is the event fired when there is no open document?
|
|
|
|
|
Have you checked this is the only instance of Word running?
|
|
|
|
|
Yes.. I'm sure its the only instance of word running..
|
|
|
|
|
Maybe the document's state is changing from closed to open. Also the handler refers to the active document. Maybe it's opend first and activated afterwards. So when the first document is opened, it may not be active yet.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
No.. I've not yet chosen the document to open at all.. Error pops up when the application is launched. anyway.. please confirm that its not a problem with the code..
|
|
|
|
|
hello every one,I'm trying to load and run an application A from memory which was written in c#.I have learn the skill from this http://www.codeproject.com/Articles/13897/Load-an-EXE-File-and-Run-It-from-Memory
It work well when the A's Form was simple,but when i add something control such as webbrowser to A's Form, it will throw an exception:"cannot be instantiated because the current thread is not in a single-threaded apartment" . below is my code
Assembly myAssembly = Assembly.Load(exeBuffer);
_MethodInfo myInfo = myAssembly.EntryPoint;
new Thread(() => myInfo.Invoke(null, null)).Start();
could somebody tell me how to solve it? thank you very much.
|
|
|
|
|
You should post your question in the forum at the end of the article, so the author can help you.
|
|
|
|
|
As the error message says, the new Thread needs to be set to STA :
Thread myThread = new Thread(() => myInfo.Invoke(null, null));
myThread.ApartmentState = ApartmentState.STA;
myThread.Start();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Great,it works,thank you so much!
|
|
|
|
|
Hi,
if i use Calendar extender with textbox, Can i enter a date directly to the textbox or choose it from the Calendar
best regards
|
|
|
|