|
I have created a pointer of a class in the header file of another class & also, i have initialised a constructor of that class using that pointer, but, in a member function of the class whose header contains the declaration of the pointer.
now i wanna access other functions of the class (whose pointer variable has been defined already in the header file), but the exception is thrown. the message declares it as "Access Violation".
I m working in Visual C++ 6.0.
If any one knows the solution, kindly reply me soon.
Usman Arif
|
|
|
|
|
If you don't post any code, we won't be able to help you...
And what do you mean by:
Usman Arif wrote:
i have initialised a constructor of that class using that pointer, but, in a member function of the class whose header contains the declaration of the pointer
and by:
Usman Arif wrote:
whose pointer variable has been defined already in the header file
If you have an exception that is thrown, it means that your pointer is probably invalid (pointing to 0xcccccc or 0x00000 or something like that...). Have you tried to use the debugger ?
|
|
|
|
|
Dear All!
I am running fullscreen. I show a picture on a other windown. Now i uses windown media show it. i want rotate it, but i can't.
Can you help me.
Thank!
|
|
|
|
|
CExBitmap[^]
Has a rotation function. If you compile it with WINNT31_ROTATE defined it will use the world transforms on Win2000 and above; otherwise it uses DIB data to rotate it.
There are other articles that also have rotation function code:
http://www.codeproject.com/bitmap/[^]
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hello!
I have 2 programs, one that waits for messages that the other posts for him.
I need somehow to share my handle with the sending application so when I start the program, it will get the handle somehow and post a message to him and so on.
The registry is one way but I don't like,
a temp file is another but I don't like it either...
There's got to be something better and elegant, some function I'm missing
Any ideas?
Thanks.
|
|
|
|
|
I don't know if DDE is still used widely, but you can take a look in the MSDN.
As for the temporary file idea, you can use a CMemFile.
Quote from MSDN: A memory file is useful for fast temporary storage or for transferring raw bytes or serialized objects between independent processes.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
i have made a programe to know the current hardware profile of the system using GetCurrentHwProfile api,At first it does not does not recognize the function in the window.h.And
when i write #define _WIN32_WINNT 0x4000; it gives error in the winbase.h. Please help me out.....
#define _WIN32_WINNT 0x4000;
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
const int HW_PROFILE_GUIDLEN=100;
const int MAX_PROFILE_LEN=100;
typedef struct HW_PROFILE_INFO {
DWORD dwDockInfo;
TCHAR szHwProfileGuid[HW_PROFILE_GUIDLEN];
TCHAR szHwProfileName[MAX_PROFILE_LEN];
} HW_PROFILE_INFO, *LPHW_PROFILE_INFO;
int WINAPI WinMain(HINSTANCE h,HINSTANCE p,LPSTR l,int n)
{
TCHAR szBuffer1[1000];
TCHAR szBuffer2[1000];
TCHAR szBuffer3[1000];
HW_PROFILE_INFO HwProfInfo;
GetCurrentHwProfile(&HwProfInfo) ;
sprintf(szBuffer1, "DockInfo: %s", HwProfInfo.dwDockInfo);
MessageBox(0, szBuffer1, "Dock Info", 0);
sprintf(szBuffer2, "Profile Guid: %s", HwProfInfo.szHwProfileGuid);
MessageBox(0, szBuffer2, "Profile Guid", 0);
sprintf(szBuffer3, "Friendly Name: %s", HwProfInfo.szHwProfileName);
MessageBox(0, szBuffer3, "Friendly Name", 0);
return 0;
}
|
|
|
|
|
I have created an ATL composite control, and am putting it on multiple instances of a modeless dialog box. For each instance of the control I am calling its draw function with different parameters but the multiple instances all display with the same parameters. What is happening and how do I get around this problem.
Esteemed members please help.
Deekonda Ramesh
|
|
|
|
|
Hello All,
I am planning to design my help system for my application. I want to use CHM file format. I am new to this format and I have a basic queries.
Can any body please help me out in this.
As per my understanding CHM is compressed form of HTML. My query is :
"When I will decompress the contents of CHM format will I get my output in HTML format".
Also how to show the final output i.e HTML file, after it has been traced by using CHM file?
Any suggestion about how a help system should be designed are most welcome.
Thanks,
Anukrati.
Pawan agarwal
|
|
|
|
|
could some of you tell me how to put the frames into memory buffer for comparison.....
|
|
|
|
|
Hello Friends,
Can any one tell me what is difference between a friend class and virtual class in cpp?
Hoping for a reply.
Best Regards,
Phijo
|
|
|
|
|
A breif and sketchy answer.
Friend Class:
Take the following simple class:
class A
{
private:
int a, b;
public:
A() : a (0), b (0) { }
};
This class has two private data members. Private means that only methods from that class can access them. Now, say you had anouther class called B that wanted to access those data members. How do you do that without making the members public? Define class B as a friend of class A. Such as this:
class A
{
private:
int a, b;
public:
A () : a(0), b (0) {}
friend class B;
};
class B
{
public:
A Other;
int i;
B()
{
i = Other.a + Other.b;
}
};
You can also have other friends, not just classes. Just remember that only you and your friends are allowed to see your private parts. (lame joke, sorry).
Virtual Classes:
This is slightly more complex. A virtual class is where you define a member function of a class as virtual, which means that if you define anouther class that inherits from that one, it can override that virtual function. If it overrides that function (declaration is identical) then that function is called. If it does not, then the parent classes function is called instead. An example:
class A
{
public:
void Func1 ();
virtual void Func2 ();
};
class B : public A
{
public:
void Func3 ();
virtual void Func2 ();
};
Now, instantiate and object of class B:
B MyVar;
MyVar.Func3 () will call the function "Func3" in class B.
MyVar.Func2 () will call the function "Func2" in class B;
But, if the "virtual void Func2 ()" was missing from class B:
MyVar.Func2 () will call the function "Func2" in class A;
So basically "virtual" means that the function can be overriden.
Anouther use of virtual is a pure-virtual function. That means that it has NO function body, and is just used to define a form for the class. To use the above example:
class A
{
public:
void Func1 ();
virtual void Func2 () = 0;
};
class B : public A
{
public:
void Func3 ();
virtual void Func2 ();
};
Now, if we try and instantiate an object of class A:
A MyVar1;
The compiler will die and say something along the lines of "You cannot instantiate a class with a pure virtual member".
But, we CAN instantiate class B:
B MyVar;
This is really only useful for enforcing functionality in a class.
These are really loose, not too detailed.
Yours,
Blake.
|
|
|
|
|
Hello Friends,
Can any one tell me what is difference between a friend class and virtual class in cpp?
Hoping for a reply.
Best Regards,
Phijo
|
|
|
|
|
|
Mist'Alok is right, you should learn a bit more about the language features itself.
however, i'll try to answer...
friend s functions are made to access to protected members of an object from the outside of it.
virtual functions are a bit more difficult to assimilate.
this keyword is use for inheritance. for example :
<font color=#0000FF>class </font>A {
<font color=#0000FF>protected</font>:
<font color=#0000FF>int</font> m_iData;
<font color=#0000FF>public</font>:
A() {
m_iData = 1;
}
<font color=#0000FF>int</font> Disp() {
<font color=#0000FF>return</font> m_iData;
}
};
<font color=#0000FF>class</font> B : <font color=#0000FF>public</font> A {
B() : A() {
m_iData = 2;
}
<font color=#0000FF>int</font> Disp() {
<font color=#0000FF>return </font>m_iData;
}
}; you could do that to execute :
A* a = B();
printf(<font color=#808080>"%d"</font>, a->Disp()); The output is
1
Now, if A::Disp() had been declared as virtual, the output would be
2
could you understand why ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Can anyone help me with this? I am a total newbie!
Use the MFC Application Wizard to create this program. Add variables and message handlers as appropriate. Your program should graph the sine and the cosine function.
The x axis will start at 0 and end at 2p radian measure. The y axis will run from 1 to –1. The Samples input describes the number of lines you’ll use to draw the function. A small number of samples (indicating a small number of lines) will results in a jagged-looking curve. A large number of samples will result in a smooth-looking curve.
For example, if the user enters 8 for the number of samples , and pushes the Sine command button , you’ll use 8 lines to draw the sine curve. The first line will start at x,y = (0,0) and end at x,y = (p/4, 0.707). See Table.1:
Samples Start End
1 0,0 p/4,0.707
2 p/4,0.707 p/2,1
3 p/2,1 3p/4,0.707
4 3p/4,0.707 p,0
5 p,0 5p/4,-0.707
6 5p/4,-0.707 3p/2,-1
7 3p/2,-1 7p/4,-0.707
8 7p/4,-0.707 2p,0
You can’t literally graph the x,y values in Table.1. You must scale them to match the display that you design. If your y axis is 400 pixels, 200 positive and 200 negative, you’ll need to multiply the y values by 200. The y value of .707, scaled to match the display is .707 * 200 = 141.421. You’ll need to convert this number to an integer (141) to use the Graphic Device Interface.
The user may enter any number between 1 and 100 in the Sample edit control. Your program must dynamically construct and scale the table shown above for the corresponding number of samples. Note that the starting point on the x axis is 0 and the ending point is 2p.
To use the built-in sine and cosine functions, add #include<math.h> to your program. Consult Visual C++ help for additional information and examples.
You may define p as follows:
double PI = 3.1415926535
|
|
|
|
|
Hi,
At work, Visual Studio .NET 2003 has been installed recently.
Today, I have open a project developped with Visual C++ 6.0.
I have to continue this project with Visual Studio C++ .NET 2003.
I am able to compile it in Realease mode.
But when I compile it in Debug mode, the include file "...\Vc7\include\xdebug" has a dozen errors.
I suspect it is a compiler switch that is not well choosen.
Does anybody has suggestions?
Thanks,
Claude
|
|
|
|
|
try to "Rebuild All the project"... that will delete all the *.o files that could be corrupted.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I have written a MFC app in VS .NET using the resource wizard. I added a drop down [ CComboBox ] with 4 strings (using AddString method). When I run the app and try to pull th e drop-down, the window only shows 1 of 4 strings and the scroll bar is tiny... any suggestions pn to solve this problem???
|
|
|
|
|
In the resource wiard, you can click on the srop arrow of the combo box. This should show the extent to which the combobox will drop when clicked in a real window. You should now be able to drag/change the size of the drop list as required in the resource editor as you would when sizing any normal controls.
If you vote me down, my score will only get lower
|
|
|
|
|
Thank you!! I guest to a wizard-newbie, this was inobvious...
|
|
|
|
|
I have a dialog box that I'd like to dismiss if the user clicks anywhere outside of it. How can I determine if they do that?
|
|
|
|
|
try SetCapture() and release capture.....
hope that helpz.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
I thought about that. Actually, I tried it and then ran Spy++ on that dialog to see if it received any additional messages. It didn't appear to.
I guess I'll code it to see - I presume I'd do SetCapture and then add a PreTranslateMessage handler to watch for a WM_LBUTTONUP event?
(This really shouldn't be so difficult!)
Thanks (nice signature, BTW).
Tommy
|
|
|
|
|
u can put the SetCpture code in the OnInit() function .....remember to put the ReleaseCapture() when th exit of the dialog is called.....
NOTE.....
When CWnd no longer requires all mouse input, the application should call the ReleaseCapture function so that other windows can receive mouse input.
happy programmin.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|