|
Using VS2005...
I've got an app that's uses up a HttpListener object. When a request is detected, a file is streamed to the requesting application. When the streaming starts, a tmp file is being created (not by my code), in the Windows\Temp folder. Is it possible to prevent this tmp file from being created?
"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." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: When the streaming starts, a tmp file is being created
On which end - client or server?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The (desktop) app is streaming the file to itself (actuallyn to a SWF resource in the app) via an HttpListener, so it's all on the client side. I personally think it's an automatic Windows thing that happens whenever a file is sent via HTTP.
"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." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: so it's all on the client side.
I meant the client or server side of the HTTP connection...
doesn't matter if it's in the same app or not. The listener
end being the server and the requesting end being the client.
Is it a cache file? Is it a copy of the file being sent?
Does using the cache control headers have any effect?
WebHeaderCollection ^headers = request->Headers;
headers->Set(HttpRequestHeader::CacheControl, "no-cache, no-store, no-transform");
headers->Set(HttpRequestHeader::Pragma, "no-cache");
...send request...
WebHeaderCollection ^headers = response->Headers;
headers->Set(HttpResponseHeader::CacheControl, "private, no-cache, no-store, no-transform");
headers->Set(HttpResponseHeader::Pragma, "no-cache");
...send response...
You're using HttpListener on the server end....what are you using
on the client end?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi,everyone~
I have searched the answer from internet for long time but can't find similar situation.
I want to call a system tray process from my winform and double click it.
Now I have got the system tray tool bar handle and every tool bar button handle.
Then when I try using "IntPtr rr = SendMessage(_ToolbarWindowHandle, WM_LBUTTONDBLCLK, new IntPtr(tbButton.idCommand), new IntPtr(0))" to send db-click message to one of the tbbutton, it always point to the first button event. I think the reason of the problem should be the lastest parameter(lparam), but I don't know how to set the param.
Or any way else to solve it?
Hope anwser, thanks.
|
|
|
|
|
|
Hi,Giorgi Dalakishvili
Thank you for your reply.
I have downloaded your source code, and it must be useful to me, but I am not good at C++,
I appreciate very much if you can help me refer to C# solution
Here is my source code:
IntPtr hTray = FindWindowEx( hDesktop, IntPtr.Zero, "Shell_TrayWnd", null );
IntPtr hReBar = FindWindowEx(hTray, IntPtr.Zero, "traynotifywnd", null);
IntPtr hTask = FindWindowEx(hReBar, IntPtr.Zero, "syspager", null);
IntPtr hToolbar = FindWindowEx( hTask, IntPtr.Zero, "ToolbarWindow32", null );
UInt32 count = SendMessage( hToolbar , TB.BUTTONCOUNT, 0, 0 );
for ( int i = 0 ; i < count ; i++ )
{
TBBUTTON tbButton = new TBBUTTON();
string text = String.Empty;
IntPtr ipWindowHandle = IntPtr.Zero;
bool b = GetTBButton( hToolbar , i, ref tbButton, ref text, ref ipWindowHandle );
if ( b )
if (text.IndexOf("Windows Live") != -1)
{
IntPtr rr = SendMessage(hToolbar , WM_LBUTTONDBLCLK, new IntPtr(tbButton.idCommand), new IntPtr(0));
}
}
|
|
|
|
|
private unsafe bool GetTBButton( IntPtr hToolbar, int i, ref TBBUTTON tbButton, ref string text, ref IntPtr ipWindowHandle )
{
// One page
const int BUFFER_SIZE = 0x1000;
byte[] localBuffer = new byte[ BUFFER_SIZE ];
UInt32 processId = 0;
UInt32 threadId = User32.GetWindowThreadProcessId( hToolbar, out processId );
IntPtr hProcess = Kernel32.OpenProcess( ProcessRights.ALL_ACCESS, false, processId );
if ( hProcess == IntPtr.Zero ) { Debug.Assert( false ); return false; }
IntPtr ipRemoteBuffer = Kernel32.VirtualAllocEx(
hProcess,
IntPtr.Zero,
new UIntPtr( BUFFER_SIZE ),
MemAllocationType.COMMIT,
MemoryProtection.PAGE_READWRITE );
if ( ipRemoteBuffer == IntPtr.Zero ) { Debug.Assert( false ); return false; }
// TBButton
fixed ( TBBUTTON* pTBButton = & tbButton )
{
IntPtr ipTBButton = new IntPtr( pTBButton );
int b = ( int ) User32.SendMessage( hToolbar, TB.GETBUTTON, ( IntPtr ) i, ipRemoteBuffer );
if ( b == 0 ) { Debug.Assert( false ); return false; }
// this is fixed
Int32 dwBytesRead = 0;
IntPtr ipBytesRead = new IntPtr( & dwBytesRead );
bool b2 = Kernel32.ReadProcessMemory(
hProcess,
ipRemoteBuffer,
ipTBButton,
new UIntPtr( ( uint ) sizeof( TBBUTTON ) ),
ipBytesRead );
if ( ! b2 ) { Debug.Assert( false ); return false; }
}
// button text
fixed ( byte* pLocalBuffer = localBuffer )
{
IntPtr ipLocalBuffer = new IntPtr( pLocalBuffer );
int chars = ( int ) User32.SendMessage( hToolbar, TB.GETBUTTONTEXTW, ( IntPtr ) tbButton.idCommand, ipRemoteBuffer );
if ( chars == -1 ) { Debug.Assert( false ); return false; }
// this is fixed
Int32 dwBytesRead = 0;
IntPtr ipBytesRead = new IntPtr( & dwBytesRead );
bool b4 = Kernel32.ReadProcessMemory(
hProcess,
ipRemoteBuffer,
ipLocalBuffer,
new UIntPtr( BUFFER_SIZE ),
ipBytesRead );
if ( ! b4 ) { Debug.Assert( false ); return false; }
text = Marshal.PtrToStringUni( ipLocalBuffer, chars );
if ( text == " " ) text = String.Empty;
}
// window handle
fixed ( byte* pLocalBuffer = localBuffer )
{
IntPtr ipLocalBuffer = new IntPtr( pLocalBuffer );
// this is in the remote virtual memory space
IntPtr ipRemoteData = new IntPtr( tbButton.dwData );
// this is fixed
Int32 dwBytesRead = 0;
IntPtr ipBytesRead = new IntPtr( & dwBytesRead );
bool b4 = Kernel32.ReadProcessMemory(
hProcess,
ipRemoteData,
ipLocalBuffer,
new UIntPtr( 4 ),
ipBytesRead );
if ( ! b4 ) { Debug.Assert( false ); return false; }
if ( dwBytesRead != 4 ) { Debug.Assert( false ); return false; }
Int32 iWindowHandle = BitConverter.ToInt32( localBuffer, 0 );
if ( iWindowHandle == -1 ) { Debug.Assert( false ); }//return false; }
ipWindowHandle = new IntPtr( iWindowHandle );
}
Kernel32.VirtualFreeEx(
hProcess,
ipRemoteBuffer,
UIntPtr.Zero,
MemAllocationType.RELEASE );
Kernel32.CloseHandle( hProcess );
return true;
}
Here is the function used above, I got it from another article, waiting for help, thank you
|
|
|
|
|
Highwinyungoy wrote: I have downloaded your source code, and it must be useful to me, but I am not good at C++,
It's not my source code
You can call c++ code from your application using P/Invoke.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
can you give an advice e-book and ı am searching free (wrox professional c# 3.5 e-book) link
|
|
|
|
|
No - we don't help thieves and scumbags. Buy the book or live without it.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
money talks man if you dont have money you cant learn any thing microsoft and abd mind ı am form free world not capitalist slave one (?scumbags?) ı just ask no need this word you became mvp and still dont know how to talk to people mvp is not most valueable person on the planet man mvp is just regular guy has equal right everyone else
|
|
|
|
|
Every thief has an excuse. I taught myself when I had little money. I bought books as I could afford them and worked hard to pay my way.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Rzasgal wrote: if you dont have money you cant learn any thing
That is incorrect. If you can access the internet, which you have demonstrated that you can, then there are many resources available to you without you needing to spend any money.
|
|
|
|
|
Rzasgal wrote: money talks man if you dont have money you cant learn any thing microsoft
Microsoft has the incentives if you look in the right places. Ex: Students have access to the DreamSpark program.
Rzasgal wrote: just ask no need this word you became mvp and still dont know how to talk to people mvp is not most valueable person on the planet man mvp is just regular guy has equal right everyone else
Enough ranting, and since you say that an MVP is just another regular guy than he has full right to point things out to other members.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
even tough ı want a book to learn something ı dont steal money or inoccent people life or food even ı am starve, ı dont kill people for just oil or comfort or anything else, ıt could be free ebooks no matter what it is
|
|
|
|
|
You are stealing from an author, a group of people who are paid very little for their work. A thief is a thief. There is no excuse.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
your comfortable life are provided by big countries steal from another little countries natural resource and you say to me ı am thief you are all thief yes you are working yes you are paying but say nothing happening this during events
|
|
|
|
|
abruti, t'as rien compris a la vie, pauvre naze !
|
|
|
|
|
What a pile of BS. more excuses. you are a thief. The end.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian Graus wrote: You are stealing from an author
True - I've been thinking of writing (or at least contributing) to a book. It is people like this that put me off. I'll probably just continue in my haphazard way on my blog and any article I write (I've got a two or three article I really need to finish too).... Sorry... I seem to have wandered off track.......
|
|
|
|
|
search away. bittorrent may help you.
|
|
|
|
|
So, you're a dirtbag, too ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
yes this word suit for you thanks for your kindness and politeness
|
|
|
|
|
I am polite to people who deserve it, and rude to people who deserve that.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|