|
Is there any way to fix toolbar to stay no more than 2 rows when you make window smaller just like microsoft word. Right now when you make window smaller tool bar aligned to left size becomes 4 rows.
Thanks in advance
|
|
|
|
|
Look at an example in MSDN!
Hello World!
|
|
|
|
|
i'm trying to communicate with a relay box connected with a serial cable. you send a command of N1 to open the first relay, N2 to open the second, etc... i've tested it with hyperterminal and it works fine. i'm usin a c++ mfc app in vs.net03. i've just added code to my program, if there are any settings that i have to set, then i don't know about them. i'm using the CSerial class
http://www.codeproject.com/system/serial.asp
portName and relay are both CStrings. anyone know what's wrong??
CSerial link;
link.Open(portName); //either COM1 or COM2
//set the port settings
link.Setup(CSerial::EBaudrate(9600), CSerial::EDataBits(,
CSerial::EParity(NOPARITY), CSerial::EStopBits(ONESTOPBIT));
if(relay[0]=='1')
relay.Delete(0,1);
link.Write(relay); //writing "N1" or whatever
//find time for pump to stay open
runtime=drinklist[num].amount[x]*MULTIPLIER;
Sleep(runtime*1000);
relay.Delete(0,1);
relay.Insert(0,"F");
link.Write(relay);
link.Close();
thanx
|
|
|
|
|
From you example:
link.Setup(CSerial::EBaudrate(9600), CSerial::EDataBits(,
CSerial::EParity(NOPARITY), CSerial::EStopBits(ONESTOPBIT));
From http://www.codeproject.com/system/serial.asp:
serial.Setup(CSerial::EBaud9600,CSerial::EData8,CSerial::EParNone,CSerial::EStop1);
Just a thought!
INTP
|
|
|
|
|
those two lines are the same, or so the example says. any other suggestions. i'm really stuck here
|
|
|
|
|
When working on serial communication I have found it usful to run a terminal program on another machine and capture the data output from my program. If it receives garbage, then it is a port setup problem (or bad serial port). If it receive nothing, then either I selected the wrong output port or (heaven forbid) I forgot to make sure the port open successfuly.
I hope this will at least help a little, since I have not used CSerial. I tend to write my own using file I/O (on Win32 platforms).
INTP
|
|
|
|
|
Hi,
Could you please let me know how you can runa terminal program to capture the output from another program?I am in the process of developing a serial communication between a laptop and PDA.I have to send data from the lpatop which has to be read by the PDA.
Thanking you for your time,
Deepa.
John R. Shaw wrote:
When working on serial communication I have found it usful to run a terminal program on another machine and capture the data output from my program. If it receives garbage, then it is a port setup problem (or bad serial port). If it receive nothing, then either I selected the wrong output port or (heaven forbid) I forgot to make sure the port open successfuly.
I hope this will at least help a little, since I have not used CSerial. I tend to write my own using file I/O (on Win32 platforms).
INTP
|
|
|
|
|
I have not used CSerial either.
In order to use a terminal program, such as hyper-terminal (comes with all PC versions of windows), you will need to make null-modem cable or you may buy one at a computer supply store like radio shack. The wiring for a null-modem cable can be found on the net or in a book on serial communications. If you are doing your serial communication using a USB port, you may also need a USB to 9-pin serial cable or 2. When you setup the teminal side, you need to make sure that it is not doing something funky with that data (like replacing CR with CR/LF). The data must be saved without modification (received as binary not text). Once you have set the serial-port properties, then all you need to do is select receive file. The terminal program will sit there and wait until data starts arriving at the port, at which time it will start coping the data to the given file (for later analisys).
Well, I hope this helps you!
Good Luck!
INTP
|
|
|
|
|
if I have open handle of the registry key and want to get the full path against this key, Is there any way for getting this path.
|
|
|
|
|
Hi,
Look for the following APIs on MSDN
RegOpenKeyEx
RegQueryValueEx
Pankaj
Without struggle, there is no progress
|
|
|
|
|
I think I am unable to deliver my point
look at this example
if i get the handle to the key like this
HKEY hSubKey;
hRootKey=HKEY_CURRENT_USER;
CString csSubKeyName(AppEvents\\EventLabels);
RegOpenKeyEx(hRootKey,csSubKeyName.operator LPCTSTR(),0,KEY_ALL_ACCESS,&hSubKey);
Now I have the handle of Sub key in hSubKey, what I want to do now is to find full keyPath against this handle which is
HKEY_CURRENT_USER\AppEvents\EventLabels
but I dont how to get this full path
|
|
|
|
|
still waiting for any comments
|
|
|
|
|
Hi,
I want to link my code with a static library mysqlclient.lib. How d I do this?
Karteek
|
|
|
|
|
Project->Settings->Link
Object/Library Module
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
or just write in your code
#pragma comment(lib,"yourlib");
which does very much the same
|
|
|
|
|
I Use CListCtrl and do exactly these steps:
Make some columns, then add some elements into the controll, then delete them and delete all the column. Then i repeat the same action some time. And i lose some memory on this operation.
Does anybody know what problem do I have with memory leak???
Please Help...
There are some expressions frome my code:
It is a function
void CChanelsSchedul::OnChanelChanged()
{
if(m_ADODatabase.IsOpen())
{
CMainFrame* mainframe = reinterpret_cast<cmainframe*>(AfxGetMainWnd());
CChanels* chanels = reinterpret_cast<cchanels*>(mainframe->m_wndSplitter.GetPane(0,0));
CListCtrl* lcontroll = &(chanels->GetListCtrl());
POSITION pos = lcontroll->GetFirstSelectedItemPosition();
int ID = chanels->ID[lcontroll->GetNextSelectedItem(pos)];
CADOParameter Chanel_ID(CADORecordset::typeInteger,sizeof(int));
Chanel_ID.SetValue(ID);
m_ChanelsSchedulList.DeleteAllItems();
int itemCount = m_ChanelsSchedulList.GetHeaderCtrl()->GetItemCount();
for(int i = 0;i
|
|
|
|
|
Please use <pre> before code and </pre> after code, to preserve code format.
If you break out some of the code and place it in helper functions, you should find it much easier to solve the problem.
If you are not using one of the memory checker programs, then I recommend you download a trial copy of BoundsChecker or MemoryCheck (ect...).
INTP
|
|
|
|
|
Thanks for advise about memory monitoring programm.
And i'll show a shorter programm for convinience:
void SomeFunction(void)
{
m_ChanelsSchedulList.DeleteAllItems();
int itemCount = m_ChanelsSchedulList.GetHeaderCtrl()->GetItemCount();
for(int i = 0;i < itemCount;i++)
m_ChanelsSchedulList.DeleteColumn(0);
m_ChanelsSchedulList.InsertColumn(0,"Programm ID",LVCFMT_LEFT,80);
m_ChanelsSchedulList.InsertColumn(1,"Date",LVCFMT_LEFT,70);
m_ChanelsSchedulList.InsertColumn(2,"Time",LVCFMT_LEFT,50);
m_ChanelsSchedulList.InsertColumn(3,"Week",LVCFMT_LEFT,70);
m_ChanelsSchedulList.InsertColumn(4,"Duration",LVCFMT_LEFT,70);
m_ChanelsSchedulList.InsertColumn(5,"Programm Name",LVCFMT_LEFT,300);
i = counter;
j = counter;
m_ChanelsSchedulList.InsertItem(i,Something);
m_ChanelsSchedulList.SetItemText(i,j,Something);
}
And i Call this function some times, and i notice memory leak.
|
|
|
|
|
Well may be this is the problem:
for(int i = 0;i < itemCount;i++)
m_ChanelsSchedulList.DeleteColumn(0);
for(int i = 0;i < itemCount;i++)
m_ChanelsSchedulList.DeleteColumn(i);
INTP
|
|
|
|
|
Well, i have this question regarding sound, hope someone can help me out:
I have 2 microphones attached to my sound card and one is placed nearer to me and the other one further away. When i make a sound, the 2 microphones will record it. So the question is, how do i compare the 2 sound data to find out which microphone is nearer to me?
Weiye, Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
How the heck did you do that? My sound card has only one input available.
While I haven't a clue how to do this programmatically, from an engineering view I know that you first have to restore the digital signals to raw PCM, then analyze the two separate signals for differences. Two approaches work - phase shift, and amplitude change, as the more distant mic's signal will be both delayed in time and diminished in amplitude. Given the limitations of resolution in digitizing, I think that the phase shift will be more easily detected than the amplitude change. The speed of sound is 331.4 + .6Tc (where T = temperature in C) m/s - the sample rate of the sound card will determine the accuracy possible. As to how you go about accomplishing this in code, I haven't a clue, but it certainly sounds fun. I've been mulling over something just like this for years - a method of tracking people walking across my yard using buried mics and a PC - but I haven't yet begun to actually research the specifics. I'd be very interested in seeing what you come up with!
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
Well, i am not too sure about the details though. It is my friend's acadamic project and she is seeking help cos she has neither the programming nor engineering knowledge on this.
From what i heard from her, something like this is already done by a postgraduate, but it isn't real time. Her task would be to make it so. She had approached that postgraduate for some codes but apparently, what she got wasn't enough.
Anyway, thanks for your help. I'll see how much more info i can get. May be posting on this again.
Weiye, Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
Your friend should team with an electronics engineering student - they are often required to make something useful as a Senior Project. Real time programs don't fit the Windows model very well, btw - you usually have to resort to a RTOS solution, and most of them support C, not C++. If this is intended to track voice signals, she'll need to sample the signals at an 8 kHz rate as a minimum in order to satisfy the Nyquist theorem, but modern A/D circuits do this easily. I wouldn't try for any higher rate, though, as aliasing will become a problem. I look forward to seeing future posts on this subject - it interests me, and probably more than a few of us on this site.
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
Bravo !
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
MailMonty wrote:
Bravo !
Are you a fellow engineer? We're rather rare here, you know...
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|