|
Hi,
I need some help with dlls. It's my first time writting dlls and I have a minor problem.
<br />
#ifdef MYPROJ_EXPORTS<br />
#define _myprojExport __declspec(dllexport)<br />
#else<br />
#define _myprojExport __declspec(dllimport)<br />
#endif<br />
<br />
class _myprojExport MyClass<br />
{<br />
...<br />
protected:<br />
typedef std::list<std::string> StringList;<br />
StringList mylist;<br />
};<br />
As you can see on the above code I have MyClass which is a simple class that I export. When mylist member is missing everything is compiled smoothly, however when I have mylist member variable on the class I get the following warning from my compiler (VS .NET 7.1).
warning C4251: 'MyClass::mylist' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'MyClass'
with
[
_Ty=std::string
]
How can I create a dll-interface for std::list? I don't have to export std::list the client will find its implementation in <list>. How should I declare mylist in order to get rid of these warnings?
Thanks in advance,
Themis
|
|
|
|
|
Anyone know if this is possible.
I know I can define a function to do that kind of thing......
#ifdef DEBUG
# define STUFF(x) x
#else
# define STUFF(x)
#endif
but what I would like to be able to do is define something so that I could just make the compiler ignore the line.
#ifdef DEBUG
# define ONLY_DEBUG cout
#else
# define ONLY_DEBUG //
#endif
e.g. ONLY_DEBUG << "this is a debug build" << endl;
This is only an example I know I can use TRACE etc, its been able to get rid of something in debug, short of having #ifdef DEBUG around it.
|
|
|
|
|
I don't think that it's possible to set a comment as define.
Why don't you create a define like that:
#ifdef _DEBUG
#define DPRINT( x ) cout << x << endl
#else
#define DPRINT( x )
#endif
Don't try it, just do it!
|
|
|
|
|
Hello,
Why don't you just try it? I think that it is possible, since you canno't use '//' comments in macro's since it will erase some of your code when the preprocessor expands it to a single line...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I'm creating a modal child dialog and a modeless child dialog to learn about them.
I have a simple SDI application that calls the dialogs.
The modal child dialog derived from CDialog opens up behind the mainframe and does not have the focus, nor is it ever able to obtain the focus once I find it, i.e. title bar remains grayed and cannot click on any buttons on the modal child dialog. Properties of the dialog are child and visible.
CModalChild cmd;
cmd.DoModal();
The modeless child dialog opens up as it should but does not have the focus nor is it ever able to obtain the focus, i.e. the title bar remains greyed although the modeless child dialog is functional.
if (!m_pModelessChildDialog)
m_pModelessChildDialog= new CModelessChild;
if (!::IsWindow(m_pModelessChildDialog->GetSafeHwnd()))
m_pModelessChildDialog->Create(IDD_DIALOG6, this);
m_pModelessChildDialog->ShowWindow(SW_SHOW);
Hope someone can help me understand this. Thanks.
|
|
|
|
|
Hello.
In the SDI project, you should show your dialogs after created the mainframe class. You should calling the DoModal or ShowWindow Founctions in the your view class.
excuse me if my sentences are not complete. because, I don't know english well.
Zo.Naderi_Iran
|
|
|
|
|
Thanks Zo. Yes both are being called from the Mainframe's view class but still the problems.
|
|
|
|
|
I think, even though u r calling DoModal() on modal dialog box, the main focus is present on the view and mainframe and the Menu is grayed may be because you may have attached the menu to the dialog box instead to the main window. Try attaching the menu to the main frame window.
Work hard and bit of luck is KEY to SUCCESS.
|
|
|
|
|
Thanks, but no menus involved. Just the form view calling a modal child dialog via a button and the form view call a modeless child dialog via another button.
|
|
|
|
|
I want to get the handle for the drop down button of a Combo Box control.
I tested the following code but the drop down button doesn't seem to be a child of the CComboBox:
...
CWnd* pChild = this->GetWindow(GW_CHILD);<br />
hwndChild=pChild->GetSafeHwnd();<br />
::GetClassName(hwndChild, szClassName, 256);<br />
if(!memcmp(szClassName, "Edit", sizeof("Edit")))<br />
{<br />
<br />
pChild = pChild->GetWindow(GW_HWNDNEXT);<br />
<br />
if(pChild)<br />
{<br />
hwndChild=pChild->GetSafeHwnd();<br />
::GetClassName(hwndChild, szClassName, 256);<br />
}<br />
}
...
Any ideas?
Thanks,
Lula Capixaba
|
|
|
|
|
lulacapixaba wrote:
the drop down button doesn't seem to be a child of the CComboBox
of course it isn't, otherwise how could it be itself a par of the conbobox ?
A ComboBox can be see as a set of 3 controls encapsulated into once : an editbox, a listbox and a button.
about accessing one of these parts, i really don't know how to do, and am waiting with interest for an answer too, but i think you should search for Owner Drawn control...
ps: just curious, what are you trying to do with this button ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I've just researched this problem; conclusion:
There is no button to get, the button is drawn by the control and is not a child window.
Where I looked: MSDN, PUI library code (see CP article) and I used spy to double check my conclusions.
I assume you want to control over how the button is drawn. In which case look at the PUI library code, plus other articles on drawing Win2000 and WinXP style minues a buttons.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Thanks John. I think you are right.
Lula Capixaba
|
|
|
|
|
I'm developing a network app with a listview that shows files that can either be cached locally or only on the server. I have implemented the listview as a drop source and it downloads files that are selected when initiating the drag.
Now to the problem. I'm setting the file paths in the drop object, however those files that does not exist locally must be downloaded before it can be physically copied to the drop target.
Is there a way to make the explorer drop target wait for my app to finish downloading it's files and then receiving all the paths ( So the user will get the little plus sign when dropping it on the explorer window ).
Any ideas would be most welcome!
|
|
|
|
|
How about delayed rendering in clipbord. I guess you can reuse same mechanizm?
|
|
|
|
|
Thanks for that information! That was just what I needed.
Found this useful article on CodeGuru:
http://www.codeguru.com/Cpp/W-P/clipboard/article.php/c3015/
|
|
|
|
|
|
Hello and thanks for looking at my problem,
I want to both select some text and set the caret postion in a edit control as if the user clicked the mouse at the end of the text and then draws the mouse pointer towards the beginning of the text. When doing so, the caret position is somewhere in the middle of the text and everything behind it is selected, like this:
this is |some text
where the bold stuff is selected and the caret is the "|".
EM_SETSEL always results in selected text with the caret at its end, like this:
this is some text|
but I need the caret at the beginning. Does anyone know how to do?
Thanks a lot...
Martin Hoppe
|
|
|
|
|
Reverse the starting and ending position arguments:
pCtrl->SendMessage(
EM_SETSEL, // message to send
(WPARAM) 10, // starting position
(LPARAM) 5 // ending position (caret postion)
);
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Thanks a lot for your answer, Andrew!
Unfortunately I already tried that, but does NOT work. But maybe this is because I am on Embedded C++ 4.0? At least I am sure it does NOT work in Embedded C++ 4.0, but I will have a look in C++ 6.0 too.
Do you or anyone have a solution for eMbedded C++, too?.
Thank you very much...
Martin
|
|
|
|
|
What about using EM_SETSEL with the beginning and the end at the same position?
Don't try it, just do it!
|
|
|
|
|
I am trying to use regular expressions in my application but I get these errors that I don't seem to be able to solve.
In the properties page of the Solution I have provided links to the Regex++ libraries and includes. My code is as follows (basically a copy of what is given as examples in the Regex documentation)
#include <boost/regex.hpp> <br />
<br />
using namespace boost; <br />
<br />
bool grep_callback(const match_results<wstring::const_iterator, regex::alloc_type>& result) <br />
{ <br />
return true;<br />
}
....
{ ...
wstring str_exp = L"[^\\\"]";
wstring expression = str_exp + *searchword + str_exp;
wregex e(expression);
wstring::const_iterator start = text.begin();
wstring::const_iterator end = text.end();
regex_grep(grep_callback, start, end, e, match_default);
}
Can anybody help me?
These are the errors I get:
c : \ B o o s t \ i n c l u d e \ b o o s t \ r e g e x \ v 4 \ r e g e x _ g r e p . h p p ( 5 2 ) : e r r o r C 2 6 6 4 : ' b o o l ( c o n s t b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r , A l l o c a t o r > & ) ' : c a n n o t c o n v e r t p a r a m e t e r 1 f r o m ' b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r > ' t o ' c o n s t b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r , A l l o c a t o r > & '
w i t h
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r ,
A l l o c a t o r = b o o s t : : r e g _ e x p r e s s i o n < c h a r > : : a l l o c _ t y p e
]
a n d
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r
]
a n d
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r ,
A l l o c a t o r = b o o s t : : r e g _ e x p r e s s i o n < c h a r > : : a l l o c _ t y p e
]
R e a s o n : c a n n o t c o n v e r t f r o m ' b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r > ' t o ' c o n s t b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r , A l l o c a t o r > '
w i t h
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r
]
a n d
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r,
A l l o c a t o r = b o o s t : : r e g _ e x p r e s s i o n < c h a r > : : a l l o c _ t y p e
]
N o c o n s t r u c t o r c o u l d t a k e t h e s o u r c e t y p e , o r c o n s t r u c t o r o v e r l o a d r e s o l u t i o n w a s a m b i g u o u s
c : \ C + + P r o g r a m s \ C C M e t r i c V i e w e r \ W o r d S e a r c h e r . c p p ( 1 0 8 ) : s e e r e f e r e n c e t o f u n c t i o n t e m p l a t e i n s t a n t i a t i o n ' u n s i g n e d i n t b o o s t : : r e g e x _ g r e p < b o o l ( _ _ c d e c l * ) ( c o n s t b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r , A l l o c a t o r > & ) , s t d : : b a s i c _ s t r i n g < _ E l e m , _ T r a i t s , _ A x > : : c o n s t _ i t e r a t o r , c h a r T , t r a i t s , s t d : : a l l o c a t o r < _ T y > > ( P r e d i c a t e , B i d i I t e r a t o r , B i d i I t e r a t o r , c o n s t b o o s t : : r e g _ e x p r e s s i o n < c h a r T , t r a i t s , s t d : : a l l o c a t o r < _ T y > > & , b o o s t : : r e g e x _ c o n s t a n t s : : m a t c h _ f l a g _ t y p e ) ' b e i n g c o m p i l e d
w i t h
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r ,
A l l o c a t o r = b o o s t : : r e g _ e x p r e s s i o n < c h a r > : : a l l o c _ t y p e ,
_ E l e m = w c h a r _ t ,
_ T r a i t s = s t d : : c h a r _ t r a i t s < w c h a r _ t > ,
_ A x = s t d : : a l l o c a t o r < w c h a r _ t >,
c h a r T = w c h a r _ t ,
t r a i t s = b o o s t : : r e g e x _ t r a i t s < w c h a r _ t > ,
_ T y = w c h a r _ t ,
P r e d i c a t e = b o o l ( _ _ c d e c l * ) ( c o n s t b o o s t : : m a t c h _ r e s u l t s < s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r , b o o s t : : r e g _ e x p r e s s i o n < c h a r > : : a l l o c _ t y p e > & )
]
c : \ B o o s t \ i n c l u d e \ b o o s t \ r e g e x \ v 4 \ r e g e x _ g r e p . h p p ( 6 7 ) : e r r o r C 2 6 6 4 : ' b o o l ( c o n s t b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r , A l l o c a t o r > & ) ' : c a n n o t c o n v e r t p a r a m e t e r 1 f r o m ' b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r > ' t o ' c o n s t b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r , A l l o c a t o r > & '
w i t h
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r ,
A l l o c a t o r = b o o s t : : r e g _ e x p r e s s i o n < c h a r > : : a l l o c _ t y p e
]
a n d
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r
]
a n d
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r ,
A l l o c a t o r = b o o s t : : r e g _ e x p r e s s i o n < c h a r > : : a l l o c _ t y p e
]
R e a s o n : c a n n o t c o n v e r t f r o m ' b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r > ' t o ' c o n s t b o o s t : : m a t c h _ r e s u l t s < B i d i I t e r a t o r , A l l o c a t o r > '
w i t h
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r
]
a n d
[
B i d i I t e r a t o r = s t d : : b a s i c _ s t r i n g < w c h a r _ t , s t d : : c h a r _ t r a i t s < w c h a r _ t > , s t d : : a l l o c a t o r < w c h a r _ t > > : : c o n s t _ i t e r a t o r ,
A l l o c a t o r = b o o s t : : r e g _ e x p r e s s i o n < c h a r > : : a l l o c _ t y p e
]
N o c o n s t r u c t o r c o u l d t a k e t h e s o u r c e t y p e , o r c o n s t r u c t o r o v e r l o a d r e s o l u t i o n w a s a m b i g u o u s
I am the handsome one in the crowd.
|
|
|
|
|
My application is based on the SDI with the splitter view.The left view is derived of a common class CView which is used to show the vector graphics and the right view is derived of a class CFormview.Now ,I want to show the full vector graphics in the left view but the full vector graphics is so large that canot be showed .So I think it may called "zoom the graphics". How can I do?
Also I donot plan to use the HScroll and VScroll th show the graphics.
Thank you.
|
|
|
|
|
Use StretchBlt() or use GDI mapping functions like SetViewportExt() and ScaleViewportExt().
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi there
I'm getting loads of link errors when trying to run this OpenGl with Glui program on Visual C++ .net 2003, but not in Visual Studio C++ 6.
error LNK2001: unresolved external symbol "__declspec(dllimport) bool __cdecl std::operator==(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > const &,char const *)" (__imp_??8std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z)
I've included all the necessary .lib files in the Linker tab of Project properties, opengl32.lib, glut32.lib, glu32.lib and glui32.lib. Also I've ticked include MFC in shared dll. My glut.h, glu.h and glui.h header files are in the PlatformSDK/include/gl directory and glut32.dll is in c:/Windows/system directroy so I don't know what the problem is. Can anyone help me?
Thanks
|
|
|
|
|