|
As an alternative to Fiddler, Squid[^] is a well-respected web proxy that (may be) easy to install and configure. It supports authentication (including HTTP Basic and Windows NTLM), so would probably make a good simulation of your customer's scenario (hey - they might use Squid, in which case you could use their configuration to guide you possibly?).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
ok, so i have a dialog, which i'll call CMainDlg.
CMainDlg has a regular CSplitterWnd with two columns.
the splitter has two CWnd derived objects in it, which i'll call CNewWnd
so here's how i created them:
(inside CMainDlg's onInitDialog)
CCreateContext* con = new CCreateContext();<br />
con->m_pNewViewClass = RUNTIME_CLASS(CNewWnd);<br />
<br />
splitter.CreateStatic( this, 1, 2, WS_VISIBLE);<br />
splitter.CreateView(0,0, con->m_pNewViewClass, CSize(200, 200), con);<br />
splitter.CreateView(0,1, con->m_pNewViewClass, CSize(200, 200), con);
that creates the splitters, and the stuff inside them, everything works perfectly, except for the fact that i can't seem to catch the messages from the CNewWnd using ON_NOTIFY
so the problem is, ON_NOTIFY requires the DlgCtrlID like this:
ON_NOTIFY(NM_CLICK, IDD_DLG, func)
but i dont have that value cause the CNewWnd objects are created dynamically
i tried using SetDlgCtrlID() on the CNewWnd objects but it seems to crash the splitter
i also tried sending custom ids using SendMessage but it's not getting caught
(inside CMainDlg)
ON_NOTIFY(NM_CLICK, 15, func)<br />
splitter.GetPane(0, 0)->m_customid = 15;
(inside CNewWnd)
GetOwner->SendMessage(WM_NOTIFY, (WPARAM) m_customid, (LPARAM)hdr);
any suggestions? thanks
|
|
|
|
|
kitkat12012 wrote: i can't seem to catch the messages from the CNewWnd using ON_NOTIFY
so the problem is, ON_NOTIFY requires the DlgCtrlID like this:
ON_NOTIFY(NM_CLICK, IDD_DLG, func)
but i dont have that value cause the CNewWnd objects are created dynamically
It's been a while but I think you want to be notified of WM messages from a CView. NM messages are sent from specific controls.
See here[^]
|
|
|
|
|
When we compile a C/C++ program we get the object code.
Now my doubt is :
When the object code is executed after transferring into the main memory what is it :
1. Is it a PROGRAM or
2. IS it a process....
I got really confused today in my vivas today cause of my examiner....
|
|
|
|
|
A program in execution is called "Process". A program is what you call as .exe. That would also call as an application.
So Program, process, Application all would mean same.
lionelcyril wrote: When the object code is executed after transferring into the main memory what is it :
Also, You don't execute an object code. Your object code gets through linker to make it executable code. .exe
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
Another thing to add is that object code cannot be executed.
It has to be linked by a linker into an executable before it can be executed.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Oops I was just adding it.
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
When you compile C/C++ sources, usually you obtain an executable (or an application): the object code (usually again) is just an intermediate result.
lionelcyril wrote: When the object code is executed after transferring into the main memory what is it :
1. Is it a PROGRAM or
2. IS it a process....
Is is a process , i.e. a running executable (or running application).
'Program', on the other hand, has a very broad sense, usually the context qualify better its meaning.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I am writing some code that can download JPEG images from the net (HTTP) and display them on my dialog app.
So far I am able to get the image with IStream interface by using IWinHttpRequest 's get_ResponseStream() . But I found myself failing to take the Stream object to load it to GDI+ Bitmap object.
IStream *pStream;
if (NULL != pStream)
{
Bitmap *pGdiBmp = NULL;
LARGE_INTEGER llMove;
llMove.LowPart = 0;
llMove.HighPart = 0;
pStream->Seek(llMove, STREAM_SEEK_SET, NULL);
pGdiBmp = Bitmap::FromStream(pStream);
}
pGdiBmp is always NULL . I tried to save pStream to disk and the resulted binary is correct JPEG file.
What am I doing wrong here?
Any help would be great.
Thanks in advance.
modified on Thursday, May 7, 2009 11:48 AM
|
|
|
|
|
I'd verify that the contents of the stream are a JPEG by loading it into memory using GetHGlobalFromStream followed by a GlobalLock on the HGLOBAL you got back from the first function. Then verify that the memory starts with the string "JFIF".
I used the WinHttp functions to download a JPG and found that the JPG started after the first six bytes of the response (I created a stream on a set of bytes) - I needed to offset the stream by six bytes to get the Bitmap to load:
Gdiplus::Bitmap* LoadBitmapFromUrl(CString const& url)
{
HINTERNET hInternet = WinHttpOpen(L"hello", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
if (!hInternet) return 0;
HINTERNET hConnection = WinHttpConnect(hInternet, L"www.python.org", INTERNET_DEFAULT_PORT, 0);
if (!hConnection) return 0;
LPCWSTR types[] = { L"image/jpeg", 0 };
HINTERNET hRequest = WinHttpOpenRequest(hConnection, L"GET", L"/images/success/standrews.jpg", 0, WINHTTP_NO_REFERER, types, 0);
if (!hRequest) return 0;
if (!WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0)) return 0;
if (!WinHttpReceiveResponse(hRequest, 0)) return 0;
HGLOBAL gblBuffer = GlobalAlloc(0, 1<<20);
LPBYTE buffer = (LPBYTE)GlobalLock(gblBuffer);
DWORD nBytesRead;
if (!WinHttpReadData(hRequest, buffer, 1<<20, &nBytesRead)) return 0;
IStream* pStream = 0;
CreateStreamOnHGlobal(gblBuffer, FALSE, &pStream);
ULARGE_INTEGER size; size.QuadPart = nBytesRead;
pStream->SetSize(size);
LARGE_INTEGER offset; offset.QuadPart = 6;
pStream->Seek(offset, STREAM_SEEK_SET, 0);
return new Gdiplus::Bitmap(pStream, FALSE);
}
(Please ignore the memory leak - I couldn't be bothered to tidy up - it's not production code )
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Dear Stuart,
Thanks for the help. I'd get invalid image if I offset the stream by 6 bytes. I am not sure why it worked in your case.
Anyway, I found where my problem was. I have that code running outside of GDI+ library init scope. After I moved the following init code to CWinApp::InitInstance() , it worked fine.
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);
|
|
|
|
|
I took it as a given that the GDI+ stuff was right - more fool me
J.B. wrote: I'd get invalid image if I offset the stream by 6 bytes. I am not sure why it worked in your case.
Maybe because I was using WinHttpReadData rather than getting a stream directly from the IWinHttpRequest object.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: Maybe because I was using WinHttpReadData rather than getting a stream directly from the IWinHttpRequest object.
That'd be strange, because I checked the my Stream buffer and it had the same pattern as you described - after first 6 bytes, it comes with "JFIF"
FF D8 FF E0 00 10 4A 46 49 46
J F I F
|
|
|
|
|
I'm wrong - I thought the JFIF came at the start of a JPEG file - having just looked at a JPG in a hex editor, it doesn't.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
trongduy wrote:
1. Be organized classes and write the application to allow load and display all kinds of image files with the extensions in the following categories. Jpg,. Bmp,. Dib,. Gif. Programs that change the image as horizontal turn, vertical (mirror), dial 90degree, the gray level to get the sound, get the wrong picture of the two special functions and stored into different (but still one of the significantly above).
Requirements: The thought by the audience. Can be programmed in the Windows environment. Do not use static function as eg in the theory, does not switch, in the case.
2. An "input directory" is a folder or a file, a directory of many "input folder". Drive is a special case of the directory. Be organized classes to perform concept computer, disk drive, folder, file with the relationship as over. Write the application for permission to view the content of the object type as similar functions of the software Tree NC.
3. For the types: circle, ellipse image, the polygon, crescent,'s wings, rhombus, parallelogram, trapezium, rectangle, square, triangle, triangle square, square triangle needed. Write a program that allows applications to create (or enter) the two pictures in one of the above. Notice in two pictures that are not intersecting, if any color to the bowl and the dark sea of the interface. The user can press the arrow keys to move one of two pictures, the +, - to zoom out one of the two pictures. Programs can work with all kinds of equipment in different graphics modes, text mode (each a '*' is a moral pixels). Program can zoom to pixel morally, from the graphics mode to text or vice versa, users do not see the object to be exhaustive or bé tí hon.
4. A road of many road Polyline (line), each line can be a straight section (Strait line), and (ARC), or a bezier polyline. Organization of classes necessary, establish the relationship between class and write a program that allows to create polyline, create a copy of the polyline, zoom in, zoom out, turn polyline, polyline separation (separation of the polyline in the a polyline into the road (line, arc, bezier), define two functions have polyline cross or not?
|
|
|
|
|
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi there,
I have in my application a button that launches another application such as the on-screen keyboard using the createprocess function. If the button is pressed again I want to close the application. How can I do this safely?
Many thanks
Jim
|
|
|
|
|
jimjim733 wrote: If the button is pressed again I want to close the application. How can I do this safely?
By calling ExitProcess() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Or if you want to kill the new application from the one that spawned it, use TerminateProcess().
|
|
|
|
|
I am BATMAN wrote: ...use TerminateProcess().
Which is unsafe.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I suppose Batman isn't expected to terminate gracefully a process...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
jimjim733 wrote: safely
Define what you mean by 'safe' - that'll help indicate what an appropriate solution is.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I stored the data in structure and placed it into a vector. However i need to upload this data through web service to the server and this happend for every 5 mins(i used a waitable timer).thus i used an array and send the data from vector to an array
LogInfo *Info = new LogInfo [m_vectStruct.size()];
for (int j = 0; j < m_vectStruct.size(); ++j)
{
ThreatInfo[j] = m_vectStruct.at(j);
}
However the data is going beyong 800MB and becoz of this the network is getting blocked.
Thus please let me know how can i send the data from vector to an array even if the size of the data is more than 3GB???
I Even Used the below code but of no use.
copy ( m_vectStruct.begin(), m_vectStruct.end() , &Info );
Please help its bit urgent...
Thanks in Advance
|
|
|
|
|
Instead of using a waitable timer, why can't you choose a limit on the number of elements in the vector and upload it as soon as it hits this limit? Also, what's with copying stuff into an array and all? I don't get the idea.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
brucewayn wrote: this happend for every 5 mins
brucewayn wrote: However the data is going beyong 800MB and becoz of this the network is getting blocked.
Not sure we have the entire picture, but based on that picture there might be a need to send the data in smaller segments rather than sending all of it every 5 minutes.
|
|
|
|
|