|
Have you looked around at the Office Interop for Powerpoint?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Hi,
AFAIK there are at least three ways to do such things, depending on what you want:
1.
use Process.Start() to launch a new process that opens the target program or the
target document; this opens outside your program, but you could see it become idle,
terminate, and possibly (depends on the app), redirect its input/output/error streams.
This method does not allow interaction at the document level: you can not let your program
change the PPT presentation
Two variations:
a) specify the PPT app as the cmd, and the file as the only argument (this means you must
know exaxctly where the app is on disk)
b) specify the document as the cmd; this simulates a double-click in Windows Explorer
(so there must be a File Association)
2.
use Office Interop; that's the most complex one, now you can do almost anything to the
document, by sending commands all the time to the external process.
I would not do this if you only want to view a document !
3.
use your approach: a web browser component inside your project.
You probably are very close to what you want.
Unfortunately I did it only with shdocvw.dll (a precursor of WebBrowser), and with Word.
Maybe your PPT app was already open, and had a dirty document, so it wanted to save
before opening your other document ?
Hope this helps
|
|
|
|
|
Luc,
I looked around at the Office Interop approach that I mentioned earlier, and it seems to let you open the Powerpoint file, and do some things with it. I'd like to try and open one and just start up as a slideshow. Any idea how this can be accomplished?
Paul
|
|
|
|
|
Sorry Paul, I have never used Office Interop.
If you have a PPT document that is a slide-show (maybe that's a PPS file ? anyway such
that double-clicking it is all it needs), then I would use Process.Start for an
external process, or try a WebBrowser for an internal window.
If it is just a PPT file, I guess you need Office Interop, which IIRC means you need a
special SDK, create one of its objects say "Presentation class"), then invoke Open(),
and either a one-off command ("SlideShow()" ?) or a command per slide, dont know.
I did use VBA once to control Word but that was long before .NET even existed (I managed
to convert a Word document into a web site before they supported that themselves);
I trust MS has now encapsulated their Office object model in a couple of CLR classes.
Greetings
|
|
|
|
|
Luc Pattyn wrote: I have never used Office Interop.
I've only used it for Excel and Word, when a client requested a productivity reporting tool. Could have used something else like Crystal Reports/Reportviewer, but we had standardization reasons to stick with Office. The shop likes to have everything in Office files/format. Ease of information sharing/passing I guess.
Luc Pattyn wrote: I did use VBA once to control Word but that was long before .NET even existed
Same here. I actually looked around in Powerpoint and saw a Run method, but when I went to the macro, it just disappeared
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
When I hittest for a location where a button is, i get ButtonChrome or TextArea. Now I know why, but how do I find 'Button' through code. There is e.Source and e.OriginalSource through the eventargs but for my specific implementation those won't ever return Button as any one of them. Is there another way of finding the Parent of ButtonChrome/TextArea from the HitTestResult?
The reason why the eventargs won't ever have that value is because i'm working with custom input (multitouch screen to be exact). So it doesn't come through the framework. Except if you can propose a better way to start the input. At the moment it starts at the Canvas level. No higher.
thanks in advance.
donovan
rather have something you don't need, than need something you don't have
|
|
|
|
|
Hi Donovan,
cant you turn the touchscreen event into a regular mouse event (or sequence of mouse events) ?
I havent any experience with touchscreens, but I would expect you want to use it like a
mouse, so why not have it do a SendMessage(WM_...) to the active form. In that way
all the Windowing logic would work for you.
What is it the touchscreen vendor provides ? how does he justify a different API ?
|
|
|
|
|
there is no vendor.everything is custom created. the screen works like the ms surface computer.but my code at the moment works ok,i can touch and manipulate images because hittest returns a system.windows.controls.image. but a button returns buttonchrome so there is no way to solidly check the control type to be able to raise the correct event.
i cant check for buttonchrome because it can change depending on the UI styling.
this is all WPF.
rather have something you don't need, than need something you don't have
|
|
|
|
|
OK, about no vendor.
I am not familiar with WPF, ButtonChrome and such.
But my basic question remains: I assume your touchscreen generates some events when
touched/dragged/etc., can't you just turn these into the regular Windows commands
and inject them with SendMessage or something similar (or are these all gone in WPF ?) ?
In Win32 and everything before WPF (and maybe, not sure, also in WPF) events get sent
to a Window, and if necessary that window will forward the events to its controls,
so you typically never have to "dispatch" them yourself. Turning your touchscreen events
in mouse events should give you the same thing.
I suggest you have a look at the old mouse_event function, and the recent SendInput function.
That is the way I would investigate. If that makes things easier, you could do first
experiments on a regular PC, just turn some keyboard actions into mouse actions
with one of the functions I mentioned; then substitute the touchscreen for those
keyboard events.
Hope this helps.
|
|
|
|
|
Is there a property of the Text Box that tells you the line and column of the cursor? And also, is there an event that tells you when these properties have changed? I've looked for both, but I can't seem to find them. I'll look again, to make sure...
If I had a sig, it would probably go here.
|
|
|
|
|
There are two properties for selected text, something like SelectionStart and SelectionLength. The first one will give you the cursor position, but not line position in a multiline text box.
I don't think there's an event that's fired whenever any property is changed.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
There's the SelectionChanged event. This event is fired when the cursor is moved (because the cursor basically is a selection with SelectionLength==0 )
You'll have to calculate the line and column yourself from the given SelectionStart property.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks guys! Here's what I ended up doing...
<code>
char[] before = textBox.Substring(0, textBox.SelectionStart);
int lineBreaks;
int lastLineIndex;
for (int a = 0; a < before; a++) {
if (before[a] == '\n') {
lineBreaks++;
lastLineIndex = a + 1;
}
}
cursorPositionLabel.Text = "Ln " + lineBreaks.ToString()
cursorPositionLabel += " , Col " + (textBox.SelectionStart - lastLineIndex).ToString();
</code>
So much for preserving the tabs...
If I had a sig, it would probably go here.
|
|
|
|
|
please help me
I want to insert new rows into the DataGrid for WindowsCE4.2 Application using c#2003
-- modified at 6:06 Sunday 22nd July, 2007
|
|
|
|
|
Is there a way to stop the form from closing within its OnClosing event? I'm making a program that asks if you really want to close it when you press the "x". So I've got a dialog that pops up and conditional statements for whichever button is pressed in the dialog, but I'm not sure what to put in the conditional statements to make the form stop closing. Could anyone help me out with this?
If I had a sig, it would probably go here.
|
|
|
|
|
Yep:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result = MessageBox.Show("Are you sure you wish to cancel?", "Cancel?", MessageBoxButtons.YesNo);
if (result == DialogResult.No)
{
e.Cancel = true;
}
}
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
yes, see martin's reply. Thats exactly why the Closing event exists, so you can prevent
a Closed event from happening.
|
|
|
|
|
Thanks guys!
If I had a sig, it would probably go here.
|
|
|
|
|
You're welcome.
max29297 wrote: If I had a sig, it would probably go here
You probably mean: I'm happy I dont need a sig anymore...
|
|
|
|
|
lol, yeah, right
If I had a sig, it would probably go here.
|
|
|
|
|
HELLO!!!
Is it possible to remove one item from listview without reloading, refreshing?
Thanks.
One nation - underground
|
|
|
|
|
This will remove the first selected item from the list view.
if (myListView.SelectedItems.Count > 0)
myListView.Items.Remove (myListView.SelectedItems[0]); /ravi
|
|
|
|
|
I think a javascript will help if you want it without reloading!
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
Ok here is the problem. I am developing a server in C and a client in C#. The server send streams of data to the client, and the client is responsible for decoding and interpreting these stream. So, if I send a simple "Hello world" from the server to the client, it works. If I send a byte representing an integer (I use memcpy) I can decode it in the client. But, the problems start when after some integers, I also put a string. If I put 2 bytes, each representing some number, I am still able to decode the string that follows using:
System.Text.Encoding.ASCII.GetString(buffer,2,length)
But if I say 3 bytes, and then the string, I don't get anything (yes, I said buffer,3,length to reflect the server changes), I get garbage.. Can anyone please help me? Thank you.
|
|
|
|
|
What kind of "garbage" do you get?
I think that we have to see some code in order to tell what's wrong with the code...
---
single minded; short sighted; long gone;
|
|
|
|