|
shambho wrote:
// User has to be saved prior to this step
user.Invoke("SetPassword", new string[] {"password1"} );
Your should be passing an Object[] instead:
Object[] pswd = new Object[]{"password1"};
However by default all code that executes from the local intranet or Internet zones is partially trusted and full trust is required. You might check into placing the AllowPartiallyTrustedCallers attribute on your code.
- Nick Parker My Blog | My Articles
|
|
|
|
|
hi friend,
actually i am not using
user.Invoke("SetPassword", new string[] {"password1"} );
but
user.Invoke("SetPassword", new object[] {"password1"} );
By mistake while i was trying different alternative you got this piece of code. even with object its giving the same error
|
|
|
|
|
Hello,
I'm working on a Mapi Agent using C#.
Everything works fine despite the fact I've to commit the nice Outlook Message
which is shown after Installing the Security Update for Microsoft if you try to send mails from other interfaces.
See the Knowledge Base Articel :
http://support.microsoft.com/default.aspx?scid=kb;en-us;263073
WD2000: Warning Message: "A Program Is Trying to Access ..." When You Send Mail Merge to E-mail After You Apply Outlook Security Update
and Information for Developers :
OL98: Developer Information About the Outlook E-mail Security Update
http://support.microsoft.com/default.aspx?scid=kb;EN-US;262700
The Problem is that I've to commit this windows automatically - because this agent should run by itself.
I already find out that I've to use the user32.dll with their functions FindWindow and SendMessage,
and that you have to use Spy++ to find out the WindowClass and the wParam and lParam in hex formate.
Indeed I'm right now at the point that I can find the window, and can send messages - WM_Command.
But the wNotifyCode is wrong, I've to send a BN_Clicked WM_Command but with my routine I send a Code 0 (send from a menue) to the Window
although I got the right hex codes.
So now my question : how can I send a BN_Clicked Message to the window?
Is there any other opportunity to commit the windows with "Yes"?
I'm grateful for any advice.
Here are some code snippets :
----------------------------------------------------------------------------------
The class for the user32.dll Import and their functions :
----------------------------------------------------------------------------------
public class Win32
{
public const int WM_COMMAND = 0x111;
[DllImport("User32.dll")]
public static extern int FindWindow(string strClassName, string strWindowName);
[DllImport("User32.dll")]
public static extern int FindWindowEx(int hwndParent, int hwndChildAfter, string strClassName, string strWindowName);
[DllImport("User32.dll")]
public static extern Int32 SendMessage(
int hWnd, // handle to destination window
int Msg, // message
int wParam, // first message parameter
[MarshalAs(UnmanagedType.LPStr)] string lParam); // second message parameter
[DllImport("User32.dll")]
public static extern Int32 SendMessage(
int hWnd, // handle to destination window
int Msg, // message
int wParam, // first message parameter
int lParam); // second message parameter
}
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
The Main Routine with the calling routines :
----------------------------------------------------------------------------------
System.Int32 iHandle
// Finding the window :
iHandle = Win32.FindWindow("#32770", "Microsoft Office Outlook");
// Send a Message
Win32.SendMessage(iHandle, Win32.WM_COMMAND, 0x000012A6, 0)
----------------------------------------------------------------------------------
********************
There are only ten types of people in the world.
Those who understandy binary and those who do not
|
|
|
|
|
I use A data grid which has a datasource and a datamember is connected
to an access database.
I make update to the datagrid by using:
oledbdataAdapter1.update(dataset11.tables[0]) ;
where user make all he wants then press a button to execute the previous
line of code.
the problem is the an exception may ocuur:
"Concurrency Violation: the update command affected 0 rtecords"
I don't know what is the reason of this exception as it appears rarelly.
|
|
|
|
|
check if there are any foreign key relations existing.
Bhaskara
|
|
|
|
|
Hello,
i have developed a web service where the client sends to the server a signed xml document signed with "Infopath". When the server receives the document it is impossible fot him to valiadate the signatures. Here is my code:
(doc is a XmlDocument)
<br />
XmlNodeList nodeList = doc.GetElementsByTagName("Signature");<br />
SignedXml[] signatures = new SignedXml[nodeList.Count];<br />
<br />
for(int i = 0; i < nodeList.Count; i++)<br />
{ <br />
signatures[i] = new SignedXml();<br />
signatures[i].LoadXml((XmlElement)nodeList[i]);<br />
if (!signatures[i].CheckSignature())<br />
validSignatures--;<br />
}<br />
The xml document has been signed with a valid X509 certificate.
thank you for your help!
|
|
|
|
|
I need to print some invoices,Quality control forms etc. I have a windows application. What is a preffered way to print forms in c#. Jodoveepn seems good but i have a problen that a windows form has a max height of 876 which does not fill all of and A4 page(letter)I need the user to clck a button and the relevant forms are printed automatically without previewing. Basically i am not sure on the best approach for printing forms in a c# windows application?
|
|
|
|
|
Hi,
I have different user controls associated with the tree nodes using 'tag' property, I want to display the user controls in the empty area in the form that contains the tree view control. Can any one please guide me how to access the user control using the tag property in the AfterSelect event of the tree view control?
|
|
|
|
|
You can cast the sender as a TreeNode object and then access it's properties directly. This will allow you to see what the Tag value is.
private void treeview1_AfterSelect(object sender, TreeViewEventArgs e)
{
TreeNode node = sender as TreeNode;
if(node != null)
{
}
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
I have done this, but still not able to access the original user control.
Let me explain again what I am doing
private void LinkUserControls()
{
treeview1.Nodes[0].Tag = _myUserControl;
}
private void treeview1_AfterSelect(object sender, TreeViewEventArgs e)
{
TreeNode node = e.Node;
if(node != null)
{
// i would like to make _myUserControl visible here.
// like
_myUserControl.visible = true;
_myUserControl.location = new System.Drawing.Point(50,50)
}
}
please guide
|
|
|
|
|
got the solution it worked as follows
private void treeview1_AfterSelect(object sender, TreeViewEventArgs e)
{
if(e.Node != null)
{
UserControl uc = (UserControl) e.Node.Tag;
uc.Visible = true;
uc.BringToFront();
uc.Location = new Point(225, 240);
}
}
|
|
|
|
|
How can I get a variable pointer (as IntPtr) ?
I am trying to compare between two objects, the objects are not the same but they could be from some place ...
Example - let say we have two classes one derived from another ...
public class A
{
  protected h=0;
  public virtual func()
  {
   h=0;
  }
}
public class B:A
{
  public override func()
  {
   h=1;
  }
}
Now ... I'am creating the objects ...
obj1=Activator.CreateInstance(t1); //Type t1; class A
c.Invoke(obj1,null); //ConstructorInfo c; getting constructor from class A
the same with the other class...
obj1=Activator.CreateInstance(t2); //Type t2; class B
c.Invoke(obj2,null); //ConstructorInfo c; getting constructor from class B
From this point you can see in the debugger obj1,obj2 (with the variable h=0 in both)
Now I'am invoking my function...
//MethodInfo m1,m2; getting my virtual AND override functions each from it's class ... and after that running functions , with null as parametter...
object []parametersForFunction=new object[m1.GetParameters().Length];
//m1 or m2 doesn't matter they have the same parameters... virtual,override
m1.Invoke(obj1,parametersForFunction);
m2.Invoke(obj2,parametersForFunction);
I can't check "h" with the GetFields() couse its not public()..
My problem is here...
Now if wee go back to the debugger we can see that in obj1.h=0 and obj2.h=1
Somthing like this
obj1.A.h=0
obj2.B.A.h=1
My idea was to try the Marshal.ReadIntPtr(IntPtr,offset) so I can read obj2 after some offset, So I needed my variable Address. (somehow even in unsafe we cant do object *p=obj1; on objetcs...)
I tried Marshel.ReadByte and it's not working cause my object type could be anything...
Anyone have some idea ???
Thanks
|
|
|
|
|
You can use BindingFlags to get non-public members from an object.
Type.GetField(name, BindingFlags.GetField | BindingFlags.NonPublic)
|
|
|
|
|
Yes, but I still wanted to do this by comparing objects.
I want to know how to get a variable pointer as IntPtr and how to read from unknown type object from a specific place.
|
|
|
|
|
I don't think the framework would allow you to do that. You could mess up all the class info stuff including vtable. Plus you would have to know internal layout of the class data structure, and that might be system dependend (might work differently on mono or .netgnu)
You can download rotor and see how they lay it out.
If you try to get address of any managed type, you'll get error:
Cannot take the address or size of a variable of a managed type.
|
|
|
|
|
Hi Friends
I want to make a spyware. Please suggest me how the available spywares work
please let me know about their functionalities.
Where they check for the files, how they know which program is shareware etc.
Any pointers or help is appreciated.
Thanx a lot in advance
Naveen
|
|
|
|
|
softp_vc wrote:
how the available spywares work
From what I've seen of them. It is not something I wish to discuss.
softp_vc wrote:
please let me know about their functionalities
The two big functions they perform are: (1) They irritate users. (2) They steal information.
softp_vc wrote:
Where they check for the files
Where would you normally check for files? The filesystem perhaps.
softp_vc wrote:
Any pointers or help is appreciated
int* p;
Not so sure about the help though. I don't want more spyware out there.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Colin Angus Mackay wrote:
int* p;
ROFL
Kev Pearman MCP
|
|
|
|
|
Sorry if i meant wrong by my question.
Actually i want to make a utility that shows that which freeware S/Ws i have downloaded in my system. i dont want to spy on others computer.
i just want to know that which useless or harmful S/W in my conputer is present so that i can remove them .
Hope i am clear about my thinking and intentions.
Please if anybody has any idea do let me know.
Regards,
Naveen
|
|
|
|
|
I can't help you with creating something to search for spyware because i wouldn't know where to start but if all you want to do is find out whats on your PC then try downloading SpyBot, it's free and worked well for me.
Kev Pearman MCP
|
|
|
|
|
Yes i have already used the spybot but i cant get the idea of how it works.
If any body knows please let me know.
I need the information urgently.
Thanx
Naveen
|
|
|
|
|
softp_vc wrote:
Any pointers or help is appreciated.
No one is going to help you write spyware, besides C# wouldn't be best suited for this anyway.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanx for ur prompt reply Nick.
Actually i want to make a utlity like spybot . Will u help me in this.
If C# is not good then in which technology i should write.
Suggest
Naveen
|
|
|
|
|
softp_vc wrote:
If C# is not good then in which technology i should write.
I told you, no one is going to help you with something like this. This is a C# forum, if you have a specific C# question please feel free to ask it here.
- Nick Parker My Blog | My Articles
|
|
|
|
|
There are so many different registry keys and values, and so many different files, you'll find it VERY difficult to write your own software without doing a ton of research on the spybots themselves. You can't write an application that will find any and all spyware from the first annoyances that came out to the new ones noone has thought of yet. Your app has to be able to look for signatures, just like virus scanning software does, and must be able to read those signatures from a file. The signatures would include registry information, filename information, data on the procedures the spyware uses, like renaming and replacing of files, even signature information to find spy code in other files.
But, you'll have to do a mountain of research on spyware first. No two spyware's work the exact same way and just searching for simple registry values and filenames will not do you any good. Your software must be able to adapt to the ever techniques of spyware.
Why don't you ask the people who wrote SpyBot...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|