thanks allot for your reply. I was checking out the link u posted, but it seems like thats for controls/ui operations only. Now im still looking for other sollutions :sigh: thanks again
OptiPlex
Posts
-
Threadpool help [modified] -
Threadpool help [modified]Hello, Im trying to make a multithreaded proxy tester/scanner. http://i36.tinypic.com/2m5jllf.jpg[^] here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;using System.Threading;
namespace WebProxyTest
{
public partial class Main : Form
{
public Main()
{
InitializeComponent();
}private void Main\_Load(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; } private void btnStart\_Click(object sender, EventArgs e) { for(int i = 0; i < lstProxies.Items.Count; i++){ string proxy = lstProxies.Items\[i\].ToString(); string\[\] proxyinfo = proxy.Split(':'); string proxyhost = proxyinfo\[0\]; int proxyport = Convert.ToInt32(proxyinfo\[1\]); WebProxyTest test = new WebProxyTest(proxyhost, proxyport, "http://google.com/"); ThreadPool.SetMaxThreads(10, 2); ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessProxies), test); } } private void ProcessProxies(object state){ WebProxyTest test = state as WebProxyTest; test.TestProxy(); //lstProxies.Items.Add("Result : " + test.ProxyResult); lstResults.Items.Add("Result: " + test.ProxyResult); } }
}
using System;
using System.Collections.Generic;
using System.Text;using System.IO;
using System.Web;
using System.Net;namespace WebProxyTest
{
class WebProxyTest
{
private string proxyhost;
private int proxyport;
private string url;private string proxy\_result = "none"; public string ProxyResult { get { return proxy\_result; } set { proxy\_result = value; } } public WebProxyTest(string proxyhost, int proxyport, string url) { this.proxyhost = proxyhost; this.proxyport = proxyport; this.url = url; } public void TestProxy() { try { WebProxy proxy = new WebProxy
-
C# struct and NuSOAP(php)Thank you sir Parsing XML/String, I can live with that. Thanks again, - opx
-
C# struct and NuSOAP(php)Hello Im trying to build a client in c# that talks with some remote (php)server with SOAP using the NuSOAP library. Here im using a struct/object that will containt the user info of some user:
public struct UserProfile {
public string username;
public string password;
public string email;
public string site;
public string signature;
public int age;
public int points;And this is the PHP Code:
server->wsdl->addComplexType(
'UserProfile',
'complexType',
'struct',
'all',
'',
array(
'username' => array('name' => 'username', 'type' => 'xsd:string'),
'password' => array('name' => 'password', 'type' => 'xsd:string'),
'email' => array('name' => 'email', 'type' => 'xsd:string'),
'site' => array('name' => 'site', 'type' => 'xsd:string'),
'signature' => array('name' => 'signature', 'type' => 'xsd:string'),
'age' => array('name' => 'age', 'type' => 'xsd:int'),
'points' => array('name' => 'username', 'type' => 'xsd:int'),
)
);$server->wsdl->addComplexType(
'UserProfileArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:UserProfile[]')),
'tns:UserProfile'
);$server->register("getUserProfile",
array(),
array('return' => 'tns:UserProfileArray'),
$namespace,
false,
'rpc',
false,
'Get the user profile object'
);function getUserProfile(){
$profile['username'] = "user";
$profile['password'] = "pass";
$profile['email'] = "usern@ame";
$profile['site'] = "u.com";
$profile['signature'] = "usucsdckme";
$profile['age'] = 111;
$profile['points'] = time() / 2444;return $profile;
}
Now I already have a working login function, and I want to get the info about the logged in user but I dont know howto obtain these. This is what im using to get the userinfo:
string user = txtUser.Text; string pass = txtPass.Text; SimpleService.SimpleService service = new SimpleService.SimpleService(); if(service.login(user, pass)){ //logged in } SoapApp.SimpleService.UserProfile\[\] user = service.getUserProfile(); // THIS LINE GIVES ME AN EXCEPTION MessageBox.Show(user\[0\].username + "--" + user\[0\].p
-
Dll LibMain Function?Okay, I got the answer for my question now. Thank you all!
-
Dll LibMain Function?I wanted to make a Dll like c but in c#, so yes a native Dll. I want it to be injected into a process, and not called. But I guess C# is not really a good language for this, right? Thanks for your replies - opx
-
Dll LibMain Function?Thank you You see, im using a program called Winject to inject the dll. I guess that really does it all. When it gets injected, it automatically calls the LibMain function and executes the code in my Dll. But when I try to inject the dll I made in c#, it doesnt get executed, this is the code im using:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;namespace MyDll
{
public class clsMain
{
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string lpFileName);\[DllImport("user32.dll")\] public static extern int MessageBox(int hwnd, string lpText, string lpTitle, int style); // LibMain here... public void LibMain(IntPtr hInstance, int fdwReason, int reserved) { MessageBox(0, "Injected from C#", "C# hello world", 0); } }
}
Thank you very much again! - opx
-
Dll LibMain Function?Thank you for your kind reply, but I still dont get it. Im not really familiar with LoadLibrary... This is what I got so far
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;namespace MyDll
{
public class clsMain
{
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string lpFileName);// LibMain here... }
}
-
Dll LibMain Function?Hey I want to inject DLL made in C# into an Application. Ive been looking for this for a long time, but still cant find the answer. In C you would use it like this
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// attach to process
MessageBox(0, "Test", "Test", MB_OK);
break;case DLL\_PROCESS\_DETACH: // detach from process break; case DLL\_THREAD\_ATTACH: // attach to thread break; case DLL\_THREAD\_DETACH: // detach from thread break; } return TRUE; // succesful
}
Is there a way to do this in C#? Like when I inject it, that it also shows the MessageBox at successfull injection? Thanks in Advance - opx
-
Modify HtmlDocumentHey, thanks allot for your reply, it worked exactly as I wanted! But anyway, when I reopened c#, it gave me an error on "new Htmldocument();" but il figure that out. Thanks again!
-
Modify HtmlDocumentHey Is it possible to use HtmlDocument, withouth the WebBrowser control? As you see, when the document is loaded in your WebBrowser control, you can fetch some html elements such as links, images, etc. But I want to set my own html in the HtmlDocument, and fetch the elements I want, withouth first using the WebBrowser to navigate to an url. My Idea is something like this:
HtmlDocument doc = webBrowser1.Document; for (int i = 0; i < doc.GetElementsByTagName("a").Count; i++) { string url = doc.GetElementsByTagName("a")\[i\].GetAttribute("href"); }
But withouth have to use the WebBrowser control, and just set the html like this
doc.html = "<a href='link'>link ...</a>"
Please help me :sigh: Thanks in Advance - opx