|
how to set dependency? before i did, it is no problem...can you give me detail? thanks
Li Zhiyuan
|
|
|
|
|
You haven't mentioned which IDE you're using.
Steve
|
|
|
|
|
|
Select "Dependencies..." from the "Project" menu.
Steve
|
|
|
|
|
i did it there, and dependency it, i already finished this.
Li Zhiyuan
|
|
|
|
|
The project that uses the lib should be dependent on the project which builds it. Make sure the lib exists AND the search path is set correctly.
Steve
modified on Monday, February 11, 2008 2:16 AM
|
|
|
|
|
yes, i already dependency the library what i created, and set path in tool option.....ai...don't know why......too tired..thanks
Li Zhiyuan
|
|
|
|
|
Hi all,
I have calculated an int value using one of function in my application. Every 10 seconds interval this value is calculated. I want to add those vale in a buffer, in descending order.
Like this,
if the 1st value is 12 : buffer is 12
if the 2nd value is 17 : buffer is 17, 12
if the 3rd value is 9 : buffer is 17, 12, 9
.....
....
I thin it is clear now for you.
What is the most easiest way to do this. I've try to check the each value of the bufferbefore adding the new value. But if there is large number of values, it seems take more time.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: What is the most easiest way to do this.
Just add them to a vector or a list.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks a lot. Actually I use priority_queue for that. But the most difficult part I have to do there is make a string from the queue. Have to code more lines to me.
But it works fine
I appreciate your help all the time...
Eranga
|
|
|
|
|
here's the code from MSDN:
CString theString(_T("This is a test"));
int sizeOfString = (theString.GetLength() + 1);
LPTSTR lpsz = new TCHAR[sizeOfString];
_tcscpy_s(lpsz, sizeOfString, theString);
//... modify lpsz as much as you want
I get this error:
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2133: 'lpsz' : unknown size
Here's my code:
void CSystemDB::ConvertStringFromFile(CString str)
{
CString s = NULL;
int sizeOfString = str.GetLength() + 1;
LPTSTR lpsz = new TCHAR[sizeOfString];/// gives error here
================ ============= ==========================
str has 66characters in it from a file read I tested in debug and the data is there so it
can't pass a "zero size" in length ==> it's 66 characters long!
A C++ programming language novice, but striving to learn
|
|
|
|
|
Your code verbatim compiles fine for me.
Larry Mills Sr wrote: CString s = NULL;
What is this line for?
The assignment is unnecessary as well - the default CString constructor
will create an empty string.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
CString s = NULL; I'm setting up a CString for exchanging characters from the file to past to a vector. I think maybe something nis wrong with the compiler if your compiler had no trouble with it. Any ideas?
I've tried everything I know(which isn't much grant you) and I still get the same errors.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: LPTSTR lpsz = new TCHAR[sizeOfString];/// gives error here
Have you tried:
LPTSTR lpsz = new TCHAR[67]; just to narrow the problem down?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I gu have a "Some-Timey" compiler. Everything works now and I haven't changed anything. Thanks
A C++ programming language novice, but striving to learn
|
|
|
|
|
I am trying to close a COM port if no data is received. My current appraoch is to use the CreateThread function to call a watchdog thread, the thread locks up when it executes the CloseHandle function, it is using the correct handle.
Any suggestions?
Thanks, for your help.
|
|
|
|
|
jonsey29847 wrote: the thread locks up when it executes the CloseHandle function
CloseHandle never returns?
What's going on at the time on the read thread?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You are correct my thread locks at the CloseHandle function. The read is part of WinMain. Mt thinking was to start a thread at the read function, then time for response and if no response within watchdog, close handle to return control to WinMain. Where is my defective thinking?
Thanks...
|
|
|
|
|
Sorry I did not completely read your question. The application is attempting to read from the COM port using the ReadFile function.
DWORD ReadFromCOMPort(HANDLE hCOM, TCHAR *tcRecdData, int nBytesToRead)<br />
{<br />
DWORD dwEventMask;<br />
if(!SetCommMask(hCOM, EV_RXCHAR))<br />
{<br />
SetLastError(SETCOMMMASK_FAILED);<br />
return 0;<br />
}<br />
<br />
if(WaitCommEvent(hCOM, &dwEventMask, NULL))<br />
{<br />
char *cTempString;<br />
int nLen, nStart;<br />
DWORD dwBytesRead;<br />
DWORD dwSize = 0;<br />
<br />
if(ReadFile(hCOM, tcRecdData, nBytesToRead, &dwBytesRead, NULL) != 0)<br />
{<br />
return dwBytesRead;<br />
}<br />
}<br />
return 0;<br />
}<br />
<br />
|
|
|
|
|
AFAIK, only Vista+ gives you the ability to cancel a synchronous read operation
from another thread (see the CancelSynchronousIo() function).
The correct way to handle this would be to use overlapped I/O.
That would eliminate the need for a second thread as well.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, as I dig into this I am coming to accept the inevitable.
Thank you once again for your help.
|
|
|
|
|
I am trying to restrict operation to a single instance of my program (per user). Specifically, I create a shortcut in the "Send To" folder. If the program (an MDI program based on the MFC Doc/View architecture) is NOT running, right-clicking on a file in the Send-To context menu correctly runs the program with the file name as a command line argument. It I select the program again from the context Send-To menu a new instance of my program starts. What I would like to happen is that the new file is opened by the running instance of the program in a new MDI window.
Could someone point me in the right direction for this? I did find code that prevents a second instance of the program from running. Unfortunately, it doesn't default to the OpenDocument option in the running instance of my program. (I'm using VS 2005, C++, MFC)
TIA
Ron
|
|
|
|
|
First, maybe check this out: Avoiding Multiple Instances of an Application[^]
Once you determine an instance of your application is already running,
you'll need a way to pass the commandline parameters from the
process launched by the Windows shell to the already-running process.
Some form of interprocess communication can do this, like a named pipe
or sockets. See Interprocess Communications[^]
When the already-running instance of the application receives a command
from the shell-launched instance, then it can open the file as usual.
The shell-launched instance can terminate.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I have a FormView based SDI App with three modeless dialogs embedded in a CTabCtrl. Sometimes I am getting the Program Shutdown while the mouse pointer placed on toolbar. Though this is not happening always, but sometimes the program halts by displaying illegal operation. I know that this happens bcoz of the modeless dialog. It happens that since the focus is changed from child window to toolbar some wierd things are happening.
Any help in this regard is highly appreciated. To give you more info, The Codeproject's CHyperbar Control in Ultimate Toolbox explain this scenario, but I could n't find out any solution.
I remain,
Shanmukha
|
|
|
|
|
hi all
I want to make a search engine using VC++, can any one help me please by any information about this subject?
Thank you
|
|
|
|