|
rat.crown wrote:
How can I got these Windows Data Type's declare?!!
As you've found, they are already declared in BaseTsd.h . Why are you wanting to redeclare them?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I download the file:PSDK-x86.exe from the microsoft website ( Windows® Server 2003 SP1 Platform SDK Web Install )
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en
Then I installed it on my computer. In the folder: C:\Program Files\Microsoft Platform SDK\Include , I got the file BaseTsd.h, But in the file, there are no the Data type declared!!!
Thanks
|
|
|
|
|
|
|
I download the file:PSDK-x86.exe from the microsoft website ( Windows® Server 2003 SP1 Platform SDK Web Install )
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en
Then I installed it on my computer. In the folder: C:\Program Files\Microsoft Platform SDK\Include , I got the file BaseTsd.h, But in the file, there are no the Data type declared!!!
Thanks
|
|
|
|
|
I've run into a conundrum. I want to monitor a directory with my program, say every second or even every minute, but I want to allow the user to continue to manipulate the dialog. The only way I know to wait a specified time is by using the Sleep command (i.e. Sleep(1000) waits for 1000 millisecond, or 1 second, to continue). I could continue to do something like CTime::GetCurrentTime(), and compare the new times with some previous time, but that still would hang the application, not allowing the user to press buttons in the mean time.
So, does anyone know how I can check on something every second or every minute, and yet not hang up the app?
|
|
|
|
|
Use SetTimer and then you can monitor the time usign the associated OnTimer event.
Elaine
The tigress is here
|
|
|
|
|
Start a second thread to do the checking for you.
Wait on an event, for 1000 milliseconds.
If you get WAIT_TIMEOUT, then the time limit has 'approximately' elapsed.
The event is used to signal from the main application threaed that your secondary 'timer' thread should exit.
If your secondary thread finds something 'interesting' it can post message back to main thread, or take whatever action it is you are monitoring.
|
|
|
|
|
Thanks for your helpful response.
However, I've had limited experience with threads. Is there a function or class I can look up in MSDN to get me started?
|
|
|
|
|
G****N CP! Why is it 'hanging' on me looking like my responses are 99.99999999999999999999999999% submitted
Look at some of the samples on threads here at CP.
There are some samples using MFC and others that do not.
I believe one of them even uses the ReadDirectoryChangesW API to monitor a directory for changes.
See here:
http://www.codeproject.com/file/directorychangewatcher.asp[^]
|
|
|
|
|
Use ReadDirectoryChangesW() and/or FindFirstChangeNotification() so that you don't needlessly tie up the CPU.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello,
I have found a code snippet on the internet which uses this both functions. The File includes the stdlib.h where this both functions should be defined. But they aren't.
Why aren't they defined ? Where can i download a stdlib.h file where they are defined ?
With best regards,
RedDragon2kx
|
|
|
|
|
Are you sure those functions, and the code snipet for that matter, are not targeted for a Unix platform? The Windows SDK has no such functions.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
a quick googling shows this to be a common definition:
#ifdef WIN32
#define lrand48(x) rand(x)
#define srand48(x) rand(x)
#endif
Cleek | Image Toolkits | Thumbnail maker
-- modified at 13:44 Monday 12th September, 2005
|
|
|
|
|
Chris Losinger wrote:
#define srand48(x) rand(x)
I would think that srand48() would resolve to srand() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
I need to display more than 5000 chars in a edit box.
It seems like MFC edit bos has a limit of 5000 chars.
any suggestions to get around this would be helpful.
thanks
Sanjay
|
|
|
|
|
Sanjay R. Zore wrote:
It seems like MFC edit bos has a limit of 5000 chars.
No such limit exists. What makes you think that an edit control is limited to 5000 characters?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
see CEdit::LimitText
unless you're on 16-bit Windows or Win 95, the only limit on edit control data size is the size of an unsigned 32 bit integer, which is somewhat larger than 5000...
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
i'm trying to run two separate threads. its working when i use an Integer to be passed as an argument to the thread. for example, if i send '1' one thread will keep on telling 1,1,1,1,1,1,1.
[tested using msgbox]
mean while, i send '2'. then another instance of the thread will start saying 2,2,2,2,2,2,
so u will get like 1,2,1,2,1,2,2,1,2,1,1.. like that.. its woking fine.
But if i pass a char[] parameter, its not working
ie,
if i pass "TEST",
it says , "TEST","TEST","TEST".......
meanwhile if i start another to say "CODE",
its destroys "TEST" and so two instance of "CODE" is displayed.
like instead of "TEST","CODE","TEST","CODE",... am getting like "CODE","CODE","CODE"...
plz tell me how to go..
thanks in advance
Thanks in advnace
V
|
|
|
|
|
Vivekuniq wrote:
plz tell me how to go.
You need thread synchronization for this to work. Place a critical section or mutex around your display routine so that only one thread can print at one time.
John
|
|
|
|
|
but how is it working for Integers?
V
|
|
|
|
|
Without the code I can only guess... So here is my best guess: Because the code to output the integers takes so fast that there is no context switch between the call.
John
|
|
|
|
|
if there is no context switch , it should print the same value right?.. sorry if i misunderstand, anyway plz view the code here.. plz try to help me . everytime i'm struggling with the threads .
char[4] agIndv;
UINT CQACDDlg::DevMonitoring(LPVOID p)
{
CQACDDlg * me = (CQACDDlg *)p;
me->DevMonitoring(agIndv);
return 0;
}
void CQACDDlg::DevMonitoring(char[] ageID)
{
while(1)
{
AfxMessageBox(ageID);
//Sleep here for a while
}
}
void CQACDDlg::OnSetSplit() // onclick for new Threads
{
m_SplitID.GetWindowText(agIndv,5); //agIndv is global taken from a CEdit box
AfxBeginThread(DevMonitoring,this);
}
in the header file,
i declare
static UINT DevMonitoring(LPVOID lp);
V
|
|
|
|
|
The objects passed to the threads should probably be allocated on the heap rather than the stack, and then destroyed by the secondary thread. Something like (in MFC):
CString *strName = new CString("David");
AfxBeginThread(ThreadProc, strName);
...
UINT ThreadProc( LPVOID lpVoid )
{
CString *str = (CString *) lpVoid;
...
delete *str;
return 0;
} The same concept can be used with non-MFC code.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|