|
Hicks,
Assuming that your CArray declaration is like this:
CArray <MyStruct, &MyStruct> arr;
Hope you've tried this:
YourFunction ( CArray <MyStruct, &MyStruct> &arrArg ) { }
If it works for you and you think it looks messy, try typedef-ing the "CArray <mystruct, &mystruct="">" part.
Clinton
|
|
|
|
|
I was trying to have a more generic function, where I could use it for more than just that one CArray. Thanks anyways
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
Try using a template...
template<typename T1, typename T2>
fn(CArray<T1, T2> &caItem, int index)
{
...
} This will let you use the function for any CArray type
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"
|
|
|
|
|
Can someone please explain to me all possible ways of establishing a network connection in user mode... other than using winsocks.
I've found this interesting diagram: http://www.ndis.com/papers/winpktfilter.htm[^]. It appears to me that the only other way of establishing a connection would be to create a Layered Service Provided dll ?? Am I wrong. I've also ran across this : http://www.microsoft.com/msj/0599/LayeredService/LayeredService.aspx[^]. It appears to me that LSP is used for filtering... but is it still possible for an LSP to establish a connection?
|
|
|
|
|
Anonymous wrote:
but is it still possible for an LSP to establish a connection?
No it Not possible to use LSP to establish connection.it do only work of filtering and actual connection is made by WINSOCK.dll alone.
actualy you can consider LSP as Winsock HOOK.
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
OK. That makes perfect sense.
I've read some more about this stuff and some people mention that its possible to call TDI (Transport Driver Interface) directly. How can this be done?
|
|
|
|
|
Look into DeviceIoControl
Alex Korchemniy
|
|
|
|
|
Hello
I found a bad bug in the TabedReBar Sample http://www.codeproject.com/docking/TabedReBar.asp . If the toolbar is floating, some buttons, which are related to the doc/view are desiabled(Like the Save Button). But if the toolbar is docked, they are enable again.
why?
is there any solution out there?
|
|
|
|
|
While using Visual C++.Net I keep getting error C1190 with the following code. Please Help!
// animals.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
_gc class Animal
{
public:
int legs;
void SetName(String *name)
{strName = strName->Copy(name);}
String* GetName() {return strName;}
private:
String *strName;
};
int_tmain()
{
//TODO: Please replace the sample code below with your own.
Animal *cat,*bird;
cat = new animal;
bird = new animal;
cat->SetName("Cat");
cat->legs = 4;
bird->SetName(Bird");
bird->legs = 2;
Console::WriteLine("Animal 1");
Console::Write("Name: ");
Console::WriteLine(cat->GetName()):
Console::Write("Legs: ");
Console::WriteLine(cat->legs);
Console::WriteLine();
Console::WriteLine("Animal 2");
Console::Write ("Name: ");
Console::WriteLine(bird->GetName());
Console::Write("Legs: ");
Console::WriteLine(bird->legs);
Console::WriteLine();
return 0;
}
|
|
|
|
|
( seems some of your code is missing ... )
the Documentation for error C1190 says that you need to have
#using < mscorlib.dll>
in your code somewhere, I don't know where, because I'm not familiar with Managed C++.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
For example i got next architecture:
class BaseClass
{
virtual void Method1();
virtual void Method2();
};
class FuncClassOne: public BaseClass
{
void Method1();
void Method2();
};
class FuncClassTwo: public BaseClass
{
void Method1();
void Method2();
};
class Grup
{
BaseClass** m_ppObjects;
void CallAllMethods();
void Add(BaseClass* pBaseClass);
BaseClass* GetObject(long ObjectID);
};
So, i want to save this architecture and place everything in COM;
Let me try to explaint what i need (I imagine ):
IGrupPtr group(CLSID_Grup);
for(int i = 0;i<10;i++)
{
IFuncClassOnePtr p(CLSID_FuncClassOne);
group->Add(p);
}
for(int i = 0;i<10;i++)
{
IFuncClassTwoPtr p(CLSID_FuncClassTwo);
group->Add(p);
}
group->CallAllMethods();
BaseClass* pClass = group->GetObject(7);
So how can i make frome every class COM Interface?
Is it possible? Or i need to choose another way???
|
|
|
|
|
Their is quite alot of things that go into making a COM object, however to set you in the right direction:
1. your 2 interfaces I am assuming will be FuncClassOne and FuncClassTwo. To do that you need to define them as such (BTW all COM interfaces derive from IUnknown)
interface FuncClassOne : IUnknown
{
virtual void __stdcall Method1() = 0;
virtual void __stdcall Method2() = 0;
}
interface FuncClassTwo : IUnknown
{
virtual void __stdcall fc2_Method1() = 0;
virtual void __stdcall fc2_Method2() = 0;
}
2. Now you will need your COM object, containing your interfaces and the implementations.
class FuncClass : public FuncClassOne,
public FuncClassTwo
{
public:
virtual HRESULT __stdcall QueryInterface(REFIID iid, void** ppv);
virtual ULONG __stdcall AddRef();
virtual ULONG __stdcall Release();
virtual void __stdcall Method1();
virtual void __stdcall Method2();
virtual void __stdcall fc2_Method1();
virtual void __stdcall fc2_Method2();
FuncClass();
~FuncClass();
private:
long m_cRef;
};
3. Now you need to implement your COM functions
This was really just so you could see the COM implementation in C++ for what you were asking (At least I hope it was what you were asking). You really should look on MSDN for what is required to implement the COM functions and how to create CLSIDs and register your component. Unfortunately the topic is just too large to be answered fully, on this post. I hope I at least got you going in the right direction and knowing what to look for now.
|
|
|
|
|
Thank you for participating i tried to do something like you show me:
So I made an ATL Project, and in the midle file i wrote next thing:
[
object,
uuid(BFBF8B9C-64BF-42bc-82D5-8564B637012B),
dual,
nonextensible,
helpstring("IAbstractGeoObject Interface"),
pointer_default(unique)
]
interface IAbstractGeoObject : IDispatch
{
[id(1), helpstring("method Draw")] virtual HRESULT Draw() = 0;
}
[
object,
uuid(16578C15-F715-4A3A-94E7-70C1387A53B7),
dual,
nonextensible,
helpstring("IGeoObject Interface"),
pointer_default(unique)
]
interface IGeoObject : IAbstractGeoObject{
[id(1), helpstring("method Draw")] HRESULT Draw(void);
};
But it doesn't want to compile it... It shows next error message:
"Expecting a type specification near "virtual""...
So i'm in the dead end...
|
|
|
|
|
Hi,
I made a button that when you press it opens a CFileDialog,
I want it to open excel file with the excel program (excel XP or excel 2003)
after downloading each and every example there is I still couldn't found how do I do it.
you can open the file if you are right clicking the file and then choosing open, but I want it to do the same when you are doing open through the panel
please help me..
Lani
|
|
|
|
|
have you looked at ShellExecute()?
|
|
|
|
|
Hi
I was wondering if anyone knows the minimal code necessary to play a sound file of whatever sort (mp3, wave, whatever else...) at different speeds and/or in different directions (back or forward). Basically I'd like to make a super simple
turntable program... something with a "load" "play" and "stop" button and a slider that decides speed and direction of
your song...
thanks for any advice.
fred
|
|
|
|
|
I haven't done much code in this area... but look into the Windows Media Player SDK. It not going to be the most efficient solution but it sure is the laziest one.
Alex Korchemniy
|
|
|
|
|
Please let me know about the basics about .odl file, it's creation and purpose.
Any kind of suggesion or link to the particular documentation will help me a lot............
looking for your immediate response...
|
|
|
|
|
I want to enlist various file types much like that enlisted in Search >> For files and folders >> type >> combobox of Windows Microsoft 2000 Professional.
that is.... known file types on system along with name and icon...How is that done.
|
|
|
|
|
I want to enlist various file types much like that enlisted in Search >> For files and folders >> type >> combobox
that is known file types along with name and icon...How is that done.
|
|
|
|
|
I have an edit box on property page. I want to fetch its value in my formview.cpp . Then how is that done ? Can Some one help me out.
Thanx in advance.
Drushti
|
|
|
|
|
Miss Nazar,
if you know the ID of the EditBox you can use following api to retieve the value
1.GetDlgItemText<br />
2.GetDlgItemInt
or I think you are using MFC , just add the variable to
the EditBox using MFC ClassWizard>>member variable,
and When ever you need the value just Call
UpdateData(TRUE); and you variable will
fill with value present in Editbox
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
|
How do I modify values (Comments, CompanyName, FileDescription, LegalCopyright, etc) in the StringFileInfo block of an external EXE resource?
Sample code would be greatly appreciated!
|
|
|
|
|
I don't have sources but there is no magical api that will do this(as far as I know) you havve to open the file and write to it replacing the info you want to replace with your info.
To know what to replace you need to lear about PE headers so you can find where the info is stored and overwrite it.
That's all I know on the subject,
hei, if you manage to do this send me the source to ok?
|
|
|
|