|
|
Thanks to Davie and Giorgi Dalakishvili i figured out the issue.
As Davie said above, It was a loop in the constructor so when it was getting called it had not yet been set to listen to.
So i moved the loop to its own Start() and it now works as below:
SegmentOne = new Segment(SegmentOneStart, SegmentOneEnd, this._webRequest);<br />
SegmentOne.ProgressUpdate += new Segment.SegmentProgressUpdate(SegmentOne_ProgressUpdate);<br />
SegmentOne.Start();
Thanks guys
|
|
|
|
|
Well, like the topic asks, is it possible to make a program in C#/VB.NET that can hide the mouse cursor in another program? (Like a mediaplayers videowindow)
Tried this:
[DllImport("user32.dll")] private static extern long ShowCursor(long bShow);
But you cant specify hwnd/handle, so it only works for the current window that belongs to my app.
So what im asking is:
Is it possible to hide the mouse cursor when its inside a window that belongs to another program?
|
|
|
|
|
Why not embedded the application inside yours and then use that to hide the cursor which you can do from .net.
|
|
|
|
|
what do you mean by embedding the application inside my application?
Its not a .NET app
|
|
|
|
|
if it's not a .net app why is it on a c# forum.....
however I know you can embed some thing in a win form, can you embed an entire application. Maybe not. I may be barking up the wrong tree, just thinking out the box.
Or you could have a transparent form on top of all the application and then just pass the click to it. ... just random ideas that may be rubbish, not something I've thougth too much about
|
|
|
|
|
I meant that my app is a C# app, but the app i eventually would embed is not.
The program im embedding is BSPlayer, a multimediaplayer which has a floating videowindow.
I tried embedding it, but without luck... And also, it needs to be fullscreen, so its sort of difficult :P
|
|
|
|
|
I saw a VB6 sample app that had excel completely embedded in it (to include full excel menus in the apps menu strip), but was unable to port it to VB.net, although that might've been a lack of experience since I'd only had a few months of work/.net experience at the time.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
dan neely wrote: excel completely embedded
I thought you may be able to do something like this but not sure how in c#
|
|
|
|
|
You can, you'd have to use DllImport.
You could first use SetWindowLong to remove the caption bar / border. Then use FindWindow to get a handle to the program you want to embed (or start the process yourself), then finally a call to SetParent to set the parent window of the external application to a panel or something inside your own application.
A simple test is to set the parent window of Internet Explorer to something like Notepad.
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
The way you're post suggests it, you can't. You have no control over how the code of another app runs, and for the most part, how a foreign window behaves.
But, as the other poster said, it is possible to host the window of another app in your own application and control the mouse visibility in your own window. Though, using this technique can cause problems for the app being hosted. You may run into drawing problems in the hosted app, or other issues.
You need to create a window in your app, like a Panel control in a form. Just keep it a light-weight control. Then you need to get the window handle of the main window of the application and call a Win32 function called SetParent to change that window's parent to your Panel control's window. For example:
[DllImport("user32.dll", EntryPoint = "SetParent", SetLastError = true)]
private static extern IntPtr SetParent(IntPtr hwndChild, IntPtr hwndParent);
private void button1_Click(object sender, EventArgs e)
{
Process p = Process.Start("Notepad.exe");
p.WaitForInputIdle();
SetParent(p.MainWindowHandle, panel1.Handle);
}
|
|
|
|
|
Does that include things like merging the captured applications menus into the host? The VB I'd seen a few years ago was IIRC several hundred lines. I'm wondering if it did more, or was just a stereotypical codethulu.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
dan neely wrote: or was just a stereotypical codethulu.
A couple hundred lines?? You probably got it right with this statement!
Even under VB6, I did this with just about a couple dozen lines of code.
dan neely wrote: Does that include things like merging the captured applications menus into the host?
All it does is make the hosted app window render inside the control window. It doesn't merge menus with the host window at all. The Desktop window is normally the parent window, in a sense anyway. All you're doing is stealing the parent role away from the desktop.
|
|
|
|
|
DaveyM69 managed to identify what my problem was in a post down thread and I got it working.
TTBOM this is a lower level of integration than the VB code I was messing with. The hosted apps menus were merged into the hosting apps menu strip. I don't recall if there were any other differences besides the hosted app appearing as a fixed control (that part could've been done like your sample but pinned so it couldn't be moved I guess...).
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Wow - I didn't know that was possible!
Tried it and it works perfectly. 5'd
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
DaveyM69 wrote: Wow - I didn't know that was possible!
So you haven't seen this[^]
|
|
|
|
|
No, that one passed me by somehow, thanks for the link
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
You are welcome
|
|
|
|
|
Yeah, it's kind of cool, but I've run into a couple of apps over the years that didn't like it when you did this. Rendering got all screwed up in those apps. Never did find a work around for it.
|
|
|
|
|
something on your sample isn't working for me in 2k8. The SetParent call causes notepad to disappear but it's not showing up embedded in the panel either.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Well, I can tell you it works on 2000 and XP. I haven't had cause to use it on Vista or 2008.
|
|
|
|
|
*sigh*
I'm running in XP. Did you do anything other than adding the 2 using directives, dragging the button and panel onto the form and wiring up the event and dllimport?
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Nope. That's all I did.
OK. This is weird. It works on my home dev machine, but not on my work laptop. I think it might be because of a patch that was installed. My dev machine is about 6 months behind in patches .
|
|
|
|
|
It was invisible on my (Vista) system briefly until I made the panel a reasonable size - then it suddenly appeared.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
didn't help on my XP system even with the app sized to 1600x1200 I've got whatever the MSDN standard version was as of mid summer.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|