|
Up until this time, i've been programming with turbo c from 100 years ago, and i haven't had any luck communicating with a meter. The code is not the problem, we've gotten similar programs to work, but we want to try using c++ to code in.
I've been using the bioscom() function of tc, which is very easy, but now that we're looking at c++, i haven't found anything similar.
Can someone point me to somewhere that has a general description of how so use c++ to communicate with a serial port?
*.*
cin >> knowledge;
|
|
|
|
|
|
In Win32 API you use CreateFile() to open the port. Look at the docs for that. ReadFile() and WriteFile() are used to send and receive data. CloseHandle() closes the port.
John
|
|
|
|
|
Hi there,
I have the complete path of a file in a CString variable and I want that first the appropriate application should be executed and then the file should be opened.
For ex,
If the file name is "abc.doc" then first the application MS-WORD should be invoked and then the file should open in it.
Please tell me how to do this.
Gaurav Gumber
|
|
|
|
|
You can do that with ShellExecute
|
|
|
|
|
Hi,
I have a Dialogbar with some edit control into it. I want to set the focus on the first one. The focus seem to work right because the caret appear in the first edit control but my text in the control is not selected. what am I doing wrong? I would like to have the text selected so that I could change my text into the control without having to delete it first.
thanks for helping
Mykel
Everything's beautiful if you look at it long enough...
|
|
|
|
|
Use SetSel(..)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cedit.3a3a.setsel.asp
|
|
|
|
|
Are you calling MyEdit.SetSel(0, -1); ?
This should select the whole text content of your edit box.
[EDIT]This is the same as calling
::SendMessage(
(HWND) hWnd,
EM_SETSEL,
(WPARAM) 0,
(LPARAM) -1
); [/EDIT]
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I have the same kind of problem ...
when my editbox received the focus, I want to select all text in it.
ON_EN_SETFOCUS(CMbCoordEdit::IDC_EDIT2, OnSetfocusControl2)
...
void CMbCoordCtrl::OnSetfocusControl2()
{
m_edit2.SetSel( 0, -1);
}
That doesn't work when clicking in the editbox.
Setting the selection manually from another function works, but not like that.
any hints ?
Thanks.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
hi there
i want to access a windows share programmaticly ( e.g. \\mycomputer\mydir\myfile)
i can do this by write code like this: cfile( "\\...", ... ) ... but a dialog is shown and asks for a username & password ...
is there any api or something like that to set username and password programmaticly?
thanks for reading
|
|
|
|
|
hello,
can someone tell me how to disable the drag&drop in a RichEdit control ?
Do I have to use IRichEditOleCallback and how ?
1MB of thanks in advance
|
|
|
|
|
Hello
I've written a logfile class that writes the logentries in xml format.
A typical usage:
mylog.WriteLog(LOG_PRIO_HIGH, "Agroup", "This is a text with %d some %s
vars", 34, "diffrent");
output
<entry date="2003-01-01" time="20:01:32:1234" prio="1"
group="Agroup">This is a text with 39 some diffrent vars</entry>
I want to accomplish the same thing by using streams/stringbuf.
But I've not found any good examples that show me how I should do.
What i've found is a couple of examples that derives a class from stringbuf and from ostream.
I would be nice of I can get something like this:
log << log_prio(1) << log_group("test") << "hello" << nIntVar << strBuf << log_end;
log << "this is a string";
log << " something more" << log_end;
log << log_prio(2) << "last line" << log_end;
would look like:
<entry date="2003-01-01" time="20:01:32:1234" prio="1" group="test">hello1yeye</entry>
<entry date="2003-01-01" time="20:01:32:2200" prio="1" group="test">this is a string something more</entry>
<entry date="2003-01-01" time="20:01:32:6600" prio="2" group="test">last line</entry>
How do I accomplish this?
Thanks,
Jonas
|
|
|
|
|
Hi All,
suppose we are on IE and we right click to open the new ie window there or use shift + click...that opens IE in new window..I want to implement such a thing that when anyone clicks on a link that opens new window or he intentionally opens it in new window..the new window shud not appear..I found something like:::
void CDWebBrowserEvents::OnNewWindow(BSTR URL, long Flags, BSTR TargetFrameName, VARIANT* PostData, BSTR Headers, BOOL FAR* Processed)
{
if (m_Browser) {
COleVariant varEmpty;
*Processed = TRUE;
m_Browser->Navigate((LPCSTR)URL, &varEmpty, &varEmpty, &varEmpty, &varEmpty);
}
}
this function call doesnt seem to work as..when I click on new window..the event is fired...but it shows an exception in *processed=true; I tried changing the definition of newwindow..but that also doesnt work becz then the function never gets called...I need it very urgently...Any help or pointers are highly appreciated..Thanks a lot in advance..
Himanshu
|
|
|
|
|
If you are getting an exception at: *Processed = TRUE; then I would assume Processed is NULL and you need:
if ( Processed != NULL )
*Processed = TRUE;
Not testing pointers for NULL is a dangerous game to play.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi Neville,
I have developed an application and I want to load it at startup..I have
done that..but it takes some time to load..I want the process to be fast and
user is not able to access the desktop in the meantime before seeing my
application..is there anyone who can help me out..any help or pointers are
highly appreciated..Thanks a lot in advance..I am on win2000. And I really
need to do it fast..plz help
there is another small problem..I am using a webbrowser control to open
IE..and I want that when user clicks on a link that opens a new window or
just rightclicks to open in new window..the new window should not
appear..there I got some code which does that...which is like::
DISP_FUNCTION_ID(CWebBrowser2, "NewWindow2",DISPID_NEWWINDOW2,
OnNewWindow2, VT_EMPTY, VTS_DISPATCH VTS_PBOOL)
DISP_FUNCTION_ID(CWebBrowser2, "NewWindow2",DISPID_NEWWINDOW2,
OnNewWindow2, VT_EMPTY, VTS_BSTR VTS_I4 VTS_BSTR VTS_PVARIANT VTS_BSTR
VTS_PBOOL)
When i use first def. it works ok and putting cancel=true works and no new
window opens. but that breaks th eexecution of program and hence i need to
open the same url in parent window..so when i use second definition the
function is never called..I want to know whether there is anything wrong
with the definition or what..whatever u said must work..but if once the
function is called then only i will be able to know that it is working or
not..m_pBrowserApp is an object of IWebBrowser2..
virtual void OnNewWindow2(LPDISPATCH FAR* ppDisp, BOOL* Cancel);
// virtual void OnNewWindow2(BSTR URL, long Flags, BSTR
TargetFrameName,VARIANT* PostData, BSTR Headers, BOOL FAR* Processed);
Please let me know where I am wrong..
Thanks a lot..waiting for ur reply..
Himanshu
Himanshu
|
|
|
|
|
|
Hi all, I have a simple dialog class that has a combo box, and a few edit ctrls, i connect them to CEdit and CComboBox classes etc. and i have my dialog catch the combobox events by COMMAND_ID_HANDLER(IDC_COMBO, OnCombo) and in OnCombo, depending on what they select i fill in the other edit ctrls with values, and i want to set the combobox ctrl text to a different value then what was selected by the user. but whenever i try this, just by CComboBox.SetWindowText("blah") it never works, all the other editctrls change to what i set them, but not the combobox. any ideas anyone ?
thanks
luke.
|
|
|
|
|
Hello all,
I'm having troubles positioning my current record indicator programmicaly on the last record.
Let's say I have a CListCtrl in report mode, Filled with some records.
I have a button which inserts a new record in the list, and I want to position the record indicator (that blue line) on the newly inserted record.
I tried:
m_cListCtrl.EnsureVisible(m_cListCtrl.GetItemCount()-1, FALSE);<br />
m_cListCtrl.SetItemState(m_cListCtrl.GetItemCount()-1, LVIS_SELECTED, LVIS_SELECTED);<br />
m_cListCtrl.SetSelectionMark(m_cListCtrl.GetItemCount()-1);<br />
which shows me the record, the blue line is in the correct position, but my focus isn't. When I press Up, the record indicator jumps back 2 positions.
What is the correct way to do this positioning?
|
|
|
|
|
Wim Jans wrote:
m_cListCtrl.SetItemState(m_cListCtrl.GetItemCount()-1, LVIS_SELECTED, LVIS_SELECTED);
How about:
m_cListCtrl.SetItemState(m_cListCtrl.GetItemCount()-1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
|
|
|
|
Easy but efficient
Thanks!
|
|
|
|
|
What's the difference between:
String* __gc SomeMemberFunc()
and
String __gc * SomeMemberFunc()
Thanks.
norm
|
|
|
|
|
HI All,
Can anyone tell me how can i write the foll VB syntax in VC++ :
DataGrid1.Columns(0).Value = "Sid"
thanx,
Sid.
|
|
|
|
|
Hi
i seem to be getting an intermitant error
in my application when i send XML posts to our
web service
the error is
Run-time error '-2146697211 (800c0005)'
does ne1 have any ideas ? it only seems to happen
ocassionally
thnkas
si
|
|
|
|
|
I need to create new outlook express button, that do something, can you tell me where to start? I can't imagine where to find informations about this. Tried search engines, groups, but find no information on this topic.
|
|
|
|
|
What do you call a Outlook Express button? The button from a toolbar or what?
Best regards,
Eugene Pustovoyt
|
|
|
|