|
So you are getting values changed...
class C_User : public CObject, public user
class C_Subscriber : public C_User
typedef struct user far *LPUSER
C_Subscriber subdeviceSubs = *lpSubscr;
So the C_Subscriber has CObject in the first memory area. I doubt that it could be the problem.
Dont you get any compilation error by "C_Subscriber subdeviceSubs = *lpSubscr;" ?
- NS -
|
|
|
|
|
Hi friends........
I have a question on tab oreder.......?
How the tab order will effect the visibility of controls placed on a dialog?
Thank u in advance.....
Sairam Madem
|
|
|
|
|
The WS_VISIBLE style effects the visibility of controls on a dialog.
If you meant the Z-order, the controls are created in the order they
appear in the DIALOG resource, so initially, the first control will be at the
bottom of the z-order, the last control at the top.
Setting the tab order sets the order of the control definitions in the resource.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
it is a simple logic.
the control that has the least taborder will be placed first on the dialog.
then any other control with a higher taborder will be placed next.
this means that,
the later control, if it is located at the same place as the former control will obviously overlap the former.
in the past, once i faced the same problem. i had to struggle for two days to find out that taborder is the reason for the controls that are invisible.
is int it very funny?
gud luck.
|
|
|
|
|
chandu004 wrote: i had to struggle for two days to find out that taborder is the reason for the controls that are invisible.
- NS -
|
|
|
|
|
Hopefully this makes sense, here goes:
I've upgraded my MSVS C++ 6.0 MFC application to MSVS C++ 2005. All went well - no big issues - but here's what I can't figure out: In my resource browser my MFC dialog app appears to have that updated .NET style, i.e. rounded glossy buttons & list controls. That's how I would like it to appear when built; however, it still has that "old-school" MFC look with the square edge buttons and "3D" look.
I've created a new MFC dummy app just to compare headers and resource files in Araxis Merge to see if I could find some "switch" somewhere that needs to be set. The dummy app has that contemporary .NET look. I can't seem to figure out what I need to set to accomplish this task.
Any help or advice would be GREATLY appreciated.
Thanks,
CMD
|
|
|
|
|
|
when somebody input some number,you need give out the number of middle.my code is follow:#include <iostream>
using namespace std;
void swap(int &a,int &b);
void main()
{
int n=0,k,m,j;
int*p=new int[n];
cin>>n;
k=n;
j=n;
m=n;
for(;n>0;n--)
{
cin>>p[n-1];
}
int x=1;
while(x)
{
x=0;
for(;k>0;k--)
{
if(p[k-1]
|
|
|
|
|
youbo wrote: the number of middle.
AKA the median.
youbo wrote: my code is follow
Congratulations.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Is dash space dash exclamation exclamation an abbreviation for something?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Here you go
void swap(int &a,int &b);<br />
void main()<br />
{<br />
int array_size=0,k,m,j;<br />
<br />
<br />
cin>>array_size;<br />
if(array_size < 1)<br />
return;<br />
int*p=new int[array_size];<br />
for(int i=0;i<array_size;i++)<br />
{<br />
cin>>p[i];<br />
}<br />
bool changed = true;<br />
int bubble_end = array_size - 1;<br />
while(changed)<br />
{<br />
changed = false;<br />
for(int i=0;i<bubble_end;i++)<br />
{<br />
if(p[i] > p[i+1])<br />
{<br />
swap(p[i],p[i+1]);<br />
changed = true;<br />
}<br />
}<br />
}<br />
if(array_size > 1)<br />
{<br />
if(array_size%2==1)<br />
cout<<p[array_size/2+1];<br />
else cout<<p[array_size/2]<<p[array_size/2+1];<br />
}<br />
else<br />
cout<<p[0];<br />
<br />
}<br />
void swap(int &a,int &b)<br />
{<br />
int c;<br />
c=a;<br />
a=b;<br />
b=c;<br />
}
-- modified at 8:50 Saturday 15th September, 2007
|
|
|
|
|
thank you first,but i couldn't find out the differences from your code to mine.i
have run it ,it appeared the same wrong that is not i need. my code in the same with yours is looked right....
|
|
|
|
|
Look more closely
void main()<br />
{<br />
int n=0,k,m,j;<br />
<br />
int*p=new int[n];<br />
<br />
cin>>n;<br />
k=n;<br />
j=n;<br />
m=n;<br />
for(;n>0;n--)<br />
{<br />
cin>>p[n-1];<br />
}<br />
int x=1;<br />
while(x)<br />
{<br />
x=0;<br />
for(;k>0;k--)<br />
{<br />
<br />
if(p[k-1] {<br />
swap(p[k-1],p[k]);<br />
x=1;<br />
<br />
}<br />
<br />
}<br />
}<br />
<br />
if(m%2==1){cout<<p[j/2+1];}<br />
else cout<<p[j/2]<<p[j/2+1];<br />
<br />
}<br />
void swap(int &a,int &b)<br />
{int c;<br />
c=a;<br />
a=b;<br />
b=c;} get this,it is also wrong.please have
|
|
|
|
|
I have problem with Casting ...
i've create class named Instrument { ... }
and in Dialog based MFC application
i have TreeView Control and in that at some point i am settin ItemData as "Instument" classs' Object
treeCtrl->SetItemData(instObject)//Instrument* to DWORD_PTR casting is done here
now at some point i need this data(object) back
so to take data
Instrument *instObject = treeCtrl->GetItemData(hItem); // error:
Please help me to cast DWORD_PTR back to Instrument Type ...
|
|
|
|
|
To reverse the effect of the first cast, cast the value back to the original type:
Instrument *instObject = (Instrument*) treeCtrl->GetItemData(hItem);
|
|
|
|
|
hey its not working ...
otherwise i would have done that ...
|
|
|
|
|
Then you've obviously done something else wrong, as Michael's suggestion is correct. How are you verifying that it does not work?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'm guessing you are getting cannot convert DWORD_PTR to Instrument *.
Oh and allways try and use eplicit casting i.e. static_cast rather than C-Style casts.
Try this
Instrument *instObject = static_cast<Instrument *>((static_cast<void *>(treeCtrl->GetItemData(hItem))));
or if not
Instrument *instObject = dynamic_cast<Instrument *>((dynamic_cast<void *>(treeCtrl->GetItemData(hItem))));
Could you copy the exact compiler error into the thread.
|
|
|
|
|
reinterpret_cast is the right one for this situation, since you're converting between a pointer and a non-pointer type.
|
|
|
|
|
oh sorry its working now ... it was my mistake ...
Thanks a lot ...
|
|
|
|
|
Hi,
in the process of running my program is allocating a lot of memory (gigabytes). After it reaches a certain size strange things start to happen so I'm trying to debug it. I have some questions.
1. To my surprise new operator does not return NULL on error. It seems to throw an exception. When did this happen? What's the exception object? I'm using VS 8.
2. Is new a thread safe operator? What if I'm using some libraries that most likely use malloc. Is memory allocation still thread safe? I'm using dynamic link run time for my program and hopefully all the libraries. If some library is using a different run-time but I don't free its memory is that fine?
3. What is the memory allocation limit for a process in Windows XP? Is it 2 GB? Or RAM + swap space?
4. Any free GUI profilers out there?
Thanks for your help.
|
|
|
|
|
Budric B. wrote: To my surprise new operator does not return NULL on error. It seems to throw an exception. When did this happen?
I thought it was a lot longer ago, but according to the docs:
"In Visual C++ .NET 2002, the new function in the Standard C++ Library will support
the behavior specified in the C++ standard, which is to throw a std::bad_alloc exception
if the memory allocation fails. In Visual C++ 2005, the C Runtime Library's new function will also throw a std::bad_alloc
exception if the memory allocation fails.
If you still want the non-throwing version of new for the C Runtime Library, link your program
with nothrownew.obj. However, when you link with nothrownew.obj, new in the Standard C++
Library will no longer function."
Budric B. wrote: 2. Is new a thread safe operator?
In the Multithread CRT, Yes. Any third-party library, well...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sounds to me like you have some serious memory leakage. Make sure you call delete on every time you allocate using new.
Try this[^] utility, it's excellent for finding leaks.
As for your questions:
1. use try catch blocks.
2. yes.
3. Usually RAM, but not too sure...
4. www.google.com
Waldermort
|
|
|
|
|
Budric B. wrote: 1. To my surprise new operator does not return NULL on error. It seems to throw an exception. When did this happen? What's the exception object? I'm using VS 8.
That's the way it is supposed to work - it throws bad_alloc. If you want to get a NULL instead, use nothrow[^]
Budric B. wrote: 2. Is new a thread safe operator? What if I'm using some libraries that most likely use malloc. Is memory allocation still thread safe? I'm using dynamic link run time for my program and hopefully all the libraries. If some library is using a different run-time but I don't free its memory is that fine?
Yes. Yes. Yes.
Budric B. wrote: 3. What is the memory allocation limit for a process in Windows XP? Is it 2 GB? Or RAM + swap space?
In practice, less then 2GB[^] (BTW, who would vote down that text and why )
Budric B. wrote: 4. Any free GUI profilers out there?
Try GlowCode.
|
|
|
|