|
void logAppName(const char* appName)
{
static std::set<std::string> appsLogged;
if(appsLogged.insert(appName).second==false)return;
...
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi All!
I used CInterSession::OpenURL() to open a TIFF file URL. Then, I used CHttpFile::Read() function to read the TIFF file into a local heap buffer.
About on 100 machines(95/98/NT/XP) it works fine. But on 2 machines (one is windows95 & another windows NT workstn) the Read() returns after just reading the first 263 bytes. What could be the problem??
I checked WININET.DLL versions. On other machines with the same DLL versions, same OS, same SP it works fine. But not on these 2 machines. Its bugging me. Can anybody help please...
|
|
|
|
|
It is ok, you cannot expect to read all the file in one shot. Think that you have a 1Gb file to download
Actually you need to keep reading from file untill the buffer returned is empty. Ammount of bytes read in single operation depends on OS, Connection and settings somewhere in Registry.
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Thanks for your response Phil.
But, I have the Read() code in a do-while loop. The first iteration reads 263 bytes and the Read() in second iteration returns a zero, which terminates my do loop.
The algorithem I have is:
int nRead=0;
char szBuffer[1024];
char szBigBuffer[100K];
do
{
nRead = CHttpFile::Read(szBuffer, sizeof(szBuffer)
if(nRead>0)
Append the szBuffer to szBigBuffer
}while(nRead>0);
Sincerely appreciate your help.
-Srini.
|
|
|
|
|
Have you actually looked at what the 263 bytes contain? Perhaps the server is returning a 404 page to you. I've had this happen that the server returns a "valid" web page that is actually not what I was looking for since I got the URL wrong.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
Hi Joel:
Thank God. I am out of this. Your suggestion has really worked for me. Its a Proxy problem. I dumped the 263 byte stream. It has an error message from our production proxy servers.
Thank you verymuch.
Srini.
|
|
|
|
|
i have a dialog based application
i just want to change the color of the controls when mouse moves on and want to capture WM_MOUSEMOVE event on a pushbutton, ListBox, or ListCtrl
but i couldn't. At the rest of the client area it is captured but on these controls it doesn't.
What should i do?
just listening to you...
|
|
|
|
|
When you have an active control in the client area, your control will capture your mouse movement. In order for the control's parent to capture such message, you need to specify "Notify" style for it.
|
|
|
|
|
Dear All,
In a dialog based appliction, i have a 8-bit
bmp image which only have 4-colors. so its
pallete looks like this: white, blue, black, red,
and the remind all are black.
Now i have a new pallete in which 16 colors are
used. I can change the pallete of the original bmp
image with the new pallete by using read and write
pallete functions. If doing so, the display mode of bmp image also changed. But i hope the bmp image displayed same with the original one.
How should i do? rewite the color datas of the bmp file? How to do this?
Thanks in advance!
chen
xyz
|
|
|
|
|
Probaly the easiest way is to reorder the 16-color palette so tat it matches the 4-color one in the critical entries (which probably are the first five), and then do the copying.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for your reply!
I want to make the original and new bmp image displayed in same way.
So how to change the color data of the original bmp image (because
the pallet have been changed)?
xyz
|
|
|
|
|
I open my applicaiton. and do selecting text other application such as notepad then I press my hotkey such as Control+Tab (I'm not using control C, so it isn't using clipboard) and that selecting text is sending to my application. I has to registerhotkey but how shoud I do for sending that selecting text ?
thank you so much.
|
|
|
|
|
I have a problem on extern function templates. The syntax compiles OK, but gets:
error LNK2001: unresolved external symbol "int __cdecl Next(int)" (?Next@@YAHH@Z)
Only function templates cause such problem; general functions like
int MyFunction(void* p)
does not cause such problem.
My VC++ is 6.0 sp5.
Here is the example code...
In the first file main.cpp:
/* *********************** */
////////////
// main.CPP
#include <iostreamᡊe9ac73-238b-46be-991d-0f050c37248dusing namespace std;
template<class T> extern T Next(T val);
void main()
{
int a = Next(3);
cout << "a = " << a << endl;
}
/* *********************** */
In the second file function.cpp
///////////////////
// function.CPP
template<class Tᡊe9ac73-238b-46be-991d-0f050c37248dT Next(T val)
{
return val++;
}
/* ************ */
Maxwell Chen
|
|
|
|
|
As main.cpp does not see the definition of Next , which is hidden in function.cpp , it is required that function.cpp "exports" the instantiation of this template for int s like this:
template<class T>
T Next(T val)
{
return val++;
}
template int Next(int); This is not a very smart design, as function.cpp has to know in advance for which types Next is going to be used. Usually, it is better to have the definition of all templates inside header files included by the "consumer" .cpp s.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
Sorry guys, but how can i pass a parameter to
the dll which i've hooked to the system
Please help
Sameer
|
|
|
|
|
Export some function to accept the parameters and have them stored in a data shared segment (if you need help about shared segments, check Phil McGahan's article How to share a data segment in a DLL.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hi,
i did this.. and made a function setfilename(char *)
which changes the filename..
but in my DLL mail i am doing fopen.. but now the
file is not being created
#pragma data_seg (".HookSection")
// Shared instance for all processes.
static HHOOK hHook = NULL;
// Change 2
static char szFilename[_MAX_PATH] = "";
// Change 2
#pragma data_seg ()
|
|
|
|
|
setfilename does a strcpy to szFilename , right? If so, everything should work fine. Check the following:- Make sure the filename is correctly set by displaying it somehow (say with a
MessageBox ) right before calling fopen .
- Maybe the file is being opened in a directry different to what you expected.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Actually i had put that code in DLLMain, but now it
is inside HookProc..
Now the problem is that when i run some application,
lot of entries of the same application are logged on
to my log file.. whereas first it was just one
Sameer
|
|
|
|
|
Hi.
I would like to implement a progress bar one pane of the statusbar. Current, the statusbar has two panes. Pane 1 (index 0) is the default separator where you see "Ready." The second pane is contains the progressbar. Here is the code.
-----
CRect progressRect;
m_wndStatusBar.GetItemRect(1, &progressRect);
m_ProgressBar.Create(WS_CHILD | WS_VISIBLE | SBPS_NOBORDERS | PBS_SMOOTH, progressRect, this, -1);
m_ProgressBar.SetRange(0, 100);
m_ProgressBar.SetPos(0);
-----
Here is the code that tests the progressbar.
-----
for (int i = 0; i < 100; ++i)
{
{
m_ProgressBar.SetPos(i);
::Sleep(25);
}
}
-----
For some reason, I do not see any sign of the progressbar working. I have an option in the menu to start the for loop. However, I do not see any sign of the progressbar, period. I am using SDI. The code above are all part of main.
Thanks,
Kuphryn
|
|
|
|
|
If your doing this loop in your user interface thread, then its not allowing the messages generated from your loop to be processed. Try adding this into the loop:
MSG msg ;
while (::PeekMessage(&msg, NULL, 0, 0, PM_NOYIELD | PM_REMOVE))
{
::TranslateMessage(&msg) ;
::DispatchMessage(&msg) ;
}
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Thanks.
Why is it not allowing me to update the progress bar in the UI thread?
Kuphryn
|
|
|
|
|
The UI thread pumps the windows messages that allows you controls to draw themselves. In your original function, you entered a lopp that updtaes the position in the control and then pauses the thread until you want to update it again. As the UI thread is not pumping the message queue in the loop, your controls never update, if effect the UI of your app is stalled until the function completes. You should then find all the messages get processed, and the progress will be shown at 100% complete.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Thanks.
I do not see the progressbar anywhere on the statusbar (in main) at all.
A member at Codeguru posted a segment of code he used for a something I am trying to implement. He used CDialogBar and CProgressCtrl.
Here is the link to that thread:
http://www.codeguru.com/cgi-bin/bbs/wt/showpost.pl?Board=vc&Number=367944&page=2&view=collapsed&sb=5
He used some really innovative MFC tools such as the CDialogBar and ShowControlBar() function. I have Jeff Prosise's MFC reference, but I do not remember Prosise mentioning those about those tools.
I had problems getting the code from the link above to run. I got the error "bardlg.cpp" debug error. Maybe you can test it out too.
Kuphryn
|
|
|
|
|
Oh, I understand now. I receive a response at Gamedev about the UI thread (main frame) not able to update the progress bar. I am not familiar with the reason behind that.
I would like to have the progress bar in a pane of a statusbar. That means I will have to declare the progress bar in main (UI thread) and update it from there. If the UI thread cannot update the progress bar, then is it possible to even have a progress bar in main (UI thread) at all?
Kuphryn
|
|
|
|