|
Hello I am making http calls from my C# desktop application.
I want to use Gzip compression while posting data and also deserialize the server response that is in GZip compression. Any help for that.
|
|
|
|
|
Try using the GZipStream class.
|
|
|
|
|
Do not forget to modify the content type of the http header in order to correctly handle it on the server side or client side.
|
|
|
|
|
Is it possible to get UNMANAGED stack trace in c#. Here is what I am trying to do:
I have a COM written in c#. I have VB6/C++ code calling this COM component. In the COM component, I want to be able to find out who called the COM function(s).
I have tried using the System.Diagnostics.StackTrace class, but that seems to only return MANAGED stack traces.
For Example:
COM Interface/Implementation
<pre>
[Guid(###)]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ISkel
{
[DispId(1)]
void DoSomething(int id);
}
[Guid(###)]
[ClassInterface(ClassInterfaceType.None)]
public class Skel : ISkel
{
public void DoSomething(int id)
{
...
}
}
</pre>
VB (VBProject Name = VBProject1)
<pre>
Private Sub Command1_Click()
dim s as new Skel
s.DoSomething(1)
End Sub
</pre>
From the C# code, I want to get a value indication that the calling project (VBProject1) and the method (Command1_Click())
Any ideas/suggestions?
Thanks in advance.
|
|
|
|
|
AFAICT, the StackTrace will only work with managed calls. I can't find any method of getting the unmanaged stack trace from managed code.
|
|
|
|
|
You cannot view unmanaged code in the stack trace - you could use the disassembly window, however.
|
|
|
|
|
I have created a dump of an excel addin and I'm having trouble loading it. When simply opening it with Visual Studio 2008 it gets to run after it loads the symbols but the "go to source code" button is grayed out.
Second time I run it it throws the no source code error however I have specified the source code directory.
I'm afraid that being an Excel addon I also need to have the excel sources?
|
|
|
|
|
Hi,
I was wondering is there some kind of addon for Visual Studio that lets you develop excel sheets or addons with C#.
Anyone have any links?
Thank you in advance
Regards,
Christian Pace
|
|
|
|
|
|
|
Sir I am Creatign Excel Addin for sms But i cont succsess please helop me...
like smscontry.com
|
|
|
|
|
Noone is going to be able to help you becuase you haven't asked a question nor specified anything about the add-in you're writing, the problem you're having, the code you've written, ..., no nothing. So, how is annyone supposed to help you solve your problem?
|
|
|
|
|
I made a simple transaction using ADO.NET:
SqlTransaction tn;<br />
SqlConnection cn = new SqlConnection();<br />
<br />
try<br />
{<br />
if (cn.State != ConnectionState.Open)<br />
{<br />
cn.Open();<br />
}<br />
}<br />
catch (SqlException ex)<br />
{<br />
Debug.Assert(false, ex.ToString());<br />
}<br />
<br />
tn = cn.BeginTransaction();<br />
SqlCommand cmd2 = ...
This works nicely. However I would like to make some update statement in other database - 'Database2'. Is it possible to do that inside one ADO.NET transaction? If so, how?
Thank you for help in advance.
|
|
|
|
|
Delete your prior message before someone responds to it.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
dont make rubish on the forum
|
|
|
|
|
Yoyosch wrote: dont make rubish on the forum
Look, retard... You posted the same message twice. I wanted you to delete your first message before someone replied to it because once it's replied to, it can't be deleted. Now, someone's replied to it and it has become the "rubbish" that you are so clearly averse to.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
You can include your two queries into a TransactionScope.
The framework will automatically create a distribute transaction between the two databases.
Keep in mind that your infrastructure must be configured to allow so (see Configuring MS DTC).
|
|
|
|
|
Thank you very much for help
|
|
|
|
|
I never knew that. I have a few places where that may be beneficial.
|
|
|
|
|
I implementd CLR stored procedure on 'Database1'. I would like to perform some UPDATE statements inside this CLR stored procedure in 'Database2'. Is is possible? If so, then how?
|
|
|
|
|
Ask this in the General Database forum.
|
|
|
|
|
How can I email a web page. My html attachments come as attachment (hope I make sense!).
In one article they use ScreenScrapeHtml but I can get it, I have imported Sytem.Net and IO as suggested but still cant get ScreenScrapeHtml.
I am using .net 2.0 vs 2005.
Thanking you in advance.
I remain joe!
"Only the best"
|
|
|
|
|
When you do a request for a web page (in your c# code), the response is a string of HTML. Simply set the email type to HTML, and use the response text as the body of the email.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Thanks, it's working.
This Tutorial[^] helps a lot.
Thanks once more for your response.
I remain joe!
"Only the best"
|
|
|
|
|
Hi
Im having trouble with a imported function called ICCompress. Im not sure if I have transled the function properly can someone help me?
Native
typedef struct tagBITMAPINFOHEADER {
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER;
DWORD ICCompress(
HIC hic,
DWORD dwFlags,
LPBITMAPINFOHEADER lpbiOutput,
LPVOID lpData,
LPBITMAPINFOHEADER lpbiInput,
LPVOID lpBits,
LPDWORD lpckid,
LPDWORD lpdwFlags,
LONG lFrameNum,
DWORD dwFrameSize,
DWORD dwQuality,
LPBITMAPINFOHEADER lpbiPrev,
LPVOID lpPrev
);
C# code
[StructLayoutAttribute(LayoutKind.Sequential)]
public struct BITMAPINFOHEADER
{
public uint biSize;
public int biWidth;
public int biHeight;
public ushort biPlanes;
public ushort biBitCount;
public uint biCompression;
public uint biSizeImage;
public int biXPelsPerMeter;
public int biYPelsPerMeter;
public uint biClrUsed;
public uint biClrImportant;
}
[DllImport("MSVFW32.dll")]
public static extern int ICCompress(
IntPtr hic,
UInt32 dwFlags,
ref BITMAPINFOHEADER lpbiOutput,
IntPtr lpData,
ref BITMAPINFOHEADER lpbiInput,
IntPtr lpBits,
out UInt32 lpckid,
out UInt32 lpdwFlags,
int lFrameNum,
UInt32 dwFrameSize,
UInt32 dwQuality,
IntPtr lpbiPrev,
IntPtr lpPrev
);
The code that calls ICCompress is
compressorHnd = Avi.ICOpen(Avi.FOURCC.ICTYPE_VIDEO, Avi.FOURCC.mmioFOURCC('L','E','A','D'), Avi.ICMODE.ICMODE_COMPRESS);
outbi = new Avi.BITMAPINFOHEADER();
inbi = new Avi.BITMAPINFOHEADER();
outbi.biSize = Convert.ToUInt32(Marshal.SizeOf(outbi));
outbi.biBitCount = 24;
outbi.biWidth = 640;
outbi.biHeight = 480;
outbi.biPlanes = 1;
outbi.biBitCount = 24;
outbi.biCompression = 0;
inbi.biSize = Convert.ToUInt32(Marshal.SizeOf(inbi));
inbi.biWidth = width;
inbi.biHeight = height;
inbi.biPlanes = 1;
inbi.biBitCount = Convert.ToUInt16(countBitsPerPixel);
byte[] outImgData = new byte[(outbi.biHeight * outbi.biWidth * (outbi.biBitCount / 8))];
GCHandle outImgHnd = GCHandle.Alloc(outImgData, GCHandleType.Pinned);
UInt32 lpckid = new Int32();
UInt32 lpdwflags = new Int32();
int i = Avi.ICCompress(compressorHnd,
0,
ref outbi,
outImgHnd.AddrOfPinnedObject(),
ref inbi,
inBmpDat.Scan0,
out lpckid,
out lpdwflags,
frameNum,
0,
5000,
IntPtr.Zero,
IntPtr.Zero);
So the ICCompress call returns -2 and there is no data in outImgData. Does anyone know where I have gone wrong?
|
|
|
|