|
|
You need to make composite activex control.
-Prakash
|
|
|
|
|
i am previously ask this question before but i have relise taht my previous question was not easy to understand.
can any one please teach me how i can pass a object to a function using pointers?
this is normally how i pass a normal variable to a function using a pointer:
<br />
void function(int* ptr)<br />
int main()<br />
{<br />
int num1;<br />
function(&num1);<br />
<br />
return 0;<br />
}<br />
wat i wanan do now is something like this:
<br />
class theclass<br />
{<br />
public:<br />
<br />
}<br />
void function(theclass* ptr)<br />
<br />
int main()<br />
{<br />
theclass tc;<br />
function(&tc);<br />
<br />
return 0;<br />
}<br />
so what i am trying to do is replacing the int with the object but it have error so could any one please teach me how to do this??
i will greatly appreciated it
|
|
|
|
|
What is the error that you are getting ?
-Prakash
|
|
|
|
|
this is part of my actual code:
<br />
void add_new_item(grahpic_card* gc_add);<br />
<br />
int main()<br />
{<br />
graphic_card gc;<br />
add_new_item(&gc);<br />
}<br />
:\Documents and Settings\nick\Desktop\lalabear project\newporject.cpp(128) : error C2065: 'grahpic_card' : undeclared identifier
C:\Documents and Settings\nick\Desktop\lalabear project\newporject.cpp(128) : error C2065: 'gc_add' : undeclared identifier
C:\Documents and Settings\nick\Desktop\lalabear project\newporject.cpp(128) : error C2182: 'add_new_item' : illegal use of type 'void'
C:\Documents and Settings\nick\Desktop\lalabear project\newporject.cpp(160) : error C2064: term does not evaluate to a function
C:\Documents and Settings\nick\Desktop\lalabear project\newporject.cpp(181) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
|
|
|
|
|
neodeaths wrote: :\Documents and Settings\nick\Desktop\lalabear project\newporject.cpp(128) : error C2065: 'grahpic_card' : undeclared identifier
neodeaths wrote: graphic_card gc;
are you sure ur class name is graphic_card and not grahpic_card (spelling mistake)
-Prakash
-- modified at 11:10 Saturday 7th January, 2006
|
|
|
|
|
wow your rite!
it works now!!
thank you for your help
|
|
|
|
|
You beat me to it!
Kevin
|
|
|
|
|
your suggestion of reference is good too but then i thought fixing his compiler error was first thing to do.
-Prakash
|
|
|
|
|
-Prakash
|
|
|
|
|
You're just a victim of people (and I use that term very loosely) that have a thick single eyebrow running across their severely sloped foreheads. These individuals are also open-mouth breathers that walk around with a stupid grin on their faces and drool running out of one corner of their mouth. Their IQ is typically "1", just like the votes they cast...
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Mellowing out these days John? By the way, I agree with you and a way to track those who have voted you a 1 would be nice.
The tigress is here
|
|
|
|
|
I had suggested that a mail be send to the poster whose message was voted with info like who voted it and with what, but not many ppl liked it.
-Prakash
|
|
|
|
|
Yep. Notice I didn't call them "dim-witted mother f***ers"?
I don't care who votes 1's on my messages - let them wallow in their false sense of power for all I care. What I care about is the morons that vote *articles* based on politics instead of the content of the article.
BTW, how are ya? Haven't seen you post in a while.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Mr.Prakash wrote:
thats common!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote: thats common!
really, so voting down a message where i helped that guy is common? who does that?
-Prakash
|
|
|
|
|
Mr.Prakash wrote: really, so voting down a message where i helped that guy is common? who does that?
No Comments..
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Mr.Prakash wrote: really, so voting down a message where i helped that guy is common? who does that?
Some time people think voting one means that you are voting the person highest vote or some time by mistake they press 1 instead of 5 as 2-4 voting system in my opinion are no use. i.e. answer can be good or bad not medium
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
neodeaths wrote: void add_new_item(grahpic_card* gc_add);
You've misspelt graphic_card as grahpic_card!
BTW, you normally pass objects by const reference rather than pointer unless you have a good reason not to.
void add_new_item(const graphic_card& gc_add);
graphic_card gc;
add_new_item(gc);
Kevin
|
|
|
|
|
neodeaths wrote: ...but it have error...
And that error would be?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Hi
Imagine you have a parent class and some derived.
Is it possible to iterate through a mixed list these child classes?
And if so how to realise this?
At last it must be possible to enter the method of the child class fi derived.
THX Tim
|
|
|
|
|
Hi Everyone,
I have an MFC (MDI) application that has been deployed over the network, windows NT/2000 & xp OS. I need to integrate the application's login session with Windows login.
So the users don't have to login separately with the application.
At present, the system(application) has its own security features, so the users has to have at least two passwords(one for windows & other for appln), now i have to give an option for users to choose Windows login(User ID & password) as default for application.
Can any one please give me an Idea or refer to an article regarding this, i'm just hopeless.
Mo
-- modified at 8:27 Saturday 7th January, 2006
|
|
|
|
|
If I understand correctly, you want the program to log the user in based on their current log-in status in Windows. Try this code:
Header file:
#if !defined(AFX_USER_H__E9C9AE42_48F3_47E0_BA0C_ECA5F0DDD558__INCLUDED_)
#define AFX_USER_H__E9C9AE42_48F3_47E0_BA0C_ECA5F0DDD558__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CQOSUser
{
public:
CQOSUser();
virtual ~CQOSUser();
HRESULT GetUserInfo(CString & strLogonDomain, CString& strUserName, CString& strLogonServer);
};
#endif // !defined(AFX_USER_H__E9C9AE42_48F3_47E0_BA0C_ECA5F0DDD558__INCLUDED_)
CPP file:
#include "stdafx.h"
#include "QOSUser.h"
#include "windows.h"
#include "assert.h"
#include "lm.h"
#include "sstream"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
CQOSUser::CQOSUser()
{
}
CQOSUser::~CQOSUser()
{
}
HRESULT CQOSUser::GetUserInfo(CString & strLogonDomain, CString& strUserName, CString& strLogonServer)
{
HRESULT hResult = S_OK;
WKSTA_USER_INFO_1* pUserInfo = 0;
NET_API_STATUS status = ::NetWkstaUserGetInfo(0,
1,
reinterpret_cast<PBYTE*>(&pUserInfo));
if (NERR_Success == status)
{
ASSERT(0 != pUserInfo);
strLogonDomain = reinterpret_cast<PCWSTR>(pUserInfo->wkui1_logon_domain);
strUserName = reinterpret_cast<PCWSTR>(pUserInfo->wkui1_username);
strLogonServer = reinterpret_cast<PCWSTR>(pUserInfo->wkui1_logon_server);
status = ::NetApiBufferFree(pUserInfo);
ASSERT(NERR_Success == status);
}
else
{
hResult = E_FAIL;
}
return hResult;
}
Usage:
CString m_strUserDomain;
CString m_strUserName;
CString m_strUserServerLogin;
CQOSUser u;
u.GetUserInfo(m_strUserDomain, m_strUserName, m_strServerLogin);
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
-- modified at 8:52 Saturday 7th January, 2006
|
|
|
|
|
Hi Jystad,
Thanks Jystad, tried your code, but there were some syntax errors, anyway thanks for the clue, i can pickup from here.
Still i'm looking for some article regarding Windows Security & their API's. Could you refer me to any article?
thanks again
Mo
|
|
|
|
|
That code works perfectly in VC6 (I posted the entire class and all the includes are for ms files). If you're using something newer, your results will most certainly vary.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|