|
Sorry, I don't know WTL and the words mainframe and splitter made me believe he was using the MFC.
Next time, I'll ask before saying something wrong
|
|
|
|
|
The MSDN docs says:
The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
After having read that, my first stab at the problem would be to process the WM_MOUSEWHEEL message at the splitter level. There I'd use WindowFromPoint() and GetCursorPos() to figure out which window it's over. Then I'd use GetParent() until I get either left or right pane window. Then I'd send the appropriate WM_xSCROLL messages to the correct pane.
--
An eye for an eye will only make the world blind.
|
|
|
|
|
Hi, All!
When i trying to add a new ATL object to my project i see this error! May be smbd solve it?
Thanx!
|
|
|
|
|
AdyOS wrote:
When i trying to add a new ATL object to my project i see this error
which error ?
AdyOS wrote:
May be smbd solve it?
certainly not, how could we ? we don't have neither the code nor any explanation of what you do nor the error message...
please understand us too if you want us to give some help...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
OK! I have an ATL project with support MFC. The project already have some ATL objects (there are Dilaogs). And now i try to add a new Dialog to my project, but when i click Insert->New ATL object i see this error. Before all was ok.
|
|
|
|
|
|
toxcct wrote:
which error ?
The one contained in the title of the message
|
|
|
|
|
I'm receiving an unknown software exception when trying to use COM (ATL) to interoperate with the .NET CLR. I AM using VS2005 Beta 2 but I think the problem occurs in VS2003 also (from what I've seen when googling).
To reproduce this behaviour, create a simple ATL object (I used non-attributed, dunno if it matters), add a single method with no params that just returns S_OK. Compile with the /clr switch. (Note there's no need to go to the trouble of creating or instantiate any managed objects - compiling with the /clr switch is enough).
Now write a console app that creates this object, calls the method and exits. Upon exit, Kaboom!. As there is virtually zero code, it's quite tricky to fix. Has anyone seen this and, more importantly, fixed or worked around it?
Many thanks
swg
|
|
|
|
|
Hi, I have the same problem,
please help me...
|
|
|
|
|
Hi Friends,
I am using some open source code which is in C++ language.
But i have to convert it to C code.
In the C++ source, there are many class templates.
I want to convert to the templates to C code.
I don't know how to do it.
Please guide me.
With Thanks and Regards,
Arun AC
|
|
|
|
|
Arun Chakaravarthy wrote:
I am using some open source code which is in C++ language.
But i have to convert it to C code.
In the C++ source, there are many class templates.
I want to convert to the templates to C code.
I don't know how to do it.
Convert the templates to macros (templates and macros are very similar in C++).
|
|
|
|
|
CP Visitor wrote:
Convert the templates to macros (templates and macros are very similar in C++).
That may not always be possible. Especially if the existing code is using type expressions.
Good music: In my rosary[^]
|
|
|
|
|
it won't be possible directly, since templates are pure C++.
but you could write the specialized classes with the types you'll have to use in...
let's take an easy example...
in C++, we have a class called map<Key, Value>
well, if you use it only for (key, Value) of types (char, int), you can rewrite the part of the map<char, int> which will work only on those types... (i conceed, it's a lot of work)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
In my application I want to access files, where the underlying character type (ASCII or Unicode) is transparent for the application.
Suppose that in a reporting module a report is written to file, like this:
myfile << reportHeader << std::endl;<br />
for (all columns) myfile << columnname;<br />
myfile << std::endl;<br />
for (all records)<br />
{<br />
for (all columns) myfile << data;<br />
myfile << std::endl;<br />
}<br />
Now, I want my application to transparently write the report to ASCII or Unicode files, depending on the user specification.
Currently, you have to do it like this:
std::ofstream asciiFile;<br />
std::wofstream unicodeFile;<br />
if (user wants Unicode)<br />
{<br />
unicodeFile.open ("output.txt");<br />
unicodeFile << reportHeader << std::endl;<br />
}<br />
else<br />
{<br />
asciiFile.open ("output.txt");<br />
asciiFile << reportHeader << std::endl;<br />
}<br />
for (all columns) <br />
{<br />
if (user wants Unicode) unicodeFile << columnname;<br />
else asciiFile << columnName;<br />
}<br />
... and so on<br />
The disadvantages seem obvious:
- clumsy, unreadable code (especially if the write-to-file logic is spread over several methods)
- writing Unicode strings (std::wstring) to an Ascii stream doesn't even work; it produced garbage
Therefore, I need a kind of transparent stream, so that I can write the following:
transparentstream myfile;<br />
myfile.setMode (ascii or unicode);<br />
myfile.open ("output.txt");<br />
myfile << reportHeader << std::endl;<br />
for (all columns) myfile << columnname;<br />
myfile << std::endl;<br />
for (all records)<br />
{<br />
for (all columns) myfile << data;<br />
myfile << std::endl;<br />
}<br />
Problems are:
- from which stream do I inherit the transparentstream?
- how do I define the transparentstream so all defined output operators keep on working?
- where do I put the conversion logic? (basic_buf? basic_filebuf?)
Of course I want something similar for input, where the stream can find out itself whether the file is Unicode (starts with 0xfffe or 0xfeff) or plain Ascii.
And as an additional challenge: is it possible to have such a transparent stream that can do something like this?
transparentstream mystream;<br />
mystream.open("http://www.mywebsite.com/mypage.html");<br />
mystream >> ...;<br />
And if this is possible, how do I implement such a stream of buf class?
Did some of you already encounter problems trying to mix the STL and Unicode files?
How did you solve it?
Thanks for you suggestions.
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
Are you referring to overloaded << and >> operators?
ofstream &operator<<(ofstream &of, const CData const &data)
ifstream &operator>>(ifstream &if, const CData const &data)
Kuphryn
|
|
|
|
|
Not exactly.
I want to write to (or read from) a stream without having to worry about whether the file is Ascii or Unicode.
Afaik, STL forces me to know beforehand what the file is and use either an ofstream (for Ascii) or a wofstream (for Unicode), which means that all output statements should be doubled in my application.
In my original post I gave a simple example for a reporting module.
The first code examples shows how to do it in Ascii only.
The second example shows how STL currently forces me to write this module if I want to support both Ascii and Unicode in my application.
The third example shows how I would hope to write it, at least if somebody has a brilliant idea.
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
You determine the file type via input?
One solution is to overload the operators as mentioned. There could be multiple objects (CObject and CObjectUnicode).
Kuphryn
|
|
|
|
|
Streams are transparent, you should use locale codecvt facet so that the buffer will be converted before saving and after loading.
Your code should look like this:
<br />
std::wofstream myfile;<br />
std::locale loc(std::locale(),new std::codecvt<wchar_t,ascii ? char : wchar_t,std::mbstate_t>());<br />
myfile.imbue(loc);<br />
<br />
<br />
myfile.open ("output.txt");<br />
myfile << reportHeader << std::endl;<br />
for (all columns) myfile << columnname;<br />
myfile << std::endl;<br />
for (all records)<br />
{<br />
for (all columns) myfile << data;<br />
myfile << std::endl;<br />
}<br />
Note that myfile is always wchar_t and codecvt converts the caracters to char.
If your internal data is char based you should use a char based stream and imbue it with a codecvt that converts from char to wchar_t is you need to save Unicode.
Also when saving to Unicode you should write 0xEF 0xBB 0xBF first to indicate the file is Unicode (is what you will find at the beginning of utf-16 xml files) and when reading the file read the first 3 bytes, test them and then use the right codecvt facet to convert to your internal data.
|
|
|
|
|
Very interesting.
Kuphryn
|
|
|
|
|
I wish to add single string to the start of a file.
I used:
_file.seekp(0); // move to start of file
_file << something << std::end;
It overrides the text in start of file, but I wish to insert before current text.
Does anyone know how to do it?
THANKS!
Keep it simple
|
|
|
|
|
SimpleProgramer wrote:
I wish to add single string to the start of a file.
I used:
_file.seekp(0); // move to start of file
_file << something << std::end;
It overrides the text in start of file, but I wish to insert before current text.
Does anyone know how to do it?
There is nothing before 0 (which is even a philosophical answer ). Hint: You can write a new file ....
|
|
|
|
|
Hi Guys.
I have a problem about the max dimension of an element that can be used with the container "deque" defined in STL.
I declare a deque typedef with elements of 2049 bytes (but could be everykind of data or class) :
typedef struct
{
char stringa[2049];
} t_Elem;
typedef deque <t_elem> t_Queue;
I populate an instance of this deque with 5 strings :
t_Queue stQueue;
t_Elem stElem;
//
strcpy (stElem.stringa, "Stringa1");
stQueue.push_back (stElem);
strcpy (stElem.stringa, "Stringa2");
stQueue.push_back (stElem);
strcpy (stElem.stringa, "Stringa3");
stQueue.push_back (stElem);
strcpy (stElem.stringa, "Stringa4");
stQueue.push_back (stElem);
strcpy (stElem.stringa, "Stringa5");
stQueue.push_back (stElem);
Then I try to navigate inside deque, using a standard iterator :
t_Queue::iterator p = stQueue.begin();
while (p != stQueue.end())
{
t_Elem localElem;
strcpy (localElem.stringa, ((t_Elem)(*p)).stringa);
p++;
}
But the stQueue.end() operator doesn't stop my loop after 5 cycles !!!! ... then an Access Violation occour when I use the sixth element of deque.
The strange thing is that if I DECLARE the ' t_Elem' string of 2048 bytes instead of 2049, everything's OK !!!
I know that I could solve the problem using string container instead of pure char[204?] data, but the problem occour even if I declare as element a class that has 2049 bytes of data.
I can navigate through deque using a "for (short i=0; i
|
|
|
|
|
Use a std::string (or even a std::vector<char> ) rather than an array of characters?
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
The point of the problem is not "use another class to store string". The problem also occour if I use whatever else element 2049 bytes long. Think for example to a Class with members and methods bigger than 2049 bytes.
But I've got an update. Go to here :
http://www.dinkumware.com/vc_fixes.html
Download the new <deque> header and follow instructions. This fixes the problem. There are also many bug fixes about other STL containers... This Site has been signaled me by Paul McKenzie, Elite Member on the CodeGuru Forum Site.
Problem's now solved. Bye to all, Mirko.
|
|
|
|
|
Hi,
I have a toolbar where I dynamically create the buttons. It uses the TBSTYLE_EX_MIXEDBUTTONS style. Everything seems to work fine, however when I resize my window, there is no drop-down on the RHS ( ">>" ) to access the buttons that have been clipped.
Buttons without text work fine. Obviously I am missing something. Here is my code to create the rebar:
<br />
HWND hWndCustomToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_CUSTOM, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST & ~TBSTYLE_TOOLTIPS);<br />
CToolBarCtrl = hWndCustomToolBar;<br />
m_customToolbar.SetImageList(*m_sysImageList.GetImageList());<br />
m_customToolbar.SetExtendedStyle(TBSTYLE_EX_MIXEDBUTTONS);<br />
m_customToolbar.SetMaxTextRows(1);<br />
m_customToolbar.AutoSize();<br />
CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE);<br />
AddSimpleReBarBand(hWndCustomToolBar, NULL, TRUE);<br />
Then to add my buttons I use the following styles:
<br />
button.fsState |= TBSTATE_ENABLED;<br />
button.fsStyle |= TBSTYLE_AUTOSIZE | BTNS_SHOWTEXT;<br />
m_customToolbar.AddButtons(1, &button);<br />
Is there anything else I need to do?
Thanks in advance.
|
|
|
|