|
Operator preceedence. Evaluation of the function operator "()" goes before evaluation of ".*". Put t.*fnc in paranthesis and everything works:
fnc=BinarySearchTree::remove;
(t*.fnc)();
For reference, search VC++ docs at MSDN Lib for "pointer to member", see the article "Expressions with Pointer-to-Member Operators".
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Once again, you're right.
Thank you for your patience--it's is sincerely appreciated. I'll also refer to the article.
How long have you been coding for?
|
|
|
|
|
Around 15 years. If interested you can see check my profile (just click on the little head next to my name).
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I Tried to do what I have with success done with a normal program, to put resources in dll files.
I've done everything accordning to "Q198846-HOWTO: Create Localized Resource DLLs for MFC Application".
However, in a ActiveX this doesn't seem to work.
First problem is when compiling the ResourceDll.
It complains that the file "MyOcx.tlb" can't be found, thats not odd, since it hasn't been created yet.
//from the MyOcx.rc file
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
//1 TYPELIB "MyOcx.tlb"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
So I snuffed it out and tried, and it compiled. Well that won't probably work later, but i kept trying.
I Compiled the MyOcx and it worked, until it tries to register the ActiveX Control. Then regsvr32 asserts, so it cant be registered.
I presume it's either the preprocessor def AFX_RESOURCE_DLL or the LoadLibrary i make that crashes it.
So now my question is, can I, in any way, add multilanguage support to my ActiveX, or do I have to think in a totally diffrent way and maybe use plain old textfiles for language files.
TIA
Fredrik Sigbjörn
|
|
|
|
|
Hi,
I recently discovered the CTabCtrlSSL demo on this site (http://www.codeproject.com/tabctrl/ctabctrlssl.asp) and this was exactly what I needed for my problem... but still not completely.
In my program I had the situation in which I have one dialog showing up on 2 places: once as a stand alone modal dialog and once within a tab control as a sheet of the tab control. In situation 1 I need to show the title bar, in the second case I need to hide it. (I created the dialog in the resource as a title-bar-less dialog)
The problem is that I don't know how to do this in an easy way. I figured out it's got something to do with the CreateEx function, but how do I fit all this inside the dlg-framework??
Thanx,
Dave
Structured programming vs. chaotic mind boggling
|
|
|
|
|
How does it work ? (in relation to TCP/IP )
and how||where do I alter it ?
Thanks for your time
Regardz
Colin J Davies
|
|
|
|
|
Hi,
I'm capturing the mouse with "SetCapture()" and then process the mouse movement in OnMouseMove(UINT nFlags, CPoint point).
The problem is that every time I get outside of my dialog window, the OnMouseMove routine isn't called anymore. How come
My project is a dialog based application and I remember not having this problem with a non-dialog based application.
Also how can I make my cursor invisible?
Any idea??
Thanks
|
|
|
|
|
I think non-dialog and dialog based applications have the same problem. Because once the mouse move outside a window, the mouse messages won't be sent to the window unless a mouse button has been pressed down. It is capable even to the window used "SetCapture()". Sorry but it's out of my reach to solve this problem. But you can use the sentence "::SetCursor(::LoadCursor(NULL,NULL));" to make your cursor invisble and use the sentence "::SetCursor(::LoadCursor(NULL,IDC_ARROW));" to restore it. And, you can always use GetCursorPos() function to retrieve the mouse cursor's current position.
Hope it can help you.
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
Yes, your are right, I noticed that it has nothing to do with dialog/non-dialog based application. It just happened that in one I used the mouse capture while the mouse button was down...
Thanks again for your help
|
|
|
|
|
Not sure if this is a question or just a rant....
Anyway, I was working on a WTL dialog-based app (WHotfixCheck actually (shameless plug!)) and I added a button which calls up a CFileDialog. Well, just adding a reference to CFileDialog added about 120K, yes 120K, to the release build. Wassup wit' dat?!?
Changing the release optimization from max speed to min size got it down to about 90K, but still... that don't make no sense. CFileDialog doesn't do that much.
--Mike--
http://home.inreach.com/mdunn/
"The Earth is doomed." -- Rupert Giles
your with and
|
|
|
|
|
All,
When I deleted my static control in my dialog ,and compiled the project,as the result,the rc file got bigger and bigger--4 megas more. Why ? Who could hlep me ? Thanks in advance .
|
|
|
|
|
Hi, I have had the same problem with an Active-X Control from Microsoft.
Caused by what ever, the Microsoft Flexgrid grew by every compilation to the double size.
I gave up finding the reason and just deleted the control in the rc-file. (You have to do that in textmode) After inserting it again it worked for a while.
|
|
|
|
|
Hi, I dont know the reason fully. but i faced the same problem b4. and u can open the rc file as a text file in msdev. And go throught it. U might see repeatetive entries for some control. delete them in the text file itself.
This might help.
All the best
Kannan S
|
|
|
|
|
hi, it's me again (i think i should register...)
my prob is not a real prob, but here it is:
i'm using a CFileDialog to open/save files, and that works. the only thing is, i want to set the initial directory. i don't like it that i have always to select drive and directory when i'm working longer on a file for example. so i'm planning to use sort of an .ini file for my program. there i want so store the path of the last opened directory.
with CFileDialog, the initial directory is always the same. i tried it with SetCurrentDirectory, but it didn't work. anyway, is there a function that returns the path of the program i'm currently running? in borland c++ (the dos-based ) it was the first array in argv (remember: int main(int argc, char *argv[]) ).
well, it's not that important, but i want to create a user-friendly program. it simply s#x to select the same directory hundreds of times within 5 minutes, i'm sure you know what i mean
greets,
McEck
|
|
|
|
|
You need to make a change to the OPENFILENAME struct of the CFileDialog before calling DoModal():
CFileDialog dlg ( ... );
TCHAR szInitialDir[MAX_PATH];
dlg.m_ofn.lpstrInitialDir = szInitialDir;
--Mike--
http://home.inreach.com/mdunn/
"The Earth is doomed." -- Rupert Giles
your with and
|
|
|
|
|
I use this to get my Application path.
::GetCurrentDirectory(1024, m_strAppPath.GetBufferSetLength(1024));
m_strAppPath.ReleaseBuffer();
You have to use this before you do anything else with files, since you then change the path. For example in InitInstance.
/Fredrik Sigbjörn
|
|
|
|
|
MFC -
Ok I have a combobox (m_cFilters) and in it I have Filters like:
All Files (*.*)
Text Files (*.tx) ...etc.
I want to grab the part between the parenthesis and store it in a var after the combo box is changed (DropDown combo, btw). I tried mapping the standard combo messages but after the functions return they do not update the combo box. What is the proper way to get the effect I am looking for? Is there an easier way to grab data like this other than straight from the combo string?
Thanks.
----
Xian
|
|
|
|
|
I haven't done much work with combo box controls, but I had a similar situation with a list control where i needed to store extra data besides what is displayed. I think you can use the CComboBoxEx object which use the COMBOEXITEM structure instead of LVITEM. You can store a pointer to a filter string (or a pointer to a structure if you need to store more)
<br />
typedef struct { TCHAR szFilter[256];
} FILTERDATA, *PFILTERDATA;<br />
Then just add the structure when adding your items, for list control:
<br />
PFILTERDATA pData = new FILTERDATA;<br />
strcpy(pData->szFilter, szMyFilter);<br />
<br />
COMBOEXITEM item;<br />
memset(&item, 0, sizeof(item));<br />
item.mask = CBEIF_LPARAm | CBEIF_TEXT;<br />
item.lparam = (LPARAM) pData;<br />
item.iItem = -1;<br />
item.pszText = new TCHAR[sizeof(szMyDisplay)];<br />
item.cchText = sizeof(szMyDisplay);<br />
<br />
nItem = m_cFilters.InsertItem(0, &item);<br />
Then when your user selects something do:
<br />
COMBOEXITEM cbi;<br />
ZeroMemory(&cbi, sizeof(COMBOEXITEM));<br />
cbi.iItem = hitTest.iItem;<br />
cbi.mask = CBEIF_PARAM;<br />
m_cFilters.GetItem(&cbi);<br />
<br />
PFILTERDATA pTemp = cbi.lParam;<br />
<br />
CString strTemp;<br />
strTemp.Format("Filter is %s", pTemp->szFilter);<br />
or maybe there's an easier way
btw don't forget to delete the lparam pointer. probably best to subclass the entire control so you can delete the memory in teh destructor
|
|
|
|
|
Do you think Microsoft is planning to replace MFC?
|
|
|
|
|
Where do you get this idea? MFC is here and will be here as long as we don't think it's gone. The apparent *less than normal* focus on MFC now a days I believe is due to Microsoft's marketing blitz to promote their new baby .NET and hence shouldn't be attributed to a full-scale *replacement* plan. But hey I may be wrong, I don't work for them and so I can't read their minds.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
I believe that is what they hope to achieve, in that they want to replace C++ altogether with C#. If it happens or not depends on us as much as them. There are two reasons for people to change from C++ and only develop in C#:
1/ Because M$ gives us a compelling reason to do so ( i.e. a better language )
2/ Everyone blindly follows M$.
I don't care if 1/ occurs, good luck to Microsoft for providing a better option. 2/ scares me, because it seems more than likely to me.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
It's interesting to see so many of us think that MS has set out to kill their own libraries (e.g. MFC/ATL) they spent so many years to build. (Call this a suicide attempt or MS marketing conspiracy? go figure).
One alternative view on the subject could lie in the fact that MS had a monumental task to roll out something as big as .NET and so, despite of their desire to promote new stuff in MFC/ATL/WTL/MC++, they couldn't do that in the past (call it *resource limitation*?).
I honestly hope and believe that the latter is the case and MS will come out soon to do the catch up they haven't done since .NET was released.
I recently suggested a poll to CP on a similar tone (with the title: "the future of native C++ development on Windows") and was told by Chris that Microsoft is planning to conduct the same / similar poll on CP soon (similar to what they have done on C#). Hope this will happen *real* soon, so that we can express what we feel on this subject.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
It's interesting to see so many of us think that MS has set out to kill their own libraries (e.g. MFC/ATL) they spent so many years to build. (Call this a suicide attempt or MS marketing conspiracy? go figure).
It's not really that much of a thinker. Their libraries have served them well, but the updates to MFC in VS7 are minimal AFAIK. No company grows from resting on past success. Having provided libraries to make it easier to develop Windows programs in C++, does that mean that they will continue on that track, when they are rolling out a brand new language that gives them the double advantage of stopping cross platform development AND means they OWN the standard so they can make the language do whatever they choose without people complaining what a poor job they do ?
One alternative view on the subject could lie in the fact that MS had a monumental task to roll out something as big as .NET and so, despite of their desire to promote new stuff in MFC/ATL/WTL/MC++, they couldn't do that in the past (call it *resource limitation*?).
WTL is not supported by M$ at all. Too bad, because it is cool. I believe there are interesting things in the new ATL ( haven't looked yet ), but I don't see why they would release a new language if they also want to keep pushing and developing the old ones ? Surely it's a case of 'that has done it's job, now we are moving to this'. There sure has been enough hype about C++ being 'too hard' and VB being 'not powerful enough' ( the latter is at least true ), to indicate what they are thinking.
I honestly hope and believe that the latter is the case and MS will come out soon to do the catch up they haven't done since .NET was released.
They still need to work on C# - the recent poll had them asking what we want in C#. Again, where do you think their efforts will go ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
WTL is not supported by M$ at all. Too bad, because it is cool.
Yup. It's not officially yet, but from its popularity I see in the WTL newsgroup, I think officially it will be part of VC++ in near future. I also think in recent days, MS has toned down the rhetoric about WTL significantly compared to what it had in the beginning of its release (remember the saying: "WTL should never be released" by Tony G., MS product manager)
I believe there are interesting things in the new ATL ( haven't looked yet ), but I don't see why they would release a new language if they also want to keep pushing and developing the old ones ? Surely it's a case of 'that has done it's job, now we are moving to this'.
I think MS had to release C# because they were under tremendous pressure to compete with Sun's Java. If they have enough resource, they can still make ATL/MFC successful along with new stuff like C#, .NET.
There sure has been enough hype about C++ being 'too hard' and VB being 'not powerful enough' ( the latter is at least true ), to indicate what they are thinking.
I agree. There is much hype on this power and simplicity things. What most of C++ programmers are led to believe that VB is a RAD language while C++ is not. In fact, C++ can have VB-like RAD features, such as "properties" and "events" and products like Borland's C++ Builder (and our own product RadVC on VC++) have proved that a C++ IDE can be made as simple as a VB like RAD IDE. Oh well, that is another story.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
WTL is not supported by M$ at all. Too bad, because it is cool.
Yup. It's not officially yet, but from its popularity I see in the WTL newsgroup, I think officially it will be part of VC++ in near future. I also think in recent days, MS has toned down the rhetoric about WTL significantly compared to what it had in the beginning of its release (remember the saying: "WTL should never be released" by Tony G., MS product manager)
I doubt it will be supported, it's not in Microsoft's interest to divert attention from C#.
I believe there are interesting things in the new ATL ( haven't looked yet ), but I don't see why they would release a new language if they also want to keep pushing and developing the old ones ? Surely it's a case of 'that has done it's job, now we are moving to this'.
I think MS had to release C# because they were under tremendous pressure to compete with Sun's Java. If they have enough resource, they can still make ATL/MFC successful along with new stuff like C#, .NET.
The only pressure they were under came as a result of their breaking Sun's copyright. If only Stroustrup could sue M$ for their non conformance in the case of C++, then we'd get MS++, the result of reusing the VC++ code. I believe they will run an each way bet, not drop MFC until they are sure people are using C# instead. As for ATL, you need that to write sheel extensions, etc., so ATL is probably safe for now.
There sure has been enough hype about C++ being 'too hard' and VB being 'not powerful enough' ( the latter is at least true ), to indicate what they are thinking.
I agree. There is much hype on this power and simplicity things. What most of C++ programmers are led to believe that VB is a RAD language while C++ is not. In fact, C++ can have VB-like RAD features, such as "properties" and "events" and products like Borland's C++ Builder (and our own product RadVC on VC++) have proved that a C++ IDE can be made as simple as a VB like RAD IDE. Oh well, that is another story.
Indeed. I don't have anything to add, but I thought I'd be polite and leave the plug in.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|