|
CClass *pClass;
pClass = new CClass();
pClass->CClass::CClass( param1, param2 );
What is it you are trying to do here? You are creating a pointer to an object, calling its default constructor which should be
pClass = new CClass; then trying to call it's overloaded constructor. You can only call one of them, calling the second will only initialise a new object. I'm surprised this compiled.
|
|
|
|
|
waldermort wrote: pClass = new CClass();
nop walder, this line is correct.
> using no parameter will always implicitely call the default constructor.
> using parenthesis without parameters will call the same default constructor, but explicitely.
> using some parenthesis with parameters will make the compiler look for the best fitting constructor.
you must know that some constructors can be declared as explicit , and such constructors cannot be called without parenthesis !!!!
|
|
|
|
|
there is no way to re-design it.. i need it exactly as i described!!! i solved the problem using inline assembler now, but it is not the best solution i think. The problem is not the overloaded constructor. the problem is, that the GCC does not want me to call a constructor.
Don't try it, just do it!
|
|
|
|
|
You could try using 'placement new'.
e.g.
new(pClass) CClass(param1, param2);
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Why would you want to do such a thing?
Steve
|
|
|
|
|
|
hi
hope everyone will now be familiar with the environment of new express edition of Visual c++ .
so if any one can help me out with my problem
i have have to make menus, so i need to have coding for "open file" , "Save As", "exit"
if u also explain step by step the procedure of how and where to attach the code.
Thanx
if possible reply on :
aliashar86@yahoo.com
FASTIAN
|
|
|
|
|
perhaps you could search google for some C++ tutorials, there are many tutorials available for both beginners and professionals, ranging from creating a simple text editor to reprogramming your mothers hairdryer.
This one here[^] covers most of the basics.
|
|
|
|
|
Hello all.
Let's assume I have commands like this:
"c:\Program Files\Product\command.exe" -arg1 -arg2
\\.\c:\Program Files\Product\command.exe -a 1
I would like to know how to extract the "command.exe" part from whatever possible command syntax Windows allows.
Thanks all.
-- modified at 12:22 Sunday 2nd April, 2006
|
|
|
|
|
Wont argv[0] give you the exe name .
int main(int argc, char* argv[])<br />
{<br />
char *exeName = argv[0];<br />
TCHAR szFileName[_MAX_PATH];<br />
_tsplitpath( exeName , NULL, NULL, szFileName, NULL );<br />
return 0;<br />
}
// after seeing michael answer it striked me you were looking for the exe name
Regards,
FarPointer
-- modified at 13:23 Sunday 2nd April, 2006
|
|
|
|
|
|
Hi all,
have any of you had any experience coding debbuger traps? You know those pices of code which detect if somebody is trying to reverse engineer your app. I you have any code samples or links to useful websites dealing with this I would be very much appreciative.
Thanks in advance.
|
|
|
|
|
The classic is the IsDebuggerPresent API.
Steve
|
|
|
|
|
I have a library in a file libgsl.a, which I want to make use of in my .dll that I write in VC++. How can I actually force compiler to link it? I tried adding the path to additional library path, but I still get the "unresolved external symbol" error...
Kordzik
|
|
|
|
|
|
Try to use #pragma directives
The following pragma causes the linker to search for the Test.Lib library while linking. The linker searches first in the current working directory and then in the path specified in the LIB environment variable.
#pragma comment( lib, "Test" )
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|
|
Hi.
I dynamic append some item in a popup menu
AppendMenu(hMenu, MF_STRING | MF_ENABLED, 1000, "111");
but why the menu item is gray and disabled, cannot click.
I use Win32 C++(not MFC).
thanks.
|
|
|
|
|
Yes by default all these handlers are disabled unless you activate it through the command_UI handler .check enablemenuitem.
// try insertmenu or insertmenuitem
Regards,
FarPointer
-- modified at 10:18 Sunday 2nd April, 2006
|
|
|
|
|
|
This is how i have inserted an menu and it works fine
// tried for a dialog
// ID_MYMENU NEWMLY ADDED MENU ID
CMenu *Menu =this->GetSystemMenu(FALSE); <br />
Menu->InsertMenu( 3 , MF_BYPOSITION, ID_MYMENU, "&Insert in 3 Place");<br />
map this <br />
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,AFX_CMDHANDLERINFO* pHandlerInfo <br />
);<br />
nCode check for <br />
if(nID ==ID_MYMENU) &&( nCode == CN_UPDATE_COMMAND_UI)<br />
{<br />
( ( CCmdUI* ) pExtra)->Enable( TRUE );<br />
}<br />
Regards,
FarPointer
-- modified at 12:28 Sunday 2nd April, 2006
|
|
|
|
|
|
oh yes i forgot ,so in such case if i want to handle the OnCmdMsg(...)
wat ami supposed to do .
Regards,
FarPointer
|
|
|
|
|
Hi FlyWithYou,
maybe it is some helpful to you
#define IDC_TEST 1000
HMENU hmenu,hMenu2;
hmenu=GetMenu(hWnd);
hMenu2=GetSubMenu(hmenu,0);
AppendMenu(hMenu2, MF_STRING|MF_ENABLED, IDC_TEST, "111");
case WM_COMMAND:
switch (wmId)
{
case IDC_TEST:
MessageBox(hWnd,"test",NULL,MB_OK);
break;
...
...
|
|
|
|
|
But the menu item not enabled, how to click.
|
|
|
|
|
FlyWithYou
I tested for your question(why the menu item is gray and disabled, cannot click)
I write this code then test it and it's not gray
do you use this code?
|
|
|
|