|
I am trying to find the accurate lastLogon for a user. I know that lastLogon is not replicated, so is possible to loop thru all the domain controllers in the domain without having to explicitly identifying each (by name)? An example in C# would be great.
thanks
rick
|
|
|
|
|
Hi,
I need to insert text and images together in a subitem in a listvew in C#. The images and the text can be in any position and any order in the subitem. The images need not be only at the start position of the subitem.
If any one has this kind of control do let know.
Any help will be great.
Thanx
Saleem
|
|
|
|
|
Hello,
I am doing a small application similar to the Windows Task Manager. In the Windows Task manager the first tab 'Applications' displays all the running applications in the system. I tried two ways to get running applications but each of my method had problems.
No.1
I got All the running processes
Process [] procs = System.Diagnostics.GetProcesses();
foreach(Process p in procs)
{
// I can get Handle and Title of the Main Window
// of each process and can
// display it.
someVariable = p.MainWindowHandle;
someVariable = p.MainWindowTitle;
}
Though the above method works fine for most processes, but for the processes like Explorer.exe or Winword.exe this method fails. Explorer.exe is running as a single process but have multiple Top-level windows associated with them. Similarly Winword.exe is only one process even if you have multiple word documents opened. In these cases
p.MainWindowTitle only gives me title for one window.
No.2
I also tried to Enumerate All thread Windows for each thread in every process through Win32 EnumThreadWindows(), then I checked each returned window using the GetParent() to check that if the application does not have a parent or owner then it is a Top-Level window and should be displayed in Task Manager. But in this case I get too many windows. I even get the Windows TaskBar window and a lot of other windows which are not actually applications (Windows Task Manager do not display them).
I even tried EnumWindows() and EnumDesktopWindows() but with similar results and getting too many extra windows which are Top-Level windows but are not applications.
Now, I guess that the Windows Task Manager gets this information about the running applications directly from the Windows Shell, but I dont know which shell interfaces will give me this information.
Can Anyone tell me how I can Enumerate the Running Applications exactly which are displayed in the Windows task manager. How I can do this in C# or in Win32 or any related Shell Interfaces.
How I can Enumerate All running Applications.
Thanx
|
|
|
|
|
Hello
I have a string, strUrval with the following data:
"tbOppningsDatumFrom=2004-10-10/uccontrol/tbimba=fpkepf/jaha/"
I do a String.Split to put data between the /'s in an array:
string strDelim = "/";
char [] delimiter = strDelim.ToCharArray();
string [] strUrvalSplit = null;
for (int x = 0; x < y; x++)
{
strUrvalSplit = strUrval.Split(delimiter,x);
}
this results in the following:
strUrvalSplit [0] = tbOppningsDatumFrom=2004-10-10
strUrvalSplit [1] = uccontrol
strUrvalSplit [2] = tbimba=fpkepf/jaha/
how come the string.split suddenly stops caring about the /'s ?
|
|
|
|
|
livez wrote:
string strDelim = "/";
char [] delimiter = strDelim.ToCharArray();
string [] strUrvalSplit = null;
for (int x = 0; x < y; x++)
{
strUrvalSplit = strUrval.Split(delimiter,x);
}
What is y?
you can do only
strUrvalSplit = strUrval.Split( delimiter );
David
|
|
|
|
|
dnh wrote:
What is y?
Y is the total number of /'s in the string:
int y = 0;<br />
char [] totAntal = strUrval.ToCharArray(); <br />
foreach( char c in totAntal )<br />
{ <br />
if (c == '/')<br />
{ <br />
y++; <br />
} <br />
}
dnh wrote:
you can do only
strUrvalSplit = strUrval.Split( delimiter );
okay thanks, Ill try it out.
edit: that solved my other problem as well, thanks alot =)
|
|
|
|
|
Hi,
I am trying to use a webservice hosted in a server from my laptop, but I keep getting the following error when adding the web reference:
'The request has exceeded the maximum time' or something like that
However, if I try to add a web reference to the web service 'latest' hosted here at the Code Project, it works fine.
Ideas? Any help would be appreciated
Thanks in advance
|
|
|
|
|
Are you able to invoke the webservice successfully from the browser? If your webservice url is services.asmx, you can try navigating to http://localhost/<your_webservice_dir>/services.asmx. That'll result in a page that'll allow you to invoke the web service's methods from the browser.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
If I Invoke the asmx file from the browser, be it in the server itself or in a client, I can actually see the list of web services provided.
Even from the VS IDE I get the list of web services, the problem is that it times out and the 'add reference' button is disabled, so I can't add it.
|
|
|
|
|
Kindly i want to know how to use window proc from within C# Application
is there any tutorial or somebody can help me in doing this
|
|
|
|
|
Just override WndProc in your class derived from System.Windows.Forms.Control . For example
class Test : Control
{
protected override void WndProc(ref Message m)
{
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Is there a way to add a new bar to the Outlook Navigation Pane. I have tried but have found out that only the shortcut bar is programmable. I know the Outlook object model doesn't allow us to do it but is there is any other way please let me know. Also i would like to show differet context menus when clicking on different calenda folders. Can anyone please help.I am working in C#.
Bikash Rai
|
|
|
|
|
(design pattern terminology newbie warning!)
I'm porting a sprite engine and multimedia toolbox, Endogine, which I've written in Director (see www.endogine.com) to C#, and I have to change the structure a bit because of the language differences.
In Lingo (Director's scripting language), it's possible to switch base classes in runtime, which is something I use a lot in Endogine.
Here's how:
The sprites can be rendered either by blitting bitmaps to the screen, or by using textured 3D planes. In the C# version, I support GDI+, DirectDraw and Direct3D.
Naturally, for each rendering method, different code is needed, and to solve this I've written a separate Sprite class (derived from the virtual SpriteBase) for each rendering method.
Now I want to derive other classes from these 3, say a BouncingSprite which moves around the screen. Depending on the rendering mode, a different base class must be used. In Lingo, I could define the base class in runtime (3D mode? OK, use Sprite3D as base class), but obviously this isn't allowed in C#.
Which is the most common way to go about this? (I don't just want it to work, I want it to use well-known design patterns
Interfaces could help, but I don't know much about them.
Should I avoid inheritance for the 3 types of rendering and write 3 separate "SpriteRenderMethodSpecific" helper classes (and a base class for them) so the Sprite class can choose which to instantiate in runtime? (Or is that pattern called Adapters..?)
TIA
|
|
|
|
|
I'm not a patterns expert, so there may be a better solution. But I'd probably use the "strategy" pattern.
Each of the three possible base classes must have the same interface, otherwise how are the derived classes going to cope with their bases being hot swapped from beneath them. So, create an interface for those calls. then create three classes that implement that interface (you could use an astract base class [ABC] in place of an interface if you prefer).
Then in what was your derived class create a member variable which is of the same type as the interface (or ABC). You can then create a method for instantiating the required concrete class so that you can call it at run time to swap the render methods around as needed. The constructor should call this instantiating method so that at least the class always has a valid render helper class. Each time you need to render something it calls through the interface (or ABC) to get at the correct functionality.
So...
interface IRenderHelper {}
class RenderTypeA : IRenderHelper{}
class RenderTypeB : IRenderHelper{}
class RenderTypeC : IRenderHelper{}
class BouncingSprite
{
IRenderHelper renderHelper;
void UseRenderTypeA()
{
renderHelper = new RenderTypeA();
}
void UseRenderTypeB()
{
renderHelper = new RenderTypeB();
}
void UseRenderTypeC()
{
renderHelper = new RenderTypeC();
}
}
Does that help?
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
It feels like that is esentially my vague ghost of an idea put into form and substance - so it sounds very reasonable! I'll read up on interfaces and the strategy pattern. Thanks a lot!
BTW, does anyone have recommendations for good C#+Managed DirectX forums/mailing lists?
|
|
|
|
|
Hi ,
This is code has been written in Vb.net
In Winform there are two button. First button checks for LAN connection nad Second button checks for Modem connection.
When i connects thr dial up and press modem connection then it works fine
but for LAN connection it does not work it traps the dial up connection and retruns the value FALSE
Note: I have connected thr LAN and dial up thr modem (Basically it connects two computer using modem)
This program perfectly works for Modem but it does not work for LAN
can somebody modifies this program
----------------------------------
Imports System.IO, Microsoft.Win32
Public Class Form1
Inherits System.Windows.Forms.Form
Private Declare Function InternetGetConnectedStateEx Lib "wininet.dll" Alias "InternetGetConnectedStateExA" _
(ByRef lpdwFlags As Long, _
ByVal lpszConnectionName As String, _
ByVal dwNameLen As Long, ByVal dwReserved As Long) As Boolean
Public Const ModemConnection As Integer = &H1S
Dim Status, Status1, DissNotWritten As Boolean
Public CntType As Long, CntName As String, CntNameLen As Long = 50
Public CntType1 As Long, CntName1 As String = Space(50), CntNameLen1 As Long = 50
Public Const LanConnection As Integer = &H2S
Public Function IsModemConnection() As Boolean
Dim dwflags As Integer
'return True if modem connection.
' MessageBox.Show(ModemConnection)
' MessageBox.Show(Status)
' MessageBox.Show(IsModemConnection)
Status = InternetGetConnectedStateEx(CntType, CntName, CntNameLen, 0)
IsModemConnection = CntType And ModemConnection And Status
'MessageBox.Show(IsModemConnection)
End Function
Public Function IsLanConnection() As Boolean
Dim dwflags As Integer
'return True if LAN connection
Status1 = InternetGetConnectedStateEx(CntType1, CntName1, CntNameLen1, 0)
IsLanConnection = CntType1 And LanConnection And Status1
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not IsModemConnection() Then
DissNotWritten = False
MessageBox.Show("Not Connected To Internet !!!")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Else
MessageBox.Show("Connected To Internet !!!")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Not IsLanConnection() Then
DissNotWritten = False
MessageBox.Show("Not Connected on LAN !!!")
Else
MessageBox.Show("Connected on LAN !!!")
End If
End Sub
This modemcheck program has been written in Vb.net which only checks for modem It does not check the separate LAN connection i need to checks for LAN also bec in my computer I have only Local area connection and one modem connection
This program i converted into C sharp
----------------------------------
In This C sharp program it does not check for MOdem connection i have used same thing what i used in VB.net above modem connectivity program
Can anyone modify it
I tested in vb.net its working for modem ocnnection but when i connect also LAN connection
modemcheckcsharp.cs
----------------------
using System;
using System.Collections;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.IO;
using Microsoft.Win32;
[System.Runtime.InteropServices.DllImport("wininet.dll", EntryPoint="InternetGetConnectedStateExA", ExactSpelling=false, CharSet=System.Runtime.InteropServices.CharSet.Ansi, SetLastError=true)]
private static extern bool InternetGetConnectedStateEx(ref long lpdwFlags, string lpszConnectionName, long dwNameLen, long dwReserved);
public const int ModemConnection = 0X1;
private bool Status;
private bool Status1;
private bool DissNotWritten;
public long CntType;
public string CntName;
public long CntNameLen = 50;
public long CntType1;
public string CntName1 = string.Empty.PadLeft(50);
public long CntNameLen1 = 50;
public const int LanConnection = 0X2;
public bool IsModemConnection()
{
int dwflags = 0;
//return True if modem connection.
// MessageBox.Show(ModemConnection)
// MessageBox.Show(Status)
// MessageBox.Show(IsModemConnection)
Status = InternetGetConnectedStateEx(ref CntType, CntName, CntNameLen, 0);
return Convert.ToBoolean(CntType) & Convert.ToBoolean(ModemConnection) & Status;
//MessageBox.Show(IsModemConnection)
}
public bool IsLanConnection()
{
int dwflags = 0;
//return True if LAN connection
Status1 = InternetGetConnectedStateEx(ref CntType1, CntName1, CntNameLen1, 0);
return Convert.ToBoolean(CntType1) & Convert.ToBoolean(LanConnection) & Status1;
}
private void Button1_Click(object sender, System.EventArgs e)
{
if (! (IsModemConnection()))
{
MessageBox.Show("Not Connected To Internet via Modem!!!");
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
}
else
{
MessageBox.Show("Connected To Internet Via modem !!!");
}
}
private void Button2_Click(object sender, System.EventArgs e)
{
if (! (IsLanConnection()))
{
DissNotWritten = false;
MessageBox.Show("Not Connected on LAN !!!");
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
}
else
{
MessageBox.Show("Connected on LAN !!!");
}
}
Pls modify this csharp program as written in vb.net Out put is dieeerent in c sharp.
Please check out the above program
Thanks in Advance
regards,
sanjeev
|
|
|
|
|
Hello
I have something of a silly question =)
I have buttons I want the user to be able to access with quickcommands. I have already set the apropriate keys, but how do I underline for an example the s in save in a button.text?
|
|
|
|
|
Hi!
Just prefix the letter you want to be underlined with an ampersand.
So the Text for your Save button would be "&Save".
mav
|
|
|
|
|
<br />
private System.Windows.Forms.Button cmdTest;<br />
this.cmdTest = new System.Windows.Forms.Button();<br />
<br />
this.cmdTest.Text = "&Save";<br />
When the form is loaded and the button shows, you might not see the S underlined until you press the "Alt" button. I just tested this - I brought up the form and typed ALT-S and it fired the event (simple message box).
|
|
|
|
|
i would like to use TAPI with C#,can u help me from where to start,thnx
|
|
|
|
|
That depends entirely on what TAPI is
|
|
|
|
|
There are various C# wrappers that will let you use TAPI (Telephony API) in C#. The problem is, none of them completely wrap the API. Also, there are serious issues with using TAPI 3.0 from managed code. You might want to search www.GotDotNet.com User Samples section for "TAPI".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You'll have to consult the MSDN documentation on the OS version your using to see what it supports as far as TAPI. The embedded/mobile operating systems don't support the full TAPI API's.
You can start here[^]. I can't go any further becuase I've never done any kind of TAPI-based development and I rarely do embedded development.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have the following URL:
http://citeseer.ist.psu.edu/rd/55811103,653,1,0.25,Download/http://citeseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf
Creating System.Uri with the above URL:
Uri uri = new Uri(aboveURL)
removes the extra slash after "Download/http://". The debugger shows it as
Download/http:/citeseer.ist....
The Uri in HttpWebRequest (which is created with the above URL) also removes
the extra slash. As a result, I get NameResolution exception.
The Uri is shown as
http://citeseer.ist.psu.edu/rd/55811103,653,1,0.25,Download/http:/citeseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf
|
|
|
|
|