|
If you dont mind using it as a activex control, there is an article here on CP porting it to COM. Using Activex control in dialog is very simple. Would work similar to flexgrid.
ATL Grid control[^]
Cheers
Kannan
|
|
|
|
|
Need to disabled mouse and Alt + TAB and Ctrl, Alt, Del
Anyone??
\Larsson
|
|
|
|
|
You can prevent the CTRL+ALT+DEL and ALT+TAB key combinations from opening a task list in Windows 95, Windows 98, or Windows Me by calling the SystemParametersInfo function in the Win32 API.
NOTE: This is possible only in Windows 95, Windows 98, or Windows Me.
|
|
|
|
|
|
Does anyone know of a utility that will scan through your Visual C++ project and list out unused header files, multiply-included headers and the like?
We have a big project with some old code that really could use a cleaning like this.
Thanks in advance.
Andrew
|
|
|
|
|
hello @all,
i connected my mfc program and an access database with ODBC.
CDatabase db;<br />
db.Open(_T( "MyDatabase" ), FALSE,<br />
FALSE, _T( "ODBC"));<br />
the ODBC driver of my database is called 'MyDatabase'. but when i use this code, the database is not selected. i must select it myself!
what must i change to select my odbc driver from the program (i have to do nothing, after i start the program)?
thanks
mfc
|
|
|
|
|
Hi
I have two CPropertyPages dialogs, handled by CPropertySheet. I'm executing some code in the second page OnInitDialog handler. This code should be executed during creation of CTreeCtrl located on the second page. After executing this code I receive the data that is needed in first page OnInitDialog handler. Of course I can repeat execution of this code in first page OnInitDialog handler but it would be time consuming (or I can store result of this code so as to use it in second page OnInitDialog, but it means storing it in tree and I want to find easier solution). I have an idea how to solve this problem: second page must be displayed on the beginning (not a problem for me) and after that first page should be activated. The problem is that I cannot fully activate first page. I was able only to change active tab, not the active window inside propertysheet dialog. Thanks in advance for any hints.
Mariusz Popiolek
|
|
|
|
|
I am working with some legacy code where a vector<string> t is passed into my function. I created an iterator to read through the vector: vector<string>iterator p
I then pass the vector into another function. I want to also pass the iterator so that the new function continues to know where in the vector it is. What is the best way to pass this information? Thanks.
|
|
|
|
|
You want to know the index ? Why ? I guess you could pass the index as a number, I just don't get why you would do so.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
This program needs to read through the vector and essentially reads off strings sequentially as it is passed through the functions. This is old code but there is too much to rewrite anew. So the first function reads several "lines" (i.e. strings) an then the vector is passed to another function which needs to read off a variable number of "lines" and passes to other functions, etc. Each read takes the next string, thus, I am hopint to pass the iterator to keep track where it is (each function using the iterator to know which index is next to read). I have not used iterators except in very basic uses within one fuction and have not figured out how to pass one. Thanks.
|
|
|
|
|
I don't see why it would be hard to pass one - where are you stuck ?
Iterators from a vector support random access, so you can both use ++ and -- to step.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Here is what I have:
static int read_layout(std::vector<std::string> &, vector<std::string>iterator, char *)
static int read_layout(std::vector<std::string> & trs, vector<std::string>iterator pr, char *szName)
{
}
void StartReading(std::vector<std::string> & trs)
{
vector<std::string>::iterator pr;
pr = trs.begin();
string s = *pr;
strcpy( szHeader, s.c_str() );
pr++; //there are several of these types of access prior to function call
iStatus = read_layout_truss(trs, pr, szName)
}
I am not able to get this to compile as is. Hopefully I did not post this previously as my keyboard seems to be freezing on me. Thanks for your input.
|
|
|
|
|
I see - damn typedefs. They should not do any harm, beyond obsfucating your code.
I suspect you need to pass them by reference, as the vector is also being passed.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I guess you can pass the pointer to the vector!!
|
|
|
|
|
I would like to share an MFC map object accross 3 processes. I am using CMapStringToString class. Any process can initialize the map at startup and I want the other processes to use a shared copy of this map. How can I do this ? I have no idea so any suggestion is welcome.
Thanks in advance
Orcun Colak
|
|
|
|
|
i don't think is possible, especially not with MFC. you might be able to do something with shared memory, but it won't be a CMap.
-c
There's one easy way to prove the effectiveness of 'letting the market decide' when it comes to environmental protection. It's spelt 'S-U-V'.
--Holgate, from Plastic
|
|
|
|
|
It would be quite difficult to do. Probably can't do it at all with a straight up CMap.
I think the only way you could share something that dynamic across multiple processes would be to set up a memory-mapped file, and map the new and delete operators for your class to use memory from that file or something.
I had a similar problem a while ago, and ended up abandoning my design because of it.
Even a broken clock is right twice a day.
|
|
|
|
|
Good day!
I have a class that holds my data.
the part of the data is used to fill a menu ( in a toolbar ), and to fill a listbox ( in a controlbar ). the data is used with the menu command, and when the user d-click in the list.
The menu and the listbox are not directly members of the mainframe and are not UI related, and the menu handlers are handled in the CView ( it's multiple view application );
I'm still not sure where to put the data ? as part of the MainFrame since it's from there I'll create the menu and the listbox, and pass a pointer to each ctor ( or some init method ). or as a global singleton ( will pollute the namespace )?
Thanks
Max.
|
|
|
|
|
I suppose that if you're following the traditional MFC Document/View architecture, that your data should reside in your CDocument-derived class. If that's too constrictive, put in your CWinApp-derived class, since it's a global singleton anyway.
|
|
|
|
|
Hi,
I have an application that adds lots of stuff into a list box.
How can I make sure that always the last item that was added will be displayed at the bottom of the list box without having to scroll to it ?
Thanks
Shay Harel
|
|
|
|
|
m_List.EnsureVisible( m_List.GetItemCount()-1, FALSE );
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
Well, sounds great but.....
I dont see this method as a member function of CListBox .
Any more ideas ?
Shay
|
|
|
|
|
It's actually a member of CListCtrl. You may consider switching to that instead -- it gives you more options. But if you can't, try using SetCurSel to select the last item. I don't remember if it causes the list to be automatically scrolled.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
You should start using CListCtrl instead of CListBox. It has more features and, personally, I think it is easier to work with.
CListBox:
m_List.SetCurSel(m_List.GetCount()-1);
Win32 (works in any version of MFC):
Here is the 'old school' Win32 macro way to ensure that the last item is displayed (MFC is just a wrapper around Win32 calls, mostly):
ListView_EnsureVisible( hList, ListView_GetItemCount(hList)-1, FALSE );
Also, the macros ListView_EnsureVisible() and ListView_GetItemCount() are defined in commctrl.h
'F1' can go a long way...
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
I think what you need is (win32) LB_SETTOPINDEX. I think that's what it's called anyway.
|
|
|
|