|
Logs the user off?! If an application did that to me unexpectedly, the first thing I'd do is uninstall it, burn the CD's it came on, then mail the molten pile of (*$^##& back to the company that wrote it explaining why.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
haha... no doubt man
again, not my idea, just need to know how to implement it or work around it
any helpful suggestions?
|
|
|
|
|
My thoughts are to simply make this a service and be done with it...
|
|
|
|
|
Well, the normal way to do this would be to run the service under an account that has the appropriate rights to the resource you need and not supply any user interface what-so-ever. If the backup fails, you can't just pop up a dialog because you don't know if there is anyone logged in or not to see it. You can't just log off the current user, then log on some other user either. It would REALLY SUCK if you forced a user off without saving his changes (if he/she wanted them saved). You simply can't control how that is done. You will either have to FORCE the user off, losing any changes he might need saved or site there and wait for the user to save changes. Oh!! There's a problem there. The user can always click Cancel to saving any changes. This will also have the effect of canceling the logoff too!
A better method would be to have a second application running in the system tray that communicates with the service and supplies notifications and interactions through the tray icon (you can use .NET Remoting for communication part.) This application would then put up the interface to ask the user if they would like to retry the backup and tell the service to retry if it needs to.
I would also suggest going back to the people who are requesting this junk and telling them that what they want is not practical and modify the specifications to, God forbid, accomodate the needs of the USER, and works within the functional limits of Windows.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
awesome, excellent advice...
Yeah, here is the deal. I am very new to windows programming. I was brought up in a Linux C++/Java environment and am making my way through the complexities of windows programming. I can say that I am digging it so far...
I have misconstrued what was communicated to me or better yet, I wasn't able to decipher what my contact was attempting to communicate to me. I tell ya, half of being in IT is interpreting just what the hell the client is asking for. lol...
So yes, I completely agree with you and will begin implementing this tonight. I will most likely be back with more questions relating to this.
Thanks a million!
Spacey
|
|
|
|
|
I have a text file that a program automatically generates and saves in a txt file format. When I open the text file the lines of the text file are as follows:
X000754Y-000065I000754J000189
X000950Y000025I000754J000189
I would like to have a way to open the file and have the lines automatically format to:
X000754 Y-000065 I000754 J000189
X000950 Y000025 I000754 J000189
If anybody knows of source code that would format lines of a text file by adding spaces to it I would appreciate the help.
Thanks for your time.
Darren
|
|
|
|
|
A regular expression will do this for you, easy.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
As Christian said Regular Expressions would be the best way, but if you (like me) dont know how to build those here another straightforward solution:
private static string Format(string text)
{
System.Text.StringBuilder b = new System.Text.StringBuilder();
int counter = 0;
for (int i = 0; i < text.Length; i++)
{
b.Append(text[i]);
if (char.IsNumber(text[i]))
{
counter++;
if (counter == 6)
{
b.Append(' ');
counter = 0;
}
}
}
return b.ToString();
}
|
|
|
|
|
Hi,
I must create a kind of presentation program where a computer has a player and has multiple TV attachted to it. I want to see all the data on the television, but it must also be possible to connect other viewing object to see it.
Program is simular to powerpoint only it must be able to have multiple viewers attachted to a pc with the player software.
My question is what stream or simular must I use to write data to??
I think it must use DirectX, but can't find a good example for C# code.
Can anyone help me please,
Thanx,
SquallBlade
|
|
|
|
|
This has nothing to do with programming, and everything to do with your video card. If your card is outputting to the TV, whatever code you write will display to the TV. If your card does not connect to the TV, no amount of code will make it happen.
In other words, get the right video card, and powerpoint will do this for you, no problems.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I ment trying to show something on the second port of a video card. So I want to only see it on display 2 and on display 1 you can't see anything, only Windows.
Greetz,
Squall
|
|
|
|
|
Again, same answer. It has everything to do with your video card and nothin to do with programming. PowerPoint WILL do this. You just need to setup the video card and PowerPoint correctly, something that is beyond the scope of this forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I must create my own presentation program and i already found out how to show it on the second monitor. But how do I fade and swipe objects working with Direct3D, because DirectDraw is decapricated.
Greetz
|
|
|
|
|
You mean deprecated? DirectDraw is not deprecated and is even encapsulated in the Managed DirectX 9.0[^] SDK, which you can download and use from within C# or any other managed language.
The documented APIs in the SDK discuss how to use screen objects and to direct video. I urge you to read the SDK first.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Dave is wrong. To display things on the second monitor, there is a static class called Monitors or something that allows you to enumerate all screens. From this, you can get the co-ordinates to draw to in order to get onto the second screen.
just a sec.
The class is called Screen. This code shows a window called secondMonitor on the second screen, or hides it if there isn't one.
Screen [] screens = Screen.AllScreens;
if (screens.GetUpperBound(0) > 0)
{
Screen secondary = screens[1];
secondMonitor.Bounds = secondary.Bounds;
secondMonitor.MinimumSize = secondary.Bounds.Size;
}
else
{
secondMonitor.Visible = false;
}
There's no reason to use DirectDraw, unless you really have to. You can just as easily create a window and draw onto it.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
|
You've got a Click event, just call it wit the current mouse position.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
That won't actually click the object, however, even if it were within your application. The Click event fires in response to a click.
To simulate a click, you need to P/Invoke SendInput (this is the easiest) and send the screen coordinates for the click:
using System;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
class Click
{
static void Main(string[] args)
{
if (args.Length != 2)
Environment.Exit(1);
Point p = new Point();
p.X = int.Parse(args[0]);
p.Y = int.Parse(args[1]);
ClickAt(p);
}
[DllImport("user32.dll", SetLastError=true)]
[return: MarshalAs(UnmanagedType.U4)]
static extern int SendInput(
[MarshalAs(UnmanagedType.U4)] int nInputs,
INPUT[] pInputs,
int cbSize);
[StructLayout(LayoutKind.Explicit)]
struct INPUT
{
[FieldOffset(0), MarshalAs(UnmanagedType.U4)] public int type;
[FieldOffset(4)] public MOUSEINPUT mi;
}
const int INPUT_MOUSE = 0;
const int INPUT_KEYBOARD = 1;
const int INPUT_HARDWARE = 2;
[StructLayout(LayoutKind.Sequential)]
struct MOUSEINPUT
{
public int dx;
public int dy;
[MarshalAs(UnmanagedType.U4)] public int mouseData;
[MarshalAs(UnmanagedType.U4)] public int dwFlags;
[MarshalAs(UnmanagedType.U4)] public int time;
[MarshalAs(UnmanagedType.SysUInt)] public IntPtr dwExtraInfo;
}
const int MOUSEEVENTF_ABSOLUTE = 0x8000;
public static void ClickAt(Point p)
{
MOUSEINPUT mi = new MOUSEINPUT();
mi.dx = p.X;
mi.dy = p.Y;
mi.dwFlags = MOUSEEVENTF_ABSOLUTE;
INPUT[] inputs = new INPUT[1];
inputs[0].type = INPUT_MOUSE;
inputs[0].mi = mi;
int ret = SendInput(1, inputs, Marshal.SizeOf(typeof(INPUT)));
if (ret != 0)
throw new Win32Exception();
}
} This is just a sample I threw together quick, but be sure to read about the APIs and structs used in the example.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi. Thanks for your great reply. As this is the first time that I am using windows API in C# it would have taken me a long time to get this far without help.
When I run the code though the the sendInput method returns 1, according to msdn "the function returns the number of events that it successfully inserted into the keyboard or mouse input stream". I don't know for sure though if the click is performed. When I enter the coordinates (0,0) (which I think is the upper left corner) nothing out of the ordinary happens. Is there any way to know for sure?
again thx for your great reply
|
|
|
|
|
If the function returns 1, then 1 mouse click was queued.
As I said in my post, the coordinates are screen coordinates, and I highly doubt you have anything clickable in the absolute upper-left corner of your desktop. If you want click coordinates, call PointToScreen on the control for which you want screen coordinates, which will transform the client coordinates (like 0,0 for the upper-left corner of that control) to screen coordinates, then pass them to the sample method.
For information on P/Invoke, read Consuming Unmanaged DLL Functions[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
Hi, I am using Janus GridEX or Datagrid control
And am trying to bind a Hierarchical dataset to it at runtime
I am unsuccessful in both cases I have been able to see the parent table but am not able to open up to the child. With GridEX it gives me n unhandled exception that says that there is an invalid Child datasource. I have cchecked and the child table and all columns seem to be ok, would help if I could see the proper exception. And with Datagrid I cannot do anything except display the Parent. I added a relation and then tried but still only goit the parent. Here's the code I'm using. Would appreciate any help. Thanks.
PS it's a one to many relationship
dsSearchResults = Facade.SearchQuery(txtSearch.Text, cbSearchInQueryName.Checked, cbSearchInQueryText.Checked, cbSearchInQuerySummary.Checked, cbSearchInQueryDescription.Checked );
DataRelation rel = new DataRelation("QueryDatabases",dsSearchResults.Tables[0].Columns[QUERY_ID],dsSearchResults.Tables[1].Columns[QUERY_ID]);
rel.Nested = true;
dsSearchResults.Relations.Add(rel);
G3.DataSource = dsSearchResults;
G3.DataMember = "Query";
G3.DataBind();
//DataView a = new DataView(dsSearchResults.Tables[0]);
//dgSearchResults.DataSource = dsSearchResults;
//dgSearchResults.DataMember = "Query";
//dgSearchResults.DataBind();
DataGrid dgtemp1 = new DataGrid();
dgtemp.DataSource = dsSearchResults;
dgtemp.DataMember = dsSearchResults.Tables[0].TableName;
dgtemp.DataBind();
DataGrid dgtemp2 = new DataGrid();
dgtemp.DataSource = dsSearchResults;
dgtemp.DataMember = dsSearchResults.Tables[1].TableName;
dgtemp.DataBind();
|
|
|
|
|
If you're having problems with a commercial library you need to contact their support. It's very unlikely that anyone here has any expert experience with a commercial library since there are so many of them, and it's the job of the programming house to provide support.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Could any one tell me that How to get the value of hyperlink in web browser by C#.
|
|
|
|
|
You need to walk the DOM (document object model) by casting the AxWebBrowser2.Document property (or whatever the class is called, depending on how you imported it) to an IHTMLDocument3 , which is defined in the Microsoft.mshtml.dll interop assembly, or you can always import your own using VS.NET or tlbimp.exE.
Once you do that you simply walk the DOM like you would in HTML, or get the A link using it's ID (if set) like so:
IHTMLDocument3 doc = (IHTMLDocument3)axWebBrowser2.Document;
if (doc != null)
{
IHTMLAnchorElement a = doc.getElementById("myLink") as IHTMLAnchorElement;
if (a != null)
{
Console.WriteLine(a.href);
}
} Search for "IHTMLDocument" in this forum by clicking "Search comments" for additional examples of how to walk the DOM using the Internet Explorer WebBrowser control.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|