|
hiho@ll
just wanted to know what to do if i have 2 classes
class example1
class example2
to use the class example1 in example2 i use #include "exmple1.h" in the example2.h
but then i want to program a function in example1 which uses example2
if i add #include "example2.h" in example1.h i get a compiler error in example1.h
syntax error: identifier 'example2'
i understand why this error occurs
but how i make a workaround?
thx
|
|
|
|
|
You just forward-declare example 2:
<br />
<br />
class example2;<br />
<br />
class example1<br />
{<br />
public:<br />
....<br />
example2* pex2;<br />
}<br />
but as you can see, you can only use pointers to the forwarded class, not the class itself.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
well u c u have example1 class and example2 class,u cant interrelate themeboth for a simple reason that can be explained by thiz example.....
cansider a case where u have a classes that need each other.....that is example1 object is there in example 2 and vice versa.....
observe.....
class example2
{
example1 ex1;
}b;
class example1
{
example2 ex2;
}a;
letz consider object b.....
note that "b" would contain "ex1" and "ex1" would contain "ex2"....and what is ex2???....logically it goes to infinity(since each instance contains the instance of the other in itself)!!!!!
so it doesnt make sense.....moreover u can only create an object if itz memberz are all defined!!!!!.....say in class example2, the example1 need to be understood by the compliler to allocate /putaside the value for that object,but to get theat done example1 class must be fully defined,u will find it dependz on example2 and hence not possible!!!!!
thiz iz the way i reason it out!!!!!!;)
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
hello
i am working on my final project for graduation.
i have a tv tuner card connected with a wireless camera.
i want the video retrieved by camera to be processed in VC.
the problem is how could i get that video in VC from tv tuner card.
also some attributes to be sent to the camera for its movement.
tell me plz the path and API to be used.
thanx
|
|
|
|
|
Hi everyone.
My problem: I want to determine if a http server accepts bytes ranges. I am using wininet functions, (internetopen->internetconect->httpopenrequest->httpsendrequest->httpqueryinfo). If anyone can suggest me how to do this, or point me to a piece of relevant code (VC++) please help.
THANKZ.
|
|
|
|
|
HI
I am using visual C++ .net. I just created dialog box A under project 1, dialog box B and one edit control box under project 2.
It is possible to display the 'caption' of dialog box A on the edit control box of dialog B? If yes, what codes whould I type ?
Thx
|
|
|
|
|
there is any way to set transperent color ? in SetTextColor.
|
|
|
|
|
Use SetBkMode() to make the background transparent. If you want to make the text partially transparent, you can't, not with the Windows API.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hello,
I tried using this function inside my ISAPI
HWND FindWindow( LPCTSTR lpClassName, LPCTSTR lpWindowName)
because i need to do some UI update under my ISAPI function. But the return handle is NULL.
I already tried this function in a dialog class and this works fine ...
Do you have any idea on FindWindow function limitation or is this ISAPI limitation?
I really need your help guys ...
Thanks,
jude
|
|
|
|
|
This is because ISAPI DLL is called from a service, which is executed on
non-interactive window station and therefore has no access to the user
desktop.
So is there anyway?
Can anyone help me ???
jude
|
|
|
|
|
Hello Everyone ...
I am trying to do uploading/downloading of file program using a VC++ as client and ISAPI Dll on the server side. Can any body help me on how to upload a file?
Well, i have tried downloading a file but had problem on exe files. On the uploading of file I still really blank ....
Can anyone help me ... or if you have sa url where i can look at or a rough sample.
Thanks,
jude
|
|
|
|
|
i set the multiline property of a textbox in a dialog box.
but at run time when press enter it doesn't go to next line.
cursor is being in the same line.
i also tried by setting the auto VScroll and Auto HScroll properties . but it won't work.
|
|
|
|
|
Set the ES_WANTRETURN style.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
|
Hi. i'm trying to understand event logging. I got this sample function from MSDN on adding source into the registry. Is this code correct? It's hard to learn something when the sample is incorrect. Thanks
<br />
BOOL AddEventSource(<br />
LPTSTR pszLogName,
LPTSTR pszSrcName,
LPTSTR pszMsgDLL,
DWORD dwNum)
{<br />
HKEY hk; <br />
DWORD dwData, dwDisp; <br />
TCHAR szBuf[MAX_PATH]; <br />
<br />
<br />
wsprintf(szBuf, <br />
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\%s\\%s",<br />
<br />
pszLogName, pszSrcName); <br />
<br />
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, szBuf, <br />
0, NULL, REG_OPTION_NON_VOLATILE,<br />
KEY_WRITE, NULL, &hk, &dwDisp)) <br />
{<br />
printf("Could not create the registry key.");<br />
return FALSE;<br />
}<br />
<br />
<br />
if (RegSetValueEx(hk,
"EventMessageFile",
0,
REG_EXPAND_SZ,
(LPBYTE) pszMsgDLL,
(DWORD) lstrlen(pszMsgDLL)+1))
{<br />
printf("Could not set the event message file."); <br />
return FALSE;<br />
}<br />
<br />
<br />
dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | <br />
EVENTLOG_INFORMATION_TYPE; <br />
<br />
if (RegSetValueEx(hk,
"TypesSupported",
0,
REG_DWORD,
(LPBYTE) &dwData,
sizeof(DWORD)))
{<br />
printf("Could not set the supported types."); <br />
return FALSE;<br />
}<br />
<br />
<br />
if (RegSetValueEx(hk,
"CategoryMessageFile",
0,
REG_EXPAND_SZ,
(LPBYTE) pszMsgDLL,
(DWORD) lstrlen(pszMsgDLL)+1))
{<br />
printf("Could not set the category message file."); <br />
return FALSE;<br />
}<br />
<br />
if (RegSetValueEx(hk,
"CategoryCount",
0,
REG_DWORD,
(LPBYTE) &dwNum,
sizeof(DWORD)))
{<br />
printf("Could not set the category count."); <br />
return FALSE;<br />
}<br />
<br />
RegCloseKey(hk); <br />
return TRUE;<br />
}<br />
From : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/adding_a_source_to_the_registry.asp
|
|
|
|
|
Hi,
In my MDI Application I use CScrollView. I need to get the full view size when the view is not in maximized.
Thanks in advance!
Have A Nice Day!
Murali.M
|
|
|
|
|
I want to save a window as a bitmap file.First I show a dialog in order to get the file name by using function domodal(),then I convert the window to a DIB and save it as a bitmap file. All is OK but the dialog is also be showed in the image!
What wrong?
I thought the dialog should not be diaplayed in the wonodw yet after the function domodal().
I have add funtion Invalidate() after the domodal(), but no change.
andy
|
|
|
|
|
You're plainly grabbing the screen while the dialog box is up - where else could it come from ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
But When will the dialog box disappear?
andy
|
|
|
|
|
Hi all !
I am buill dll application in VC++ with MFC AppWizard(dll).
In the file StdAfx.h, I have included the line follows into it's header.
#import "C:\Program Files\Common Files\System\ado\msado15.dll" \
no_namespace \
rename( "EOF", "adoEOF" )
I using msado15.dll for accessing the .mdb database. But When I builded my application, I always met some mistake . Example
'LockTypeEnum' : 'enum' type redefinition
I really don't known why ? I done well in the normal application but in dll application I can't...
pls, help me resolve the problem. Thanks alots
|
|
|
|
|
Can you try this:
#import <msado15.dll> rename_namespace("ADO") rename("EOF","ADOEOF")
|
|
|
|
|
I haved try. It done well. Thanks alots
|
|
|
|
|
Hi everybody : ). Before I begin, I must say I'm a newcommer to the world of Visual C++. Up until a few days ago I didn't know much about it, but I'm a fast learner, specially when I really have to do do something. And I really have a complex task that I need to accomplish. It's related to the SysTray. I won't get into that... anyway, the toughest part is this: creating a hook on Explorer.exe to monitor the messages it sends to the Systray's window.
What I need to make is a DLL to call from my VB application. I know how to do all that but here comes the problem. I have this VC++ DLL tutorial for a system-wide keyboard hook and I wanted to adapt this to VB.... Unfortunately, I didn't even get to adapting. Why? Because I got some compilation error that I am unable to correct. Here is the full source code of the module in cause (it's the header file of the DLL)
<br />
#define MAINHOOK_API _ _declspec(ddlexport)<br />
<br />
#define CCONV _stdcall<br />
#define NOMANGLE<br />
<br />
#define WH_KEYBOARD 2<br />
#define HC_ACTION 0<br />
<br />
typedef struct tagKBDLLHOOKSTRUCT {<br />
DWORD vkCode;<br />
DWORD scanCode;<br />
DWORD flags;<br />
DWORD time;<br />
DWORD dwExtraInfo;<br />
} KBDLLHOOKSTRUCT, FAR *LPKBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;<br />
<br />
LRESULT CALLBACK KeyboardFunc (int nCode, WPARAM wParam, LPARAM lParam );<br />
<br />
#ifdef _ _cplusplus<br />
extern "C" {<br />
#endif<br />
MAINHOOK_API int InstallFilterDLL(void);<br />
MAINHOOK_API int UnInstallFilterDLL(void);<br />
#ifdef _ _cplusplus<br />
}<br />
#endif<br />
<br />
Of course you already saw probably what is the problem. Yeah, I know. Those "_ _cplusplus" tags. I don't know what they mean but my VC++6 doesn't seem to "know" them. In the book from where I took this code there wasn't any mention about "what kind" of C++ is this. The basic is that it doesn't compile. Here are the errors:
warning C4067: unexpected tokens following preprocessor directive - expected a newline
error C2485: 'ddlexport' : unrecognized extended attribute
error C2144: syntax error : missing ';' before type 'int'
error C2501: '_' : missing storage-class or type specifiers
fatal error C1004: unexpected end of file found"
So? Anybody has any idea what I'm up against? : ). Thanks a lot for all the time you guys spend helping people such as myself : ). If I *EVER* get good enough, I promise I'll return the favor. And I'm a man of my word. But for now, I really need help with this...
P.S. It's for a good cause... I`m developing a freeware Application that most of you will probably like... if it's ever gonna be completed.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Is it my imagination or am I seeing a space between the two underscores?
Remove the space, and use two leading underscores and try again.
__cplusplus
not
_ _cplusplus
|
|
|
|
|
Nope, not your imagination... : ). But this is not the problem I think. This only solved one of the warnings of the compiler. I already did try that. I documented enough to know that __cplusplus is a known directive, but anyway, _ _cplusplus was in that book so.... Now that I put two leading underscores and compiled again I "only" get these errors:
error C2485: 'ddlexport' : unrecognized extended attribute
error C2144: syntax error : missing ';' before type 'int'
error C2501: '_' : missing storage-class or type specifiers
fatal error C1004: unexpected end of file found
Also, what I did now is replace #define MAINHOOK_API _ _declspec(ddlexport) with #define MAINHOOK_API __declspec(ddlexport) (I put two leading underscores again.)
This resulted in this error
D:\Lucru\!!Aoleo\Exp\Exp.cpp(33) : error C2485: 'ddlexport' : unrecognized extended attribute beeing repetead 7 times in my CPP file. Here is my CPP file in case you were wondering... (I posted now the full source code, the header file is in my previous post).
By the way, this is a SIMPLE WIN32 DLL (not a DLL that exports some symbols or empty DLL, so you imagine how stdafx.h and stdafx.cpp look like).
<br />
<br />
<br />
#include "stdafx.h"<br />
#include "Exp.h"<br />
#include "WINUSER.H"<br />
<br />
HANDLE hInstance;<br />
HHOOK hhookHooks;<br />
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved<br />
)<br />
{<br />
hInstance = hModule;<br />
switch (ul_reason_for_call)<br />
{<br />
case DLL_PROCESS_ATTACH:<br />
case DLL_THREAD_ATTACH:<br />
case DLL_THREAD_DETACH:<br />
case DLL_PROCESS_DETACH:<br />
break;<br />
}<br />
<br />
return TRUE;<br />
}<br />
<br />
MAINHOOK_API int InstallFilterDLL(void);<br />
MAINHOOK_API int UnInstallFilterDLL(void);<br />
LRESULT CALLBACK KeyboardFunc (int nCode, WPARAM wParam, LPARAM lParam);<br />
<br />
MAINHOOK_API int InstallFilterDLL(void)<br />
{<br />
hhookHooks = SetWindowsHookEx(WH_KEYBOARD, <br />
(HOOKPROC) KeyboardFunc,<br />
(HINSTANCE) hInstance,<br />
0);<br />
return 1;<br />
}<br />
<br />
MAINHOOK_API int UnInstallFilterDLL(void)<br />
{<br />
int iResult;<br />
iResult = UnhookWindowsHookEx(hhookHooks);<br />
if (iResult == 0) return 0; else return 1;<br />
}<br />
<br />
LRESULT CALLBACK KeyboardFunc (int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
return CallNextHookEx(hhookHooks, nCode, wParam, lParam);<br />
}<br />
What do you say about this? Either that book is not good, either I'm too much of a beginner to handle this. I worked with C# in the past year and half but this is a totally different game : )
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|