|
yes, I just forgot to indicate it my post.
BTW: the class was generated by "add class/generic c++ class"
after eliminating everything that is the full code:
#pragma once
class CMyClass
{
public:
CMyClass(void);
~CMyClass(void);
}
<pre>
<pre>
#include "stdafx.h"
#include "myclass.h"
CMyClass::CMyClass(void)
{
}
CMyClass::~CMyClass(void)
{
}
and that the new error message:
c:\x\Project\MyClass.cpp(6): error C2533: 'CMyClass::__ctor' : constructors not allowed a return type
|
|
|
|
|
Other than the semicolon missing at the end of the class definition (which the compiler would have caught anyway and you would've fixed already), I don't see anything erroneous in the way you have declared and defined the ctor.
Everything looks correct which means the real error is NOT with your constructor. The real error will be with something the compiler didn't like before it reached the constructor. If there is nothing between the class definition and where the constructor appears in it, then the problem is NOT with the way you have defined the class. The problem will be with something that appears before the class definition.
You can rule out there is something wrong with the class and its ctor, and look somewhere else ahead.
William
|
|
|
|
|
It is the missing semicolon. The compiler thinks you are trying to return the class.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
need ~CMyClass() ,This function can't have vairable to pass!!!
|
|
|
|
|
a new workspace solved the problem. The old workspace without the newly added class still compiles fine. Strange thing.
Anyway thanks for your help.
|
|
|
|
|
Hello,
I have created a CListCtrl derived class that includes a CEdit and a CComboBox that are created in the PreSubClassWindow function of the derived class.
I create the CEdit and the CCombobox using their respective ID.
But what can happen if I create two ListCtrls at the same time? (then 2 CEdit (and two CComboBox) with the same resource ID would be working at the same time)
Could this fact be a problem?
If so, how could I avoid that fact...
Thank you in advance.
|
|
|
|
|
In this case you have a problem with all functions that use resource ID as parameter, like GetDlgItem. Control itself works nice like all static controls and frames in dialog which have the same resource ID IDC_STATIC. In your case it's better to talk with CEdit and CComboBox from CListCtrl using their pointers and handlers and not resource IDs.
|
|
|
|
|
Hello,
I have problem with _outp, _inp function.
Its simple, these functions are not supporten in Windows NT,2000 and so on.
Amd I've got aplication working well on Win.9x and i like to use it on NT platforms.
But how can I substitute this function?
(best is to find way usable on both: Win9x and NT)
I heard that way should be CreateFile(), but what parameters to use.
for example:
My bits card has address 0x356 -a I can call _outp(0x356, nValue);
but how can I open port 0x356 with CreateFile() ??
and substitute _outp or _inp ??
Thank you for your help.
Viliam
|
|
|
|
|
If it's a serial port, you'll be able to open it with CreateFile, just look in MSDN, but if you have a custom piece of hardware or really need to access I/O ports, the way to go is creating a driver (not so hard to do as it appears).
I can't recall the name right now, but there's somewhere a driver that allows you generic access to I/O ports, but it's only a workaround, if you want a professional solution you should really create a driver for your hardware.
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
Hello.
Provides the MFC any classes to get the current CPU usage?
) life is fun!
Johannes
//still a newbie
|
|
|
|
|
I have create a DLL,this DLL used in powerBuilder is no problem,but I used it in Visual C++ 6.0,the DLL function has finished,but a problem showed after being used DLL function,
the problem code as follow:
/////////////////////////////////////
module:
file:i386\chkesp.c
line:42
the value of ESP was not properly saved across a function call.this is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention!
/////////////////////////////////////////////////////
My DLL has a Function named int exchange(int pVar);
my code in vc is:
//declare in head file:
typedef int (*MYFUNC)(int);
//On a button clicked event code:
HINSTANCE hInstance=NULL;
MYFUNC pFunction;
hInstance=::LoadLibrary("MyDll.dll");
if(hInstance!=NULL)
MessageBox("The MyDll.DLL has already been load.");
ASSERT(hInstance);
pFunction=(MYFUNC)GetProcAddress(hInstance,"exchange");
(pFunction)(5);
ASSERT(pFunction);
::FreeLibrary( hInstance );
//when run program,show messagebox "The MyDll.DLL has already been load",and the dll function has returned right value,but then a problem appeared just as before I said?? I have trid so many ways to resolve this problem,but failed!! what this problem it is??? who can help me,thanks!!!!!!!
|
|
|
|
|
cradle wrote:
hInstance=::LoadLibrary("MyDll.dll");
if(hInstance!=NULL)
MessageBox("The MyDll.DLL has already been load.");
So you are explicitely offending yourself for being actually able to load the library. That's amusing.
Back to real work : D-19.
|
|
|
|
|
Declare the function as CALLBACK.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
How to declare CALLBACK?I never used CALLBACK,in DLL or in Project?
Can you tell me how to do?thanks!!
I m very anxious to resolve this problem!!!!
|
|
|
|
|
Where you declare your function in the DLL:
<br />
int CALLBACK exchange( int i );<br />
and similar where you implement it:
<br />
int CALLBACK exchange( int i )<br />
{<br />
return 0;<br />
}<br />
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
I have tried,but the problem remain thanks anyway!!!
|
|
|
|
|
Have you tried stepping into the exchange( ) function to see where precisely it chrashes?
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
no,But I don't think the function has problem,My OS is winXP, Do your think os can cause problem?
|
|
|
|
|
It should not. The error message you receive indicate a problem with the calling convention (i.e. using __stdcall when __cdecl should have been used or vice versa). This is what the CALLBACK directive should have fixed. I would try to load the project that creates the dll into Visual C++, set the executable that loads your dll as "Executable for debug session" (Project-Settings-Debug tab). Set a breakpoint inside your exchange function and step through the code.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
But my function of the dll was used successfully in powerbuilder 7.0,no error message showed!!
By the way,shall I need declare others except AFX_MANAGE_STATE(AfxGetStaticModuleState()) in function body???
I don't use __declspec(dllexport) in fuction declaration in head file!
|
|
|
|
|
cradle wrote:
By the way,shall I need declare others except AFX_MANAGE_STATE(AfxGetStaticModuleState()) in function body???
You should not need to do anything else inside the function.
However, where you declare your function pointer where you want to use it, do it similar to this:
typedef int ( CALLBACK* MYFUNC )(int);
and check if the problem still remains.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
so bad,the problem remain,:(I'm always give it up!!!
would you mind to create a DLL project and a using dll project for me?The dll contain a just simple function,and the other project to use this dll funtion,Thank you very much for helping me so much times,dabs,thanks!!!!
my E-mail is cradlexp@hotmail.com.
|
|
|
|
|
I have debuged it, that show "unhandled it in MyProj.exe(GDI32.DLL):0xC0000005:Access violation."
I have placed breakpoint at (pFunction)(5);
What is it mean???I am confused!!Help me!!!!
|
|
|
|
|
Hello all
i have developed (VC7) a Cstatic derived CUlrLink class to enable url clicking and browsing in my about dialog boxes.
It basically uses a custom cursor (IDC_HAND) created inside the 'res' subfolder.
As i'd like to reuse this stuff in all my projects, I've tried something like:
main projects folder
\--> reuse_code\urllink.cpp, urllink.h,
\--> reuse_code\res\hand cursor
\--> newapplication
in this folder i was planning to use an #include "..\common\urllink.h"
but i need also the cursor hand to be included, so i have at least to copy it inside the local 'res' folder, and i have noticed have also to manually change the local resource.h file...
Futher problems when i try to create a reusable 'about dialog box' including an usual couple url link + a mailto link. Fo esample I have to examine the Resources ids etc.
In VC6 i remember there was a 'components gallery', i had only to select a 'component' and it was included , say, with the right references inside a new project.
Summarizing, how do you reuse your code in a situation close to the above?
As pointed out, i don't get troubles with classes not using some resources (just including the .h files and adding the .h/.cpp files seems enough)
thanks in advance
|
|
|
|
|
Jan Van Der Mix wrote:
In VC6 i remember there was a 'components gallery', i had only to select a 'component' and it was included , say, with the right references inside a new project.
Yes, this still exists, and it's for COM components. You can create dialog templates in code, the info is in MSDN. To be honest, I'd think a cursor would be a small enough graphic that you could store it as byte data in your code easy enough also.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|