|
Sure this sounds silly considering the plethora of available RDBMS out there but does anything like the subject would suggest actually exist...???
Basically an advanced CFile w/ like Hybrid SQL support or something? That doesn't require any third party libs, drivers, dll's or anything...???
Just curious....
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
|
Hi, all
Some problems about ATL Com:
1.I have create two ATL Object: CStudent and CTeacher .
The simple source code listed as follow: (some code auto generated by ATL have been skiped)
class CStudent
{
private:
long m_age;
public:
CStudent():m_age(10)
{
}
//...other code auto generated by ATL
};
class CTeacher
{
private:
IStudent* m_aStudent;
public:
CTeacher()
{
//create an instance of the com
CoCreateInstance(CLSID_Student,NULL,CLSCTX_ALL,IID_IStudent, (void**)&m_aStudent);
}
//...other code auto generated by ATL
}
2.Then I add a "IStudent * OneStudent" property for ITeacher ,to access the m_aStudent.
The implemention of the property are listed as below:
STDMETHODIMP CTeacher::get_OneStudent(IStudent *pVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
*pVal = * m_aStudent;
return S_OK;
}
STDMETHODIMP CTeacher::put_OneStudent(IStudent *newVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
*m_aStudent = *newVal ;
return S_OK;
}
3.Now I type some VB code to test the com ,but some compiler errors occurrs.
VB Code:
Dim s As Student
Dim t As New Teacher
s = t.OneStudent
the last sentence "s = t.OneStudent" have compiler errors.
Errors:function or interface marked as restricted ,or the function use an Automation type not supported in Visual Basic
I guess the errors caused by the type dismatch between IStudnet and CStudent.But I did not know how to resolve it .
So who can tell me how to return the m_aStudent that can be supproted in vb??
thx.
Regards.
|
|
|
|
|
As I've already told you, you cannot return an instance of your class. You may be able to return a pointer to another COM object, but you cannot return a vanilla class instance. IDispatch interfaces ( i.e. Automation ) also have more restrictions than normal interfaces, if I remember correctly. If a teacher has lots of students, I think my original suggestion of returning their details as XML remains a good one.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
I am a newer to ATL.
I think I just return a pointer to another COM object .
STDMETHODIMP CTeacher::get_OneStudent(IStudent *pVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
*pVal = * m_aStudent;
return S_OK;
}
STDMETHODIMP CTeacher::put_OneStudent(IStudent *newVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
*m_aStudent = *newVal ;
return S_OK;
}
|
|
|
|
|
Is the IDL for get_OneStudent marked as [out,retval] for the IStudent parameter?
Is IStudent an IUnknown or IDispatch interface?
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
You should returns a new object; something like:
STDMETHODIMP CTeacher::get_OneStudent(IStudent **pVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
**pVal = * m_aStudent;
(*pVal)->AddRef();
return S_OK;
}
Also note that others functions need to be modified. For example setting a new student would have to update the pointer (and properly adjusting reference count).
As mentionned in another answer, you cannot pass object around but only interface to objects...
Philippe Mori
|
|
|
|
|
How can i initialize my console app to use ADO. If the console app is MFC based then we use AfxOleInit() to initialize COM libraries and use #import statement in stdAfx.h.
But the application i want to make is pure console application without MFC support and without any StdAfx.h. So please tell me how I Initialize it that it can use ADO
Virtual Destructor
|
|
|
|
|
CoInitalize(NULL)
will allow you to call COM.
The #import stuff should then work.
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
How can i know if the desktop windows Z order has been changed?
thanx
|
|
|
|
|
wazzup,
i am currently trying to get the user arguments as
MyApp.exe -argument
i have tried using the sample program by chris losinger. the argument which needed is captured on the command line is then passed through to the gui.
but instead nothing is captured. i am just not sure what is needed to be specified
Regards,
CaLvin Tan
|
|
|
|
|
Depends on whether it's a command-line or GUI app. For command-line, use the standard argc/argv arguments to main() .
For GUI, you can use the globals __argc and __argv that the CRT supplies, or call GetCommandLine() and parse it yourself.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi
I read OpenGL SuperBible and I making simple 3Dgame...
but I don't know How to darw shadow of sphere and line
shadow example of OpenGL SuperBible is shadow of object what
consist of 3 vertex
I want a example of sphere and line...
please help me~;)
dark
|
|
|
|
|
Hi, I'm wondering if anyone could help me enable multiple instance on a Visual C++ program that was already made. The program disabled multiple instance so I could not run serveral of the same windows anymore, and I just want to run serveral of the same windows. For example... msn polygamy.
The program that I want to disable can be downloaded here >> http://quizquiz.nexonasia.com/download/setup.exe
It's a game that I would like to clone. I read on the site about mutliple instances and understood some of it, but I'm not good at programming languages, so I didn't know what to do.
I tried to use a hex editor to find the text string value "Mutex". But I didn't know what to change. All I know is that mutex has something to do with disabling multi instance.
I'd appreciate if someone would kindly help me out. Thanks.
|
|
|
|
|
Are you saying you want to modify the behavior of the binary? That can be done by patching the .exe, but don't even begin to try if you're not handy with x86 assembler and Windows internals.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I am also thinking of developing a tool for this, because there are too many apps that use the always recommended, but wrong Mutex-Trick and therefore do not behave well in an multiuser environment . (Detailed discussion about this problem can be found in this article.)
The idea is to use one of the proposed API-Hooking techniques to catch the CreateMutex()/OpenMutex() call of the app. If the mutex to be created is the "instance mutex" we patch it's name, so it is no more unique when it should not be. To find out, which one is the "instance test mutex" you can use ProcessExplorer from SysInternals.com. Just look for Mutants in the address space of the process and if one of them seems to be the one we are searching for (often indicated by its name or an GUID as name). Then close it with ProcessExplorer and try to run another instance. If this works, you found the nasty thing.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
In Internet Explorer, when we have script in a page, which calls another page and open another window. Does IE create a script engine for individual page, or just using one script engine for the Applicaiton ?
|
|
|
|
|
Hi,
I woulde like to use Visual C++ with Internet environment, when I include the Iphlpapi.h in ---> When compile time it say it can find it! I look to my system (search) ... I only see the Iphlpapi.dll in c:\Windows\system\
Someone can say why my Visual c++ can not see it (Iphlpapi.h) or using the Iphlpapi.dll?
Where can I download the Iphlpapi.h?
Thanks for any help!
Anh Truong
|
|
|
|
|
You should DL the platform SDK from here: http://www.microsoft.com/msdownload/platformsdk/setuplauncher.htm
|
|
|
|
|
Hi,
I did try to download the Update Platform SDK, but always the web ask me to restart the system and after that I got the message: Can not create a Server object! That is why I could not download it!
Is there other way? What I would like to do is using Visual C++ program to search the IP address the PC it is resided, do I need that SDK Platform to do this function? If not, do you know which codes I should use?
Thank you for help,
ATC
|
|
|
|
|
Hi,
I tried several times, any time after the site ash me to restart the computer to change the setting system ... then it said: "Can not create a Server object" ---> I could not download it!
Do you know why? By the way, what I need is using Visual C++ 6.0 codes to read my PC IP address! Do I need that SDK Platform? If not, can you show me where or how I can use codes?
Thank you for help,
|
|
|
|
|
Hi,
I made a DLL with a bunch of registry functions (i.e. GetProfileString, WriteProfileString, etc.) and it is performing in a way other than I expected.
When my program uses my DLL to write to the registry, it is doing so in the folder of my program's name, not in the folder of my DLL's name.
Any ideas/solutions? Thanks in advance,
~ Selevercin
If you have a problem with my spelling, just remember that's not my fault. I [as well as everyone
else who learned to spell after 1976] blame it on
Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
Is the following a legitimate exception throw..???
for(UINT i=0; i<m_nCount; i++){
try{
delete (myClass*)m_pStack[i];
}
catch(...){
if(m_pStack[i]!=NULL)
throw "Object doesn't exist";
}
}
Would this exception make sense to any third party using my class...???
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey -
The problem is that the exception handler could itself throw another exception. So, dont use the above code snippet.
For example : if m_pStack[i] referred to uncommited virtual memory, both references to m_pStack[i] would throw a ILLEGAL_ACCESS exception.
Hth-
V
|
|
|
|
|
What technique should I use then...???
I think it would be wise to use exceptions when deleting memory incase it's a bogus pointer...no...???
thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|