|
AddTab call is creating the tab area:
"Call this method to add a pane as a new tab on a tabbed pane"
CBaseTabbedPane Class[^]
and AddView call is creating the view which are hosted by CTabView:
"Call this function to add a view to the tab control that is embedded in a frame"
CTabView Class[^]
|
|
|
|
|
In my case, i need to create tabs dynamically. Lets say. When my application starts user will input a value between 1 to 10. Based on user input i need to create the tabs (no. of tabs).
later in each tab in need to display different images.
In this case, should i create my class which is inheriting from CTabView or CTabPane?
|
|
|
|
|
" should i create my class which is inheriting from CTabView or CTabPane?" Definitely from CTabView.
And this CMyTabClass, should include at least one tab, with one view.
|
|
|
|
|
If i call AddView(), this itself is creating a tab. Is this not enough? No need to call AddTab() right?
|
|
|
|
|
Yes, AddView() is creating a tab, so, it is enough.
|
|
|
|
|
If i call AddView() and run my program, its working absolutely fine with a window and a view(tab).
But instead of calling AddView() initially, at runtime based on user input, i called addview() which leads to a crash. What could be the reason.
class View : public CScrollView
{
}
class MyTabClass : public CTabView
{
void OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CTabView::OnCreate(lpCreateStruct) == -1)
return -1;
AddView(RUNTIME_CLASS(View),_T("Sheet1"));
}
void RunTimeBasedOnUserInput()
{
for(int i = 0 ; i < userinput; i++)
{
AddView(RUNTIME_CLASS(View),_T("sheet %d",i));
}
}
}
|
|
|
|
|
Hi. Have you solved this ?
|
|
|
|
|
I am serializing CMapStringToPtr object without any problem, key by key, pointer to pointer.
For this case, the key order it is matter.
So, if I archive this CMapStringToPtr object, and de-archive on the same machine, the key order are fine. But, if I de-archive this object on other machine, the key order are not the same, and this is a PROBLEM. How can avoid this issue ?
Yes, I could serialize another CStringArray with the CMapStringToPtr keys, but I don't know if this a good idea ... can you tell me how to overcome this problem ?
Thank you.
|
|
|
|
|
Key order is not a property of such a collection (see the documentation[^]) unlike, for instance, the std::map .
So yes, you have to work around that.
|
|
|
|
|
Hello Everybody,
I am trying to read XML file using MSXML parser. Till now, all paths are in English characters and inside file also all are in English only.
Now, we are trying to move with Chinese characters also. So, inside file wherever needed, we are able to manage conversion and load the file using MSXML parser.
Now, the problem is, if the path of the xml file consists of Chinese characters, then
IXMLDOMDocumentPtr->load(path)
is not working.
Is there anyway to load the file ?
PS. we can able to write a new parser, but need to change a lot in our existing application.
Thanks in advance.
Regards,
Gopinath.
|
|
|
|
|
Gopi Nath wrote: is not working What does that mean?
|
|
|
|
|
Hello Richard,
MSXML::IXMLDOMDocumentPtr->load function, when I tried to load a file in which the path or file name contains Chinese characters, its not loading. Means, it fails to load the file into the document pointer and return false.
Regards,
Gopinath.
|
|
|
|
|
|
Thanks Richard,
I will check and will get back to you on this.
Regards,
Gopinath.
|
|
|
|
|
Do you need to canonicalize the path?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Perhaps, there is some problem with encoding?
|
|
|
|
|
Gopi Nath wrote: Now, the problem is, if the path of the xml file consists of Chinese characters, then
IXMLDOMDocumentPtr->load(path)
is not working.
You left out so much relevant information...
1.) Could you give an example path containing Chinese characters that fails to load?
2.) What MSXML DLL version?
3.) What operating system version?
Best Wishes,
-David Delaune
|
|
|
|
|
Hello Everybody,
Sorry for late reply.
It was character issue. My application is with Unicode character type. If I send the path as TSTR, then it works fine properly.
Thanks again.
Regards,
Gopinath.
|
|
|
|
|
Input:
The first line of the input contains integer T denoting the number of test cases. For each test case, there are two integer inputs a & b.
Output:
For each test case, the output is the integer displaying the XOR of a & b after making them of equal lengths.
Constraints:
1<=T<=100
1<=a,b<=107
Example:
Input:
4
2 6
3 10
5 24
1 20
Output:
2
6
12
4
Explanation:
1. The binary representation of 2 is 10 and of 6 is 110. As the length of "10" is smaller, so add a '0' to it making it "100', to make the length of binary representations equal. XOR of 100 and 110 gives 010 which is 2.
Below is my code
#include <iostream>
#include <cmath>
#include <sstream>
#include <cstring>
#include <string>
using namespace std;
int main()
{
int cases, binary[100];
cin>>cases;
int *result = new int[cases];
int j;
for(j=0; j<cases; j++){
stringstream ss[3];
for(int k=0; k<2; k++)
{
int n;
cin>>n;
int temp=n, i=0, len;
while(temp > 0){
binary[i] = temp%2;
temp /= 2;
i++;
}
len = i;
string str ;
for(int i=0; i<len; ++i){
stringstream ss;
ss << binary[(len-1)-i];
str += ss.str() ;
}
ss[k] << str;
}
string str1 = ss[0].str(), str2 = ss[1].str();
int len = (str1.length() > str2.length()) ? str1.length() : str2.length() ;
if(str1.length() < (unsigned)len){
int diff = len - str1.length();
for(int i=0; i<diff; ++i){
str1 += '0';
}
}
else if(str2.length() < (unsigned)len){
int diff = len - str2.length();
for(int i=0; i<diff; ++i){
str2 += '0';
}
}
string str3 = str1;
for(int i=0; i<len; ++i){
if(str1[i]==str2[i]){
str3[i]='0';
}else str3[i]='1';
}
int length = str3.length(), val=0;
for(int i=0, m=length-1; i<length, m>=0; ++i,--m){
if(str3[i] == '1'){
val += pow(2, m);
}
}
result[j] = val;
}
for(int i=0; i<cases; i++){
cout<<result[i]<<endl;
}
return 0;
}
how to make it more efficient & short(i haven't studied oops yet)
|
|
|
|
|
You can get the length of each value (remember to save the originals) by repeatedly shifting one bit right until it is zero. You then shift the smaller value left by the difference between their lengths. That will give you two integers of the same length. All you need then is to create the XOR of the two and print it out.
|
|
|
|
|
Using Richard's suggestion:
unsigned int myxor(unsigned int a, unsigned int b)
{
if ( a < b) swap(a,b);
int lab = 0; int ca = a;
int cb = b;
while ( ca )
{
if ( cb == 0 )
++lab;
ca >>= 1;
cb >>= 1;
}
return ( a ^ (b << lab));
}
|
|
|
|
|
Better than my idea. 
|
|
|
|
|
|
In the C/C++ code below debugptr comes up as null however when I go into Disassembly the value return in register rax from __imp_Cwnd::FromHandle is correct as I place an eyecatcher "Debug" in CprogDebug and when I go to look at that memory address I can see that literal in the memory
more so when I got to rsi + 118h the value of the rax register is there
When I do a quickwatch in VS on Debugptr its NULL
BTW I do a get an exception utilizing debugptr as a pointer
133: debugptr = (CprogDebug *)temptr->GetOwner();
00007FF635B24727 48 8B 88 98 00 00 00 mov rcx,qword ptr [rax+98h]
00007FF635B2472E 48 85 C9 test rcx,rcx
00007FF635B24731 75 0D jne CMypercolate::process_sdump+60h (07FF635B24740h)
00007FF635B24733 48 8B 48 40 mov rcx,qword ptr [rax+40h]
00007FF635B24737 FF 15 A3 AC 00 00 call qword ptr [__imp_GetParent (07FF635B2F3E0h)]
00007FF635B2473D 48 8B C8 mov rcx,rax
00007FF635B24740 FF 15 BA B8 00 00 call qword ptr [__imp_CWnd::FromHandle (07FF635B30000h)]
00007FF635B24746 48 89 86 18 01 00 00 mov qword ptr [rsi+118h],rax
|
|
|
|
|
The source and assembly do not appear to match.
|
|
|
|