|
Hi,
I have a little problem in class declaration.
It is easy to understand, and to solve too, I believe: my class are declared in 2 separated header files:
A.h =>
#pragma once
#include "B.h"
class A
{
protected:
B* m_Bparam;
...
}<=
B.h =>
#pragma once
class B
{
protected:
A* m_Aparam
...
}<=
I imagine you can see the problem. When starting to compile A.h file, it will read B.h where a A type parameter is declared, but the compiler doesn't know the class A yet.
Is there any keyword to help solve this solution? I think I can find a workaround by using interfaces, but I imagine there is an easier way to do so, and get a clean program.
Thank you in advance,
Fred
|
|
|
|
|
predeclare them, this will only work because you are not actually using them just declaring a pointer.
A.h =>
#pragma once
class B;
class A
{
protected:
B* m_Bparam;
...
}<=
B.h =>
#pragma once
class A;
class B
{
protected:
A* m_Aparam
...
}<=
|
|
|
|
|
Roger already gave you the solution, but if you want to find more info on the subject, you can google for "forward declaration" (that's how it is called).
|
|
|
|
|
Thank you very much Roger and Cedric!
Have a nice day !
|
|
|
|
|
Hi everyone,
How to add a page in the mouse of the control panel ?
Thanks!
Nike
|
|
|
|
|
|
Open the control panel ,when click the mouse, the pages of the Buttons, Pointers,Pointer Options,Whell,Hardware in the mouse attribute page.
I want to with the VC++/MFC to add a page in the mouse attribute page.
Thanks!
Nike
|
|
|
|
|
I use #import to import an .exe file(which use COM)to my project.
There are two new file create by that statement: .tlh and .tli.
But there are some strange errors occured.
error C2059: syntax error : 'constant'
error C2238: unexpected token(s) preceding ';'
error C2589: '(' : illegal token on right side of '::'
error C2143: syntax error : missing ';' before '::'
error C2059: syntax error : '::'
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)
Someone would like to help me,Why?
Thanks.
GOOD LUCK
|
|
|
|
|
Can u pls send ur code? If possible.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
of course.but the whole code is too long,i would paste a snip of it.
Because these days,I am test iTunes libaray.Here,"iTunes.exe" is valiable everywhere,such as apple.com,its lastest version is 7.3.2.4 on that web site.I use 6.0.0.18
I use such code to import the COM of iTunes:
#import "iTunes.exe"
..
..
//in .tlh file:
<br />
ITSourceKind GetKind ( );<br />
double GetCapacity ( );<br />
double GetFreeSpace ( );
IITPlaylistCollectionPtr GetPlaylists ( );
in .tli file:
inline double IITSource::GetFreeSpace ( ) {
double _result = 0;<br />
HRESULT _hr = get_FreeSpace(&_result);<br />
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));<br />
return _result;<br />
}
And if delete the error statement,no errors.
If there is no errors,I also want to know how to use the new file.
Thank you very much.
GOOD LUCK.
|
|
|
|
|
Hello guyz,
I have a problem, hope someone can help me.
When I create setup files, I declare taget location for Application Folder of the software. But at the start of the program I need to access the said folder for a file (*.ini) that i included in the setup.
For now, what i do is to state the default location. For example, c;\Program Files\Application Folder.
Problem arises when user change the target location of the folder and my program can't locate it anymore.
Is there a way to locate wherever the user placed the Apllication Folder?
How will I implement it in the source code?
|
|
|
|
|
The GetModuleFileName function retrieves the fully qualified path for the specified module.
|
|
|
|
|
Is there any way to change the row height of CListCtrl item withour owner drawing?
Thank you.
msc
|
|
|
|
|
s196675m wrote: Is there any way to change the row height of CListCtrl item withour owner drawing?
Increase the font size.
Another option is to set an image list. I.e Create an image list and set it to the list control. The height of the list control will increase to the height of the image list.
|
|
|
|
|
anybody have a code snippet/function to convert twips to pixels?
|
|
|
|
|
int pixels = MulDiv(twips, pixelsperinch, 1440);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How do you get pixelsperinch?
|
|
|
|
|
nevermind, I found it...
int pixelsperinch = GetDeviceCaps(hDC, LOGPIXELSX);
|
|
|
|
|
Yes
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
wsprintf(c,"%s%i %s%i %s%i %s%i",day,stLocal.wDay,month,stLocal.wYear,stLocal.wHour,":",stLocal.wMinute,":",stLocal.wSecond);
Why can't I get the value of stLocal.wHour, stLocal.wMinute and stLocal.wSecond?
My output appears as "Mon 4 Dec 2006" I cannot get the time in.
Help me modify my code.
thanks,
Jj
|
|
|
|
|
Maybe try casting those WORDs to ints when you pass them to wsprintf().
Also, your parameter list order and types needs to match the order and types of the format
specifiers (they don't match in your example code).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
What is not matching? How do I make the right match?
Thanks,
Jj
|
|
|
|
|
wsprintf(c,"%s%i %s%i %s%i %s%i", day, stLocal.wDay, month, stLocal.wYear, stLocal.wHour, ":", stLocal.wMinute, ":", stLocal.wSecond);
You have 8 specifiers, 9 passed arguments
The order of the 8 specifiers is
string
int
string
int
string
int
string
int
The order of the passed arguments is
string
int
string
int
string
string
int
string
int
Note that you're also passing the wrong types if those int arguments are WORD sized.
"%i" expects an int, not a WORD. If those are WORDs you are passing, cast the arguments
to ints (e.g. "(int)stLocal.wDay")
*edit* Or if they are WORD arguments, you can pass them like you are, but change the
format specifiers to "%hu" instead of "%i"
The passed arguments corresponding to each "%s" format specifier MUST
be a pointer (const is OK) to a char (const char *).
Mark
Last modified: 11mins after originally posted --
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You can also use %hu to print a WORD value.
|
|
|
|
|
Thanks Mike -
I had already edited my post, maybe the same time you were posting
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|