|
There's no fundamental difference between both OSs when it comes to opening serial ports. This should open up "COM1"
HANDLE hCOM1=CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ever since I have been using Windows ME, Most MFC apps I create that use Docs do not have the familiar "Untitled" on the titlebar. What I get is this: "____- Appname". Also, many message boxes have only "____" instead of actual text. Common dialogs like the SaveAs dlg will often have "_______" in the titlebar. I have noticed this in other programs that I did not code. MS Paint comes to mind.
Has anyone else experienced this?
Steve
|
|
|
|
|
You know, I think Ive seen error messages come up as "______- Appname" in Win ME, but havent had the time to find out why.
Its probably something really basic that Im missing.
|
|
|
|
|
How can I get a CListCrtl Item into, say, a CString when it is clicked?
Thanks.
Richard
|
|
|
|
|
When you assign the CListCtrl a variable in the Class Wizard, make sure you assign a variable to the control, and the value...Cumon, you know what im talking about... when you assign the CListCtrl's control ID a variable, it asks for a name: m_?????
then a catagory (in a combo box): Control <----select VALUE here
then for a type (in a combo box): CListCtrl (or whatever)<---select CString here
-Reid the C++/C# programmer
(Caution: I am a teenager, and that means that I think I know everything...but probably don't...)
Maybe this will help you understand:
CPerson Reid = "Teenager";
CPerson All_C_Programmers[9999999999];
int i;
int num_Programmers_That_Are_Teenagers = 0;
for (i=0;i<9999999999;i++)
{
if (All_C_Programmers[i]=="Teenager")
{
num_Programmers_That_Are_Teenagers++;
}
}
cout << num_Programmers_That_Are_Teenagers;
-------------
1 <------
|
|
|
|
|
Not true. I am a teenager too.
-Matt Newman
|
|
|
|
|
The fool who considers himself wise is a fool indeed.
|
|
|
|
|
You can either handle the WM_LBUTTONDOWN message in the List-View and use the folowing to get the item's text;
int nItem = GetNextItem ( -1, LVNI_SELECTED | LVNI_FOCUSED );<br />
CString sItemText = GetItemText ( nItem, 0 );
Or you can handle the List-View's NM_CLICK notification and grab the text as above, using the index given in the NMITEMACTIVATE structure.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Hi,
What I am looking to do is create my own bitmap, out of 2 existing bitmaps. Drawing one half way over another.
Can anyone give me a quick overview of the best way to do this.
Cheers
Richard
|
|
|
|
|
By half way do you mean half way along, or alphablended ? If the former, then just draw it on where you want it. If the latter, then you need to access the bits and alphablend them together. GDI+ is the easiest way to do this ( see my articles ) otherwise you need to create DIBSection's, so you can access the bits directly. The issue of CUJ on the wewbsite has code online for a tech tip that shows how to do this. There is also a DIBSection wrapper here on the site.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hi all,
I need to update the statusbar text of an SDI app. from within multiple views created using a splitter. How do I do this? The statusbar is instantiated in the mainframe (CMainFrame), and I don't appear to be able to access it. It would be nice to create a document level function that could set the statusbar text so that from each of my views I could do something like GetDocument().SetStatusBarText("Hello");
Any ideas??
TIA
Jonathan Thorpe
|
|
|
|
|
CStatusBar* CMainFrame::GetStatusBar()
{
return &m_wndStatusBar;
} Now you have access to it. CMainFrame is accessible anywhere; call AfxGetMainWnd() and cast the return to a CMainFrame*
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
I have a class that docks resizable dialogbars,.. but I have a problem saving the state and loading it. The states are actually save/load correctly but because my dialogbars are dynamic, by this I mean that if I start the application then there might only be 3 dialogbars and next time prehaps only 10 or 1 or whatever...
The LoadBarState crashes when I do this,.. does anybody know that MFC internal code does to save the dialogbar states,.. prehaps saving and loading it myself might work better... but I can't see what the internal values are?
anybody.
Peter Marino ( IO Interactive )
|
|
|
|
|
The way I got around this was to create the dialogbars myself (using new) BEFORE calling LoadBarState. That way, you don't rely on the framework to create them for you. This assumes, though, that the dialogbars you want to open on launch of your app are the ones that were open when you last shut it down.
Let me know if you need any more help.
|
|
|
|
|
That's my main problem,.. all my dialogbars are created via plugins,.. and I can't assume that all users will have the same number or even the same plugins when they start the application. So I need a general way of positioning the dialogbars on startup.
For example if a user has dialog A,B,C. And next time he starts he has dialogbar A and D. Then dialogbar A should have the same position as last time, and because dialog D is new it should be set to floating. The main problem is that LoadBarState is expecting the same number of dialogs and that the dialogbars have the same ID. Because the plugins are dynamic then all dialogbars are given different ID numbers at startup.
I hope this makes it clearer.,
Peter Marino ( IO Interactive )
|
|
|
|
|
Damnit! I just typed out this whole response to you, and Explorer ate it. Frigging microsoft...
Anyways, here's the gist of what i typed:
I can tell that my app will be heading down this exact same path, so I hope we find an answer to this question together.
I think that Load/SaveBarState info is all contextual info, meaning, the info is based on the dialogbars docked position/size relative to (in the context of) all the other docked dialogbars and toolbars, so I don't think LoadBarState will ever be able to work for you under these circumstances.
Even if you get around that, you'll still have to figure out a way to get LoadBarState to ignore (i.e. not create) dialog bars for which the user doesn't have a dll for.
There is a method on CFrameWnd called GetDockState which fills a CDockState object. You might try calling that to see what you can find.
But, I think your best bet is to do the loading/saving of docking info yourself, and use a couple of undocumented public methods on CControlBar:
void GetBarInfo(CControlBarInfo* pInfo);
void SetBarInfo(CControlBarInfo* pInfo, CFrameWnd* pFrameWnd);
browse the MFC source code to see how these work. They are declared in the header AFXEXT.H, and CControlBarInfo is defined in AFXPRIV.H, as are a couple of other useful classes.
Let me know what you find!
D
|
|
|
|
|
p.s. This comment is at the top of those header files. So, use at your own discretion/caution:
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
|
|
|
|
|
oops. meant to copy this in:
// Note: This header file contains useful classes that are documented only
// in the MFC Technical Notes. These classes may change from version to
// version, so be prepared to change your code accordingly if you utilize
// this header. In the future, commonly used portions of this header
// may be moved and officially documented.
|
|
|
|
|
ok,.. I've worked a couple hours on this,.. and I have a version now that can save some of the dialogbar states and reload them dynamically. This works also if the ID has changed and if the dialogbar is new or delete... so far so good....
now I have problem with that if two dialogbars share the same row,.. they do not get put into the same row,.. do you know what information that tells CControlBar what row/column a dialogbar is in?
Peter Marino ( IO Interactive www.marino.dk )
|
|
|
|
|
I'm not exactly sure. There is a class derived from CControlBar called CDockBar, which is does the docking for controlbars. You might look at CFrameWnd::DockControlBar source, and CDockBar::DockControlBar source, and the MSDN docs on them, and see what you can do. I think all you need to do is supply a rectangle in screen coordinates to CDockBar::DockControlBar, but I haven't looked into it enough...
Lemme know, and good luck.
|
|
|
|
|
The CDockBar is not documented,.. and I only have the header source,...
do you know where I could get some information on it? and where I could get the .cpp source for it?
|
|
|
|
|
It's not documented because it's likely that the methods and variables of the class will change in future releases. If you go to your VC installation Directory:
...\Microsoft Visual Studio\VC98\MFC\SRC
and do a search for files below that directory with the text "CDockBar::" in them. You should get
BarDock.cpp and DockStat.cpp. CDockBar implementation is in BarDock.cpp, but look in both for useful info.
|
|
|
|
|
|
I've done some debugging,.. checking to see how the CControlBar is intergrated with MFC... I would really like to say thanks for pointing out that the source code for MFC was on my harddisk I didn't even know that.
I haven't any solution right now,.. and I have just started my vacation and will be leaving tommorow to see the WM for Tumbling/Trampolin the next 1½ weeks,... so there will be a pause before I can continue,... but as soon as I get back,.. I'll continue where I left off and notify you of my status.
thanx again
Peter Marino ( IO Interactive )
|
|
|
|
|
If I want to use in exa numbers (base 16)
Which is type of variable I need ? (int, double,BYTE or another) ?
|
|
|
|