|
Thank you Cedric!
Great answer!
regards,
George
|
|
|
|
|
George_George wrote: 2. If I am porting the source codes from Windows to Linux, does on Linux platform exist similar (or the same) keyword like __cdecl? How should I port source codes which has __cdecl keyword?
The GCC compiler has function attribute cdecl which appears to be similar in meaning, but the syntax is different:
http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Function-Attributes.html[^]
|
|
|
|
|
Thanks markkuk,
I found the attribute name is the same -- cdecl. Why do you say that the syntax is different?
regards,
George
|
|
|
|
|
Hi,
I am storing all the barcode into below declared list
<br />
typedef std::list<char* > SERIAL_NUM_BARCODE_LIST;<br />
SERIAL_NUM_BARCODE_LIST SerialNumDescList;<br />
Now before adding to list I have to check whether barcode exist in the list or not. If barcode does not exist than only I have to add it.
<br />
typedef std::list<char* >::iterator BARCODE_LIST_ITER;<br />
BARCODE_LIST_ITER BarcodeListIter; <br />
for(BarcodeListIter = SerialNumBarcodeList.begin(); BarcodeListIter != SerialNumBarcodeList.end();BarcodeListIter++)<br />
strcmp(SerialNumBarcodeList.front(),Barcode)<br />
Is there simple find method present in STL to check inside the list.
Thanks
|
|
|
|
|
You can simply compare the contents of the iterator (so, the string) with the name of the new barcode. To access the string through the iterator, just use this:
(*BarcodeListIter)
|
|
|
|
|
Ideally, you should store the barcodes as strings instead of a pointer. For example:
std::list<std::string> SerialNumBarcodeList;
...
std::list<string>::const_iterator it = std::find(SerialNumBarcodeList.begin(), SerialNumBarcodeList.end(), BarCode);
if (it != SerialNumBarcodeList.end())
{
...
}
-- modified at 2:56 Monday 27th March, 2006
|
|
|
|
|
Thank dear, I hope it will take care the boundary condition where it is checking the barcode with SerialNumBarcodeList.end()
|
|
|
|
|
Hi All,
How can I implement the shared memory concept with C language on windows platform?
Here I want to share a common data with 2-3 executable of C language files on windows platform.
Thanks in advance,
-Ramesh
|
|
|
|
|
For C++, you have quite a few classes in Codeproject's Threads and IPC section[^].
Examples:
CMemMap[^] Which seemed to inspire...
XQueue[^]
and even Microsoft's own CAtlFileMapping class[^].
Raymond chen notes another method[^], but this one opens a security hole.
But for managing variables via shared memory, you'll definitely want to use a helper class.
|
|
|
|
|
Hi,
Anyone know how to enumrate printers from active directoty ?
VikramS
|
|
|
|
|
there is a function called EnumPrinters() which can enum all printers, including networking's.
but I am not sure if it is related to your "active directory".
A nice hyper tool for optimizing your Microsoft html-help contents.
A best image tool for Windows C++ programmers, don't miss it!.
Includeh10
|
|
|
|
|
Hi all "Respected members "
I want to know as we can disable a button in vc++ like this:
GetDlgItem(IDC_SPLITBUTTON)->EnableWindow(FALSE);
and enable it like this:
GetDlgItem(IDC_SPLITBUTTON)->EnableWindow(TRUE);
How can we disable and enable a progress bar?
Thanks in Advance...
alok singh chauhan
-- modified at 1:23 Monday 27th March, 2006
|
|
|
|
|
ariesaloksingh wrote: I want to know as we can disable a button in vc++ like this:
GetDlgItem(IDC_SPLITBUTTON)->EnableWindow(FALSE);
and enable it like this:
GetDlgItem(IDC_SPLITBUTTON)->EnableWindow(TRUE);
How can we disable and enable a progress bar?
In the same way or using a control variable.
Nibu thomas
Software Developer
|
|
|
|
|
Sir i had tried that but that's not working.
alok singh chauhan
|
|
|
|
|
Can you post your code, pls ?
~RaGE();
|
|
|
|
|
Sir,i want that each time i execute this code written below(which is written in a button)the progress bar should progress and it should look like that, but
after 1st execute the progress bar is filled and next time it looks that it is not progressing.pls help me how can i make it look progress after 1st execute.
//Progress Bar
m_mprogress.SetRange(0,1);
//Read from merge file to Buffer
intnumRead= fread(buff1,sizeof(char),lmFileSize,mergeFile);
//Write from Buffer to merge file
intnumWrite= fwrite(buff1,sizeof(char),lmFileSize,newFile);
//Current Position of New file
fseek(newFile,0,SEEK_CUR);
m_mprogress.SetPos('1');
Sorry for my english
Thanks in Advance
alok singh chauhan
-- modified at 3:59 Monday 27th March, 2006
|
|
|
|
|
Explanantion of what goes wrong :
m_mprogress.SetRange(0,1);
With this you set the range of your progress bar from 0 to 1, so it has only one step !
m_mprogress.SetPos('1');
With this you set the position of the progress bar to 1, which is the end boundary of the progress bar you've set with SetRange(0,1);
What you need to do is following :
1. Compute the number of times you will call the function you want to monitor with the progress bar (let's say it is 'n')
2. Initialize the progress bar with m_mprogress.SetRange(0,n);
3. Everytime you want to incremente the progress bar, call m_mprogress.StepIt();
Hope this helps.
~RaGE();
|
|
|
|
|
Hi ,
hope this will help sorry for replying late .
CProgressDlg prgDlg;<br />
prgDlg.Create();<br />
prgDlg.SetRange(0,100);<br />
<br />
File_count_line.seekg (0, ios::end);<br />
int length_total_line = File_count_line.tellg();<br />
int nLoop = length_total_line/length_one_line;<br />
File_count_line.seekg (0,ios::begin );<br />
<br />
int length_one_line = File_count_line.tellg();<br />
<br />
double nPerc = (double)((double)length_one_line/length_total_line)*100;<br />
prgDlg.SetPos((int)nPerc);
Regards,
FarPointer
-- modified at 11:01 Sunday 2nd April, 2006
|
|
|
|
|
ariesaloksingh wrote: Sir i had tried that but that's not working.
If you don't manipulate the progress bar it always looks disabled. Well the progress bar does only give visual feedback to the user and nothing else and user cannot interact with the progress bar. So check if progress bar is enabled before manipulating it.
Nibu thomas
Software Developer
|
|
|
|
|
|
i am working on a dialog base application there is a main dialog in which several button on one button i am calling another dialog which start downloading file using a thread and evry thing successfully done
but this dialog also have "cancel" button in between downloading if i clicked cancel button on this button I handle a event and call suspend thread and enddialog function but this time it give runtime error and also when i use terminate thread there is same problem.
if anybody have idea about this,please tell me what should i have to do.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Never call SuspendThread - Unless you're a threading expert it's just too dangerous. This is a common threading error, up there with calling TerminateThread . Here's a common failure scenario of how calling SuspendThread causes problems:
1- The worker thread enters a Win32 API function, this function calls EnterCriticalSection .
2- Another thread calls SuspendThread and stalls the worker thread before it can call LeaveCriticalSection .
3- Another thread calls the same API, when it calls EnterCriticalSection it stalls waiting form the critical section to be released - It never is.
Any thread that calls this API now hangs.
This kind of bug is real, hard to reproduce and hard to find. Failure will be of a different nature depending on what the worker thread is doing at the time it is suspended. SuspendThread , TerminateThread and friends are only intended for experts and debuggers - Mere mortals should not use them.
Steve
|
|
|
|
|
but wright now i have to solve this bug, so can you u guide me what should i use for get rid of this bug
Bankey Khandelwal
Software Engineer
|
|
|
|
|
I'm not sure of the exact nature of your problem, but I would start by removing calls such as SuspendThread and TerminateThread - I'm not just making this stuff up, these two API really do cause havoc.
Can you give any details of the runtime error?
Steve
|
|
|
|
|
In your handler for the cancel button, you should set a flag (or an event) that can be read in the worker thread that tells it you have cancelled.
Inside the thread, have it finish whatever it's doing and simply allow itself to exit after all necessary cleanup. Just before it exits, it can set another flag (or event) to signify that it is exiting the thread
Back in the main thread, wait for the signal from the thread that it is exiting, then you can safely let the main thread die (by calling your EndDialog).
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|