|
Zalkina wrote:
I challenge you to, given a user name and the corresponding password, to write a function, checking for the "SeServiceLogonRight" (or any other right for that matter) Or simply to sucessfully call the LsaEnumerateAccountRights function on a user account, as I should be able to evaluate the resulting string array of rights myself ...
Wouldn't the challenge be more beneficial if you were to challenge yourself, thus learning how the process works? Overall it shouldn't be too difficult. If you have questions along the way, feel free to post them here so we can help.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I'm not sure if this helps or not...but basically you find you have a 'valid user' by the pressence of the userID. ie. if they never logged into the network, they'd never have a credential. This is a snippet from my security manager
private static readonly string domainName = System.Environment.UserDomainName;
private static readonly string userName = System.Environment.UserName;
private static readonly string fullUserName = domainName + @"\" + userName;
private static readonly WindowsPrincipal currentPrincipal =
new WindowsPrincipal(WindowsIdentity.GetCurrent());
public bool CheckUserGroup(string groupName)
{
return currentPrincipal.IsInRole(domainName + @"\" + groupName);
}
This signature left intentionally blank
|
|
|
|
|
hello there
I have a program whit some textbox
when the cursor is inside the textbox
how can i change languish ?
the cursor direction ?
i dont want to press Alt+Shift
i want it automatically
thanks !!!
|
|
|
|
|
kings_1 wrote:
how can i change languish ?
Huh?
kings_1 wrote:
the cursor direction ?
You can change your cursor several different ways. If you want to use a predefined cursor you can do the following:
this.Cursor = Cursors.WaitCursor;
this.Cursor = Cursors.Default;
If you have a cursor file (i.e., *.cur), you can loaded that as such:
this.Cursor = new Cursor(GetType(), "MyCursor.Cur");
- Nick Parker My Blog | My Articles
|
|
|
|
|
not the mouse Cursor
i want to change the keybord cursor
&
i dont have any of that things
this.Cursor = Cursors.WaitCursor;
this.Cursor = Cursors.Default;
thanks anyway !!!
|
|
|
|
|
Your still not making yourself clear. If you could explain clearly what you are trying to do others would be able to help you.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Not sure exactly what you are asking.....but if it is language-based changes in various text boxes (ie: textBox1 = English while textBox2 = Chinese) then first you need to enable localization and second in textBox2 you would set RightToLeft = true;
This signature left intentionally blank
|
|
|
|
|
i am pretty new to programming but have quite some knowledge of it this thins i am doing it for my own learning.here is what i want to do.I got an access database which has all memebers information with their name addess and expiry Date. Now i want to make a program using either c,C++ or java that will go through the access database and look at expiry date and if its expired it will read the email address part and send an email to the address specifies with a predefined message that says Your membership has expired and stuff like that. Any links to something that can help me will be appreciated. Thanks a lot
|
|
|
|
|
funaki wrote:
using either c,C++ or java
If you have a specific C# question, please feel free to ask it, however you are asking about overall design, in particular, another language. There are many articles not only on this site but also on the Internet in general that cover how to programmatically access a database and send email. Good luck.
- Nick Parker My Blog | My Articles
|
|
|
|
|
i am really sorry about that.Yes i am asking about C/C++.any help would be appreciated. Also if you hook me up with some of the articles you said. THanks a lot.
|
|
|
|
|
Another problem I have encountered is using a timer in .NETCF. The start and stop methods are not available. I just want a timer to count 40 seconds, and at the end of 40 seconds, throw an error message. I feel like im crippled trying to use the CF....
|
|
|
|
|
|
I'm trying to make a progress bar using the COmpact Framework for a Pocket PC. However, in the Compact Framework, there is no step property, nor is there a performstep method. Does anyone have an example of a working progress bar using the Compact Framework?.
I just want it to float indepenently at the front of my application. Also, a messagebox of some sort with moving ... 's would be acceptable as well, but I don't know how to code it either.
|
|
|
|
|
|
j1e1g1 wrote:
I'm trying to make a progress bar using the COmpact Framework for a Pocket PC. However, in the Compact Framework, there is no step property, nor is there a performstep method.
The ProgressBar Class[^] is supported under the .NET Compact Framework, however if you are trying to write your own ProgressBar control, you will have to write your own methods and properties. The PerformStep method under the .NET Framework only calls the Increment method passing the step value. The Increment method increments the value to itself, checks to see if it is within bounds and updates the UI.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hy everyone!
I do want to split strings to get some special infos.
Lets say I want to split the following:
Winter, John\r\nBusinessnum. 1: +12 (23) 4567890\r\nMobile 1: +23 (456) 22562
Well I could get along with it using
string ltemp=""; // info is draged in here (e.g. the string above)
// remove characters a-z,A-Z and ,
ltemp=Regex.Replace(ltemp, @"[a-zA-z,]","");
//replace the + sign and replace it with 00
ltemp=Regex.Replace(ltemp, @"[+]",lreplaceplus);
// removes the /,(,),-,\r and \n signs or escapechars respectivly
ltemp=Regex.Replace(ltemp, @"[/()\-\r\n ]","");
After this my string looks like this:
. 1: 0012234567890:002345622562
Well now I do want to extract the 0012234567890 and 002345622562 in two seperate fields. Well I will take care of this later. At the moment I was trying to find out, what a regular expression has to look
1) removing the string in the beginning (meaning ". 1:") or any similar strings which might appear somewhere inbetween (meaning strings like this instead of just the ":"
2) extracting the first number (0012234567890) and the starting over at the next one, meaning I do want to do a loop similar to
while string not empty
parse it with regular expressions
store an extracted number in an array to collect them all
This means my aim is to get the following (explained with the string above)
stringarray[1]=0012234567890
stringarray[2]=002345622562
stringarray[3]= ......
If you might have wondered, yes the string above is a contact item of Outlook being an array of strings or a string respectively. And my aim is to pares this string, eliminating everything that's no (telephone)number and copying them in an array collecting the numbers in this string for furter use.
But well, as I described above I was able to eliminate almost everything except the numbers, but I was not able to remove the "separationstring" (the ". 1:" in the example above) and split the numbers apart.
Does anyone of you know any solution what my regular expression has to look like to solve my problem (because I guess an regular expression is easier, because otherwise my array would contain an empty field, if I split it bevor parsing it, e.g. if it was only text and no number).
Another solution which I was thinking about was to split the preparsed string, place it into the array and do the final parsing in accessing the arrayfields instead of the local string variable.
But at the moment I do not know which might be easier or if my solution, which I did so far, is already complicating the whole thing.
Thanks!
Stephan.
|
|
|
|
|
If the phone numbers are always in the format of your example, the following should work:
<br />
string s = @"Winter, John\r\nBusinessnum. 1: +12 (23) 4567890\r\nMobile 1: +23 (456) 22562";<br />
Match m = Regex.Match(s, @"\+(\d+)\s*\((\d+)\)\s*(\d+)");<br />
while (m.Success) <br />
{<br />
Console.WriteLine(m.Groups[1].Value + m.Groups[2].Value + m.Groups[3].Value);<br />
m = m.NextMatch();<br />
}<br />
Output:
12234567890
2345622562
-Bitwise
|
|
|
|
|
Thanks for the example!
I tried to "copy" the result into a TextBox.Text instead of the Console.Writeln, but there was no result displayed.
Well actually when I will start parsing the string I do not know what it will look like! The string above is just an example!
It could even look like this:
Winter, John\r\nMobile 1: +23 (456) 22562\r\nMobile 2: +23 (456) 22563
besides I have to replace the "+" by a predifined string, which finally should be selectable in the Options. At the moment I do want to replace this by "00". And another change which might effect the example: My parsing should be able to parse the string no matter if it's fieldnames are German, English, French or whatever, but as far as I understood, this does not matter.
Well I guess I have to adapt the algortihm above so it also works with
Winter, John\r\nMobile 1: +23(456) 22562
meaning it should work with no matter how many telephonenumbers might be in the string. That's why I didn't try to use a "kind of fixed string" like yours. But maybe it will work too.
My problem actually is I do not have to just display the numbers on screen, I do have to save them somewhere. Because if the string which has to be parsed just contains one number, than it's the number the user (of my proggy) will work on with. But if there are more than one, I have to create a kind of popup for the user choosing one of the numbers. So I have to store them in a kind of array, because as I mentioned earlier I do not know how many numbers are in the string when starting to parse. In your example I do throw the string away after displaying, but well, I have to save it. Maybe that's a little more difficult, because it didn't work replacing Console.Writeln by TextBox.Text and doing a cast to string.
Stephan.
|
|
|
|
|
Anyone know how i can change the font size on a SysListView32?
I currently have the hwnd of the window and have tried using the following statements:
System.Drawing.Font f = new System.Drawing.Font("Arial",20);
SendMessage(hwnd,WM_SETFONT,0,f.ToHfont());
Any Sugestions?
Thanks in advance
|
|
|
|
|
Dave@KeySpell wrote:
Any Sugestions?
This works for me:
private int WM_SETFONT = 0x0030;
[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, int Msg,
IntPtr wParam, bool lParam);
Font f = new Font("Arial Black", 12);
IntPtr hFont = f.ToHfont();
SendMessage(view.Handle, WM_SETFONT, hFont, true);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks very much Nick
It works a treat, I was just using the wrong overload SendMessage.
Dave@KeySpell
|
|
|
|
|
MSN Messenger uses a SysListView32, you should send that code to it. That would be intersting...
/\ |_ E X E GG
|
|
|
|
|
How we make changes(color, font, add, remove etc. of one or more items) in a richTextBox without flickering ?
|
|
|
|
|
I found THE PERFECT SOLUTION at :
http://www.theimagingsourceforums.com/showthread.php?threadid=316120
|
|
|
|
|
I am a newbie in C#, could anybody help me do it! Thanks a lot!
#include<stdio.h>
#include<math.h>
#define BUFFERSIZE 0x100
FILE *fp1,*fp2,*fp3,*fp4;
main(int argc,char*argv[] )
{long timer[20];
int i,kl,kkl,n,vsp;
float vsp1,ps1,bn1,vsp2,ps2,bn2,vsp3,ps3,bn3;
char *dats=".dat";
char buffer[128],f,buff[100],newname[30],newaa[20],time[10];
if(argc!=4)
{ printf("you forgot to enter a filename\n");
exit(0);
}
if((fp1=fopen("zd8bxxx.ddd","wb+"))==NULL)
{ printf("input file open file\n");
exit(0);
}
if((fp2=fopen(argv[2],"ab"))==NULL)
{ printf("output1 file open file\n");
exit(0);
}
if((fp3=fopen(argv[3],"ab"))==NULL)
{ printf("output2 file open file\n");
exit(0);
}
fread(&time,sizeof(char),8,fp1);
for(i=2;i<8;i++)
newname[i-1]=time[i];
newname[0]='d';
newname[7]=0;
for(i=0;i<7;i++)
newaa[i]=newname[i+3];
strcat(newname,dats);
if((fp4=fopen(newname,"wb"))==NULL)
{ printf("output file open fail\n");
exit(0);
}
fread(&timer,sizeof(long int),14,fp1);
for(i=0;i<24;i++)
{
fread(&buffer,sizeof(char),48,fp1);
vsp=ff(buffer[0],buffer[1],buffer[2],buffer[3]);
vsp1=(float)vsp/10;
ps1=(float)ff(buffer[4],buffer[5],buffer[6],buffer[7])/100;
fprintf(fp2,"%4s%5d%8.1f%7.2f\n",newaa,i,vsp1,ps1);
fprintf(fp4,"%4s%5d%8.1f%7.2f\n" ,newaa,i,vsp1,ps1);
}
fread(&buff,sizeof(char),48,fp1);
fread(&buff,sizeof(char),48,fp1);
vsp1=(float)ff(buff[0],buff[1],buff[2],buff[3])/10;
ps1=(float)ff(buff[4],buff[5],buff[6],buff[7])/100;
bn1=(float)ff(buff[8],buff[9],buff[10],buff[11])/100;
fprintf(fp3,"%6s%8.1f%8.2f%8.2f\n",
newaa,vsp1,ps1,bn1);
fclose(fp1);
fclose(fp2);
fclose(fp3);
fclose(fp4);
}
|
|
|
|
|