|
You won't be able to get the password, unless you create a form to capture it. This would be a way to do it though.
<br />
[DllImport("advapi32.dll", SetLastError = true)]<br />
public static extern bool LogonUser(String lpszUsername, <br />
String lpszDomain, String lpszPassword,<br />
int dwLogonType, int dwLogonProvider, ref IntPtr phToken);<br />
<br />
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]<br />
public extern static bool CloseHandle(IntPtr handle);<br />
<br />
IntPtr tokenHandle = new IntPtr(0);<br />
const int LOGON32_PROVIDER_DEFAULT = 0;<br />
const int LOGON32_LOGON_INTERACTIVE = 3;<br />
<br />
tokenHandle = IntPtr.Zero;<br />
<br />
if(LogonUser(txtName.Text, DomainName, txtPwd.Text,<br />
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT,<br />
ref tokenHandle))<br />
{<br />
WindowsIdentity WinIdentity = new WindowsIdentity(tokenHandle);<br />
System.Threading.Thread.CurrentPrincipal =<br />
new WindowsPrincipal(WinIdentity);<br />
}<br />
If the user has been authenticated on the domain you will have the WindowsIndentity available. Have you done a search for Single Sign On (SSO)?
only two letters away from being an asset
|
|
|
|
|
Nope, never searched for SSO. And, to be PURELY honest, I've never even heard that term before. On that note, I'm searching for it as we speak...
Although you've got some pretty cool code there; I can see what you are doing with it, but it isn't what I need to do.
Sadly this looks like it would be for a prompt asking the user to enter his/her credentials and then verifies if they are correct.
I do not wish to do this. All I want is to simply use the same credentials from the Windows domain logon and pass it on without verifying or asking for it.
**EDIT**
I searched for SSO, and I think it's a bit too big for this small app. Perhaps in the future if I get promoted to being an actual full-time app developer, then maybe, but for now, WAY too big... But thanks for that insight; it opens my eyes to some other possibilities.
|
|
|
|
|
Hi all,
how is everybody here hope good and fine
well i am just wanna to get started with a program to do a firework animation in any language just anyone give me a hint on what i am gone to do
thanks in advance
sallam for now
and takecare all
|
|
|
|
|
It is impolite to state urgent in your subject line, and outright rude to do so if it is not really something urgent. Let your subject line be something that describes, briefly, your problem.
Please read the message board rules[^]
|
|
|
|
|
Hints:
(1) Learn a programming language.
(2) Code a firework animation using the above language.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: (1) Learn a programming language.
I recommend c# (but then I'm partial) try this:
Visual C# Developer Center - New to Development[^]
CPallini wrote: Code a firework animation using the above language.
You may not even need to learn a programming language to do this and it could be approached from other avenues than programming. Are you wanting to learn programming and think this would be a cool project or do you want to do a fireworks animation and think programming is the right way to approach it? Put this in context and then define what you mean by fireworks animation and exactly what you expect to see when you're done.
-- modified at 17:23 Saturday 26th May, 2007
|
|
|
|
|
Actually I alredy know a bit about programming [^] and I don't need to do a firework animation.
Anyway, thank you for the suggestions.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
As Homer Simpson would say, "Doht"!
Sorry, thought it was the original poster.
|
|
|
|
|
If you don't want to hard code a firework animation you could possibly create an animated gif file with Animation Shop or a PhotoShop program and just run through the frames at specific time intervals.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
1 - read the FAQ on how to ask questions
2 - unless you're saying you know ALL languages, choose one and learn it, and don't expect to be writing a firework animation in that language for at least 12 months.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Stop urgenting people urgently or you'll have a great firework soon
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Muammar© wrote: (\ /)
(O.o)
(><)
What is this?
I can't deside if it is a boxer or a angry lop-sided topless woman with a mole.
|
|
|
|
|
Hi All
I'm Create a Generics class and i need to write a function return lis of object stored on it but i have a problem as following:
I want to compare if the Generics type is the same of the created class and if its the same i want to use a same method and if not the same type of the created class return the object value .
example:
class myList
{
Array MyArray;
public myList()
{
_MyArray=new Array();
}
public void add(T value)
{
_MyArray.add(value);
}
public object[] List
{
//here is the problem
//Array<object> temp=new Array<object>();
//if T is myList<>
//{
// foreach(T item in _MaArray)
// {
// temp.addRange(item .list);//use list method
// }
//}
//else
//{
// foreach(T item in _MaArray)
// {
// temp.addRange((object)item);
// }
//}
}
}
{
myList AList=new myList();
myList BList=new myList();
BList.add(1);
BList.add(2);
BList.add(3);
AList.add(BList);
//BList.list === {1,2,3}
BList=new myList();
BList.add(4);
BList.add(5);
BList.add(6);
AList.add(BList);
//BList.list === {4,5,6}
//AList.list === {1,2,3,4,5,6}
Note:I know there is an exist class List but This is just an example i need to know how can i do the list function that's it
thank you,
|
|
|
|
|
|
thank you Mark
this is the correct code but I need just how can i call a function in this example list for the generics T(((T)item) .list) or use it like the class( myList<t>)
plz reply me as soon as possible
//--------------------------
myList<mylist<int> ///.list =={1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90}
[0]myList<mylist<int>>///.list =={1,2,3,4,5,6,7,8,9}
[0]=myList<int>;///.list =={1,2,3}
[0]=1;
[1]=2;
[2]=3;
[1]=myList<int>;///.list =={4,5,6}
[0]=4;
[1]=5;
[2]=6;
[2]=myList<int>;///.list =={7,8,9}
[0]=7;
[1]=8;
[2]=9;
[1]myList<mylist<int>>///.list =={10,20,30,40,50,60,70,80,90}
[0]=myList<int>;///.list =={10,20,30}
[0]=10;
[1]=20;
[2]=30;
[1]=myList<int>;///.list =={40,50,60}
[0]=40;
[1]=50;
[2]=60;
[2]=myList<int>;///.list =={40,50,60}
[0]=70;
[1]=80;
[2]=90;
//---------------------------
thank you in advance,
example:
class myList<t>
{
Array MyArray;
public myList()
{
_MyArray=new Array();
}
public void add(T value)
{
_MyArray.add(value);
}
public object[] List
{
//here is the problem
//Array<object> temp=new Array<object>();
//if T is myList<>
//{
// foreach(T item in _MaArray)
// {
// temp.addRange(((T)item) .list);//use list method
// }
//}
//else
//{
// foreach(T item in _MaArray)
// {
// temp.addRange((object)item);
// }
//}
}
}
{
myList<mylist<int>> AList=new myList<mylist<int>>();
myList<int> BList=new myList<int>();
BList.add(1);
BList.add(2);
BList.add(3);
AList.add(BList);
//BList.list === {1,2,3}
BList=new myList<int>();
BList.add(4);
BList.add(5);
BList.add(6);
AList.add(BList);
//BList.list === {4,5,6}
//AList.list === {1,2,3,4,5,6}
|
|
|
|
|
No, a generic class would be something like this*
public class MyList<T> : IEnumerable<br />
{<br />
private List<T> m_InternalList;<br />
<br />
}
As in the example, now you have a Generic class that can support a collection of objects in a type-safe manner and gives the ability to iterate through that collection.
*disclaimer: Not 100% complete and acccurate code, just psuedo code so don't complain;P
-- modified at 18:03 Sunday 27th May, 2007
only two letters away from being an asset
|
|
|
|
|
i want to send 6 datas from microcontrol to Visual c# with serialport.i create byte array variable in c# for saving my serial datas.but when i send datas so synchronization problem becomes.every time i see 255 at the first data why?i get datas and i show them to textboxes.what kind of problem can be?
my code is:
serialport_DataReceived(.........)
{
serialport.read(variable,0,6);
}
could be buffer problem?
|
|
|
|
|
Make sure you're addressing the right serial port.
Device Manager > Your serial port > Properties > Resources > I/O Range (Get the range and maybe translate it to Decimal figures)
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
i have to read data from an excel file and compare it with
data from sqlserver ...how can i read data frmo excel into such a strucutre so that i can compare data...
urgent help needed.........
|
|
|
|
|
I'm using VCS Express 2005.
I have a lot of property definitions in different classes like
public class MyEntity {
public string somestringfield {
get { return (string)Row["somestringfield"]; }
set { Row["somestringfield"] = value; }
}
public string someotherstringfield {
get { return (string)Row["someotherstringfield"]; }
set { Row["someotherstringfield"] = value; }
}
}
When template changes I must manually change it in hundreds of places.
I tried to use template
#define StringFieldTemplate( propname ) \
public string propname { \
get { return (string)Row[propname]; } }
set { Row[propname] = value; } \
};
public class MyEntity {
StringFieldTemplate("somestringfield2")
StringFieldTemplate("someotherstringfield2")
}
But got error.
How to implement this ?
Andrus
|
|
|
|
|
I use DataGridView containing DataGridViewComboBoxColumn column.
Combobox column displays dropdown list opening selection triangle in all rows. This covers part of visible data if columns are narrow.
How to force dropdown list opening control to appear only in active (current) row ?
Andrus.
Andrus
|
|
|
|
|
To reproduce
1. Run the code.
2. Open dropdown list
Observed:
Dropdown list width is same as column width
Expected:
Dropdown list width must be greater than column width
How to make dropdown list width greater than column width in DataGridView ?
Andrus.
using System;
using System.Windows.Forms;
class Form1 : Form {
[STAThread]
static void Main() {
try {
Application.Run(new Form1());
}
catch (Exception e) {
MessageBox.Show(e.ToString());
}
}
private DataGridView dataGridView1 = new DataGridView();
public Form1() {
Controls.Add(this.dataGridView1);
Load += new EventHandler(Form1_Load);
}
private void Form1_Load(object sender, EventArgs e) {
DataGridViewComboBoxColumn
col = new DataGridViewComboBoxColumn();
col.DropDownWidth *= 3;
dataGridView1.Columns.Add(col);
}
}
Andrus
|
|
|
|
|
hi
i want to search by string with pattern, but i want to tell to my regex object that ignore some unicode characters or diacritics (such as "ًٌٍَُِّ") in string, but
how to do ?
|
|
|
|
|
Hi!
You can explicitely specify a character not within a range by using ^ as first character in the character selection, for example [^abcl-p] means "any character except a,b,c and l to p" .
HTH,
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hello all,
i've written some code that displays a ball bouncing around inside a windows
form. In an attempt to eliminate the flickering of the ball i copy-pasted this
into the the Form's constructor:
<br />
this.SetStyle(<br />
ControlStyles.UserPaint |<br />
ControlStyles.AllPaintingInWmPaint |<br />
ControlStyles.DoubleBuffer, true);<br />
Now when I try to run the code I get this error message. Does anyone know why? or know another way to stop this flickering. Thanks
Error msg:
********************************************************************************************
System.ArgumentException: Parameter is not valid.
at System.Drawing.Graphics.GetHdc()
at System.Drawing.BufferedGraphics.RenderInternal(HandleRef refTargetDC, BufferedGraphics buffer)
at System.Drawing.BufferedGraphics.Render()
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsApplication1.Program.Main() in C:\Documents and Settings\Gareth\My Documents\C#\Working_Programs\Bouncing_Ball_With_Gravity\Bouncing_Ball_With_Gravity\Program.cs:line 19
***************************************************************************************************
|
|
|
|
|