|
Hello, thank you for reply, but unfortunately image I need to save is not cached, is dynamically created and is different every time I reload the page or download it again
rrrado
|
|
|
|
|
I want to post a message from a Global Function to a UI thread.who can tell me ,how can i get the thread pointer or id in the Global Function?
void CALLBACK Timer2(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
{
//::PostThreadMessage(WM_TIMEUP,0,2);
}
class CServiceWnd : public CWinThread
{
............
}
ON_THREAD_MESSAGE(WM_TIMEUP,TimerProc)
afx_msg void CServiceWnd::TimerProc(WPARAM wParam, LPARAM lParam)
{
..............
}
|
|
|
|
|
You can get a pointer to your current thread by calling AfxGetThread . If you need a different thread, you'll need to store a pointer to it somewhere.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Problem: Convert the Global variables into Class Variables
A good example is the variable ‘OurString’ which is declared in
file oam.var in the following way:
TCHAR OurString[260];
It is used in 209 different places according to “Find in Files”.
There are two problems with those global variables:
1) they might break if we start using multiple threads
2) the code does not typically check if there is enough space for the stuff that is put to those variables.
Can U give some idea for implementation?
dadsadasd
|
|
|
|
|
|
hi...could anyone check the codings below? thanks.
#include <iostream>
#include <iomanip>
using namespace std;
class Bus
{
int number;
char startDepot[30];
char endDepot[30];
int departureTime;
public:
void update();
void display();
};
void Bus::update()
{
cout << "Enter the bus number (eg 83): ";
cin >> number;
cin.ignore(80, '\n');
cout << "Enter the start depot (eg Sengkang): ";
cin.getline(startDepot, 30, '\n');
cout << "Enter the end depot (eg Punggol): ";
cin.getline(endDepot, 30, '\n');
cout << "Enter the departure time (eg 1605): ";
cin >> departureTime;
cin.ignore(80, '\n');
}
void Bus::display()
{
cout << "Bus number : " << setw(3) << setfill('0') << number << endl;
cout << "Start depot : " << startDepot << endl;
cout << "End depot : " << endDepot << endl;
cout << "Departure time : " << setw(4) << setfill('0') << departureTime << endl;;
}
int main()
{
int count;
Bus *b;
cout << "How many buses are there: ";
cin >> count;
b = new Bus[count];
char choice;
int num;
do
{
cout << "u. Update\n";
cout << "d. Display\n";
cout << "e. Exit\n";
cout << "enter selection: ";
cin >> choice;
switch(choice)
{
case 'u' :
cout << "enter bus number (1-" << count << "): ";
cin >> num;
b[num-1].update();
break;
case 'd' :
cout << "enter bus number (1-" << count << "): ";
cin >> num;
b[num-1].display();
break;
}
} while (choice != 'e');
delete [] b;
return 0;
|
|
|
|
|
so...?????
what is your question ?
TOXCCT >>> GEII power
|
|
|
|
|
does the coding looks logical?
|
|
|
|
|
|
It has very severe error that it is without comments. And believe me my friend a code without comments is just a deadbody.
cheers
|
|
|
|
|
How to delete a file which name is contained in the CString variable "m_csPCFileName" ?
I tried this but it doesn't seem to work:
char* pTempFileName = "";
strcp(pTempFileName,m_csPCFileName); //Conversion CString to CHAR*
CFile::Remove(pTempFileName);
I have an handled exception error message...
Thank's for advance
|
|
|
|
|
Anonymous wrote:
strcp(pTempFileName,m_csPCFileName); //Conversion CString to CHAR*
false strcpy() is not designed() to work with CString s.
use the CString::operator (LPCSTR) () instead.
TOXCCT >>> GEII power
|
|
|
|
|
strcpy works just fine with CString. However, the code in the first message is badly broken.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
|
How about a simpler function, DeleteFile( lpszFileName );
It's a standard Win32 api.
--
Joel Lucsy
|
|
|
|
|
Hi,
I have a batch file that is used for daily build and has large number of projects build from the command line using this file.
The Command Line command that does the build using the batch file is
msdev xmlTest.dsw /MAKE "BuildAll - Win32 Debug" /OUT ..\..\xmlTest.log
This build is based on the settings made to the .dsp files present in the Workspace and works fine for existing settings.
Now i want to modify the batch file to build with the option /ZI or /Zi turned on in order to generate the .PDB files.
So the thing is that i have to build first without /Zi or /ZI option and next set this option and run the second time to get the .pdb files generated.
What is that i need to modify in the batch file to make both the options working from the command line..
I think it has something do to with the environment variable setings....but have no idea how to do it...
Thanks
AR
|
|
|
|
|
You could try using SET CL=/Zi . I'm not sure if this environment setting propogates to cl.exe via msdev, though. You'll also need SET LINK=/DEBUG to get the linker to generate the final pdb file.
I follow John Robbins'[^] prescription - I always generate PDB files, for both Debug and Release builds. The overhead of generating a PDB on the final code is minor: the executable's .debug section contains the path to the generated PDB file. One small caveat is that specifying /DEBUG to the linker changes the default /OPT setting; to discard unreferenced code and data (the default in Release mode), you should also specify /OPT:REF .
Having the PDB file allows you to at least be able to see source and get a call stack when trying to debug a Release build. Robbins has produced a number of useful tools such as CrashFinder (http://www.wintellect.com/about/instructors/robbins/code.aspx[^]) which allows you to map a crash address to a source line, and PrivateStrip (http://www.wintellect.com/resources/newsletters/2000/dec2000.aspx[^]) for removing private symbols from a PDB suitable for giving to a customer to get better crash information.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Iam not sure if we can use SET CL = /Zi with the MSDEV command. well i get what exaclty you are trying to tell but i didn't get exactly what iam looking for.
MY first priority of looking at it is to have a sinle batch file that could do both the release builds with and without .pdb so essentially i need to do something in order to set the option after the first build.
If i can make use of the SET CL = /Zi ...with msdev. can you let me know how to use in the order..
|
|
|
|
|
can a application restart by itself, any way to do that.
or can a NT service restart by itself.
|
|
|
|
|
You can certainly use CreateProcess to create a new instance of your application, then quit your current process (the way you do this will depend on your application, for example, you might need to close your main window).
Service processes can be configured in the Services snap-in to automatically restart if the process crashes. See the ChangeServiceConfig2 API.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
i have a 24*7 highly database intensive mfc application. using cdatabase and crecordset objects.
it starts with 8mb and gradually increases to 34 mb (peak is shown as 60 mb)by task mgr, withing one day. Im sure of no memory leak. But sure windows is reserving (may be caching) the memory for my application, which is shown accross my application by task mgr.
is there any way to avoid this behaviour and make the application to take only that memory taken in the first couple of hours and not more.
So my question without any memory leak is this behaviour possible. any remedy to avoid this behaviour. like registery settings to avoid caching or something else...
|
|
|
|
|
The MFC database stuff will tend to cache rows if you don't use the right cursors.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
plz can any one guide me how to dump(apppend) the record(data) into excel sheet using Vc++(MFC wizard) and also to write program which controls data(i,e to delete data using a program ).
|
|
|
|
|
HI all,
supposed that my multithreaded program protects data with MFC CCriticalSection and it works fine on machine have one CPU. Is there any steps must I take to have the program worked on same platform with multi CPUs. Is this safe with CCriticalSection synchronization?
Many thanks,
Do Manh Hung
|
|
|
|
|
On a multi-CPU platform, the CPUs are given threads as required, and the second processor will take responsibility of the threads after a certain amount of load is placed on the first.
I believe that the threads given to one CPU are always handled by it. This means that the CPUs don't work together on a single thread, instead, both CPUs handle their own threads, and this thread-sharing is done by the OS.
Not sure, though.. However, the CCriticalSection object protects a resource or a piece of code for exclusive access for a single thread. As such, it shouldn't make a difference on what CPU is handling the thread at the given time: the thread from which the locking method is called is given an exclusive access to the forementioned resource, and the CPU just processes the thread. If another thread tries to access the resource, a violation is generated.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|