|
By nature the comm ports are asyncronous. "sharing" them is not feasible as it makes logical sence that only one program at a time would be reading / writing data via a comm port.
Simply open them when you have data you wish to read from or write to the port and close it as soon as you are done.
Some applications are arrogant enough to think that they have permenant control of hardware resources such as the comm ports. Palm "Hotsync" is one that comes to mind, opening the comm port and holding it open the entire time it runs. The solution to someone needing to share the comm port is to close these errant apps and only allow them control of the port when their device is read to communicate via the comm port.
I guess that last sentence really says it all. By nature you need to know when "your data" is coming down the async stream and read it. The rest of the time you care less what data is coming in. The same goes for outbound data.
On the other hand if you truly wish to "share" the data coming in via the comm port then write a single program that reads and records the data to a fifo file and use that file as input to the various applications that are all wanting to read the same data. You cannot share the port for output since that would mean a garbled data stream going out.
|
|
|
|
|
Hi!
I have a database project using MFC and ODBC. When we create a ODBC project, we obtain a CMyRecordView class derived from CRecordView. This class use a dialog template to represent data.
I want to use a CListCtrl to represent my data.
So in my class CMyRecordView.h I have declared
CListCtrl m_wndListCtrl;
In my CMyRecordView.cpp :
DDX_Control(pDX, IDC_LISTCTRL_VIEWDATA, m_wndListCtrl);
and :
void CDataBaseManagerView::OnInitialUpdate()
{
m_wndListCtrl.InsertColumn(0,_T("Item"),LVCFMT_LEFT,100);
m_wndListCtrl.InsertColumn(1, _T("Value"),LVCFMT_LEFT, 100);
m_wndListCtrl.InsertColumn(2, _T("Time"), LVCFMT_LEFT, 100);
m_pSet = &GetDocument()->m_DataBaseManagerSet;
CRecordView::OnInitialUpdate();
}
In my dialog, my control style is set to VS_REPORT
The problem is that I dont see my columns.
I see a grey bar, but I dont see any text and I dont see any line break.
thanks for helping...
Everything's beautiful if you look at it long enough...
|
|
|
|
|
something similar happened to me. Try putting your code OnInitialUpdate() code in OnCreate().ie. add a WM_CREATE handler thru classwiz and add code there.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - PocketPC New menu
Office addin
|
|
|
|
|
|
Nop, I didn't work,
I think that the problem is caused by the fact that it's a CRecordView derived class. I will try to used a CPropertySheet and CPropertyPage
Everything's beautiful if you look at it long enough...
|
|
|
|
|
I using CWebControl2 to show a web page in one of my UI.
It's working nicelly, but there are no controls, I wasn't sure to expect them or not.
Is there some default "explorer band" that I can use ?
Thanks.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
If you can get the IHtmlWindow2 interface, then call ShowBrowserBand().
|
|
|
|
|
Hi,
This is not a programming question but I did not want to post it in the lounge.
I would like to know how to map data values to a logarithmic scale. Fr example, say I have numbers in the range of 0-50,000 and I want to map them between 0 to 1. I once read that I can use a logarithmic scale for such scaling purposes. How can I do this?
Thanks for any help.
Pankaj
Without struggle, there is no progress
|
|
|
|
|
logarithmic scale is usefull to reveal percentage changes.
"A change from 100 to 200, for example, is presented in the same way as a change from 1,000 to 2,000."
or to represent really "big" numbers or small ones all together
lets say u have 10 exp(500) and 10 exp (-500) and values between u can represent it much better if u use log of the values
If u want to represent between 0 and 1 u can divide by the maximum of ur segment
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Just plot the values of log(n)50 i.e. log of n (the data value) to the base 50. They will range from 0 to 1.
<edit>
Ooops - I meant to the base 50000. Thanks JB!
</edit>
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi, i have two questions.
1) I have been studying the CArchive a bit but what i don't understand is when for example when you save two CStrings, the Archive somehow "Archives" it putting some Byte data in between the string values when u look at the file. I would like to know WHY and how does this system work? why does it do that (well obviously my guess would be to determine where a variable begins and ends, but how? what the system behind it?).
2) How does the < > operator work? For example:
CList <CString, CString> *mylist;
what does that do??
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
1. Right, what do u mean by "what the system behind it?"
2. Check templates in any C++ book or tutorial or here at CP
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
1) i mean, how does it work... why does it insert a byte 06(in hex) and one 05 etc at certain places, or how does it determine what value goes where, it puts some bytes of data between the variables to recognise them (i think) but what data? i mean.. god, it must have a meaning!! lol
2) ok
Kuniva
--------------------------------------------
|
|
|
|
|
1. These are "special signature to recognize unicode strings"
For more info search for the file ARCCORE.CPP in VC++ folder
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Serialization usually causes a signature, an optional version/schema id, and binary data to be written to physical storage. See this[^] article.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
yes, but i read that article 10 times already, it doesnt say what kinda of data the CArchive delivers and how it works internally. The reason i want to know this is because, before there even was MFC or a CArchive, programmers must made some kind of function of their own to act like a CArchive and sort the data, and maybe they worked differently from the CArchive, thats why i want to know how it works, and maybe how to do the same thing, but without MFC...
Kuniva
--------------------------------------------
|
|
|
|
|
CArchive is just a convenient conduit class that provides a streaming operator for a variety of standard objects. You could write your own low level serialization code by providing your object with a serialize() method that takes a FILE* (instead of a CArchive* ) and a flag that indicates whether the object is being read or written.
As I mentioned, the actual process of serialization usually causes a signature, an optional version/schema id, and binary data to be written to physical storage (i.e. the file).
Hope this helps!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
1) CString stores the length of the string before the string, so for the string "Hello", it would store a byte with the value 5, and then the actual string data. This is documented in the CString/CArchive documentation (sorry, I can't remember which one).
2) They're called templates. There is plenty of information about templates on CP. Have a look at some of the articles. Basically, they let you customize a class without having to rewrite it, eg. You could have a CList<cstring,cstring> or CList<int,int> without having to write two different classes. Again, have a look at the articles for a more in-depth discussion of templates.
Hope this helps
Ryan
He who laughs last thinks too slowly.
|
|
|
|
|
I'm writing a program that will search for files. So I let the user pick the starting drive or path and the file name (the file name can have a wild card in it) example path = c:\ filename = doc.t*. I string them together and pass this to the findfirstfile api. If nothing matches the filename then it errors out with and invalid handle. So how do I make it go to the next directory under that path to find the file? Or how do I make it keep searching for the file until it finds it and returns the path to me?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
|
I'm not looking for a class that I can include into my program. I just wanted to know how it's done.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
You need to get the list of subdirs in the current dir, then recursively call your function (which ends up searching for
files and subdirs). Functions like these usually have signatures
of the type:
void findFiles
(CString strWildcard,
CStringArray& listOfLocatedFiles,
bool bRecurse)
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello
I have figured out how tome make the changes to the SPDemo program on this site. http://www.codeproject.com/splitter/SimpleDlgSplitter.asp
However, when I went into the ResourceView tab and clicked on Dialog I wanted to remove one of the three windows. I deleted the top right window and it complied fine. But when I try to run it I get this error.
"Debug Assertion Failed"
"Program: ...\Microsoft Visual Studio\My Projects\SPDemo\Debug\SPDemo.exe"
"File: dlgdata.cpp"
"Line: 43"
This file is part of the MFC library and that line in that file is "ASSERT(FALSE)"
What does this mean and how can I fix it?
Thanks
Scott
|
|
|
|
|
Hi
Here is my problem.
I am programming in Win32. I create a window that contains a treeview window child :
hTV = CreateWindow(
WC_TREEVIEW,
NULL,
WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | WS_CAPTION |
TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS ,
rect.left,rect.top,rect.right/4,rect.bottom/2,
hwnd, // parent window
NULL,
(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
NULL);
It works well except that instead of having the whole background of the treeview as white (which is I think the default color), the background of the "decoration" stuff (lines at root, lines, buttons) of the treeview is gray.
I would like to have it all white.
Would someone know how to do that ?
Thanks in advance for help
Ben.
|
|
|
|
|
I have to develop an application having a not easy
User Interface.
I have to show serveral panels in the MainFrame
(not at the same time) and I have to change the
MainFrame structure according to the panel shown inside
it (in some cases I have to show and manage a splitter,
in other cases I need the whole MainFrame).
How can I solve this problem ?
I've tried to create a MDI application and I have
registered some tamplates as shown in the following
code.
AddDocTemplate(new CMultiDocTemplate(
IDR_LANGUATYPE,
RUNTIME_CLASS(CLanguageProblemsDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CLanguageProblemsView)));
// Form Rilevamento dati
AddDocTemplate(new CMultiDocTemplate(
IDR_RILEVAM_DATI,
RUNTIME_CLASS(CLanguageProblemsDoc),
RUNTIME_CLASS(CSplitterFrame),
RUNTIME_CLASS(CRilevamentoDatiView)));
I have made this choice in order to have different
templates to create and show when I want.
(I'm not sure that this is the rigth way to solve my problem).
Now the problem is that I don't know how to select the
appropriate template to create and I don't known how
to switch from a document to the other one (all by code).
Can someone help me ??
Thanks a lot !!!
|
|
|
|