Showing posts with label dotnet. Show all posts
Showing posts with label dotnet. Show all posts


I am using third part DLL to configure something:), I don’t have the code/rights to change that third party dll, and I am getting PInvoke error , when I am importing the dll like below:

[DllImport("XXXXXX.dll")]
public unsafe static extern BusinessObject configure(int iConnectTimeout_seconds, int iReadTimeout_seconds,
char[] sProtocol, object pLoggingStream, char[] sUserAgent, char** sError );


And the error what I was getting is :
“A call to PInvoke function 'sathish!CDLL.Cfunction::export' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.”

I tried all the possible solution mentioned in the Internet. Unfortunately Nothing is working out for me.

Fortunately
once change the target framework to .NET 4 to .NET 3.5 it start working:)

Speed up solution loading time in Visual Studio 2005


Your Visual studio taking long time load your project ?

just delete content of following folder (and keep deleting everyday…)

C:\Documents and Settings\\Local Settings\Application Data\Microsoft\WebsiteCache

More information: http://groups.google.com/group/chromium-dev/browse_thread/thread/b181f59d9d445fa1?pli=1

http://robertbogley.wordpress.com/2007/09/19/how-to-speed-up-loading-time-in-microsoft-visual-studionet-2005-projects/


Killing process thread in dot net

As of i know it is not possible to kill process thread directly in dot-net.
example code:
Process p = Process.GetCurrentProcess();
foreach (ProcessThread t in p.Threads)
{
if (t.Id == 1111)
// u cant abort this tread, abort method wont available for this thread
}

So how can i kill this thread? is it possible? Yes i did this using win32 programming

My Code: i declare below codes.
[DllImport("Kernel32.dll")]
public static extern Int32 OpenThread(Int32 dwDesiredAccess, Int32 bInheritHandle, Int32 dwThreadId);
[DllImport("Kernel32.dll")]
public static extern Int32 TerminateThread(Int32 hThread, Int32 dwExitCode);

So that i call these funaction to kill any thread :) like ,
Int32 threadHandle = OpenThread(0x1F03FF, 1, t.Id);
TerminateThread(threadHandle, 0);

Please let me know if you know any other method .

generating the code using xsd

path/xsd .exe FilePath.xsd /classes /namespace:

example :

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\xsd.exe" "Merlot XMLSchema.xsd" /classes /namespace:RightFax.Server.Archive.Utils.Resources