|
You could try creating them yourself
<br />
GUID BaseGuid;<br />
CoCreateGuid(&BaseGuid);<br />
<br />
GUID MySecondGuid;<br />
MySecondGuid.Data1 = BaseGuid.Data1;<br />
MySecondGuid.Data2 = BaseGuid.Data2;<br />
MySecondGuid.Data3 = BaseGuid.Data3;<br />
<br />
MySecondGuid.Data4 = Whatever you want<br />
|
|
|
|
|
I need the whole thing to be generated programatically (by the windows api). I think I found the answer, but I need a new version of the platform SDK to get the function prototype.
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
What function are you using, or thinking of using? It might come in handy for something I've been considering.
|
|
|
|
|
In Win2K, use UuidCreateSequential to get sequential guids.
In Win9x, using UuidCreate will do the same thing (I think).
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
You need to have at least the February 20001 release of the SDK to get the correct code. My SDK at home is too early of a version.
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
Hi John,
You can create consecutive GUID's with the UuidGen utility. Use the -nXXX command line switch. According to the MSDN documentation, you can create sequential guid's programmatically by creating a single GUID (with CoCreateGuid), and then incrementing the FIRST word of each subsequent GUID. So, I don't think you want to increment the last word of the GUID as shown, since this may result in non-unique GUID's; it appears that the first word of the set is the one that is generated from the time on the machine, not the last one. This should satisfy that the GUID's are unique across machines as well, since you aren't messing with the part that contains the MAC address of the machine.
// MSDN Documentation, search for "GUID Creation and Optimizations"
For example, if you were to type
uuidgen -n5 -s >guids.txt
the uuidgen utility would generate a block of UUIDs similar to the following:
{12340001-4980-1920-6788-123456789012}
{12340002-4980-1920-6788-123456789012}
{12340003-4980-1920-6788-123456789012}
{12340004-4980-1920-6788-123456789012}
{12340005-4980-1920-6788-123456789012}
One method for generating and tracking GUIDs for an entire project begins with generating a block of some arbitrarily large number of UUIDs—say, 500. For example, if you were to type
uuidgen -n500 -s >guids.txt
the utility would generate 500 consecutive UUIDs and write them to the specified text file. You could then check this file into your source tree, providing a single repository for all GUIDs to be used in a project. As people require GUIDs for their portions of the project, they can check out the file, take however many GUIDs they need, marking them as taken and leaving a note about where in the code or "spec" they are using them.
|
|
|
|
|
Those wouldn't be UUIDs (a.k.a. CLSID, GUID, IID).
http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I bookmarked that page - good read.
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
I am working on a project that will recieve netmeeting calls. Upon connection it will open an audiostream, and then watch the state of the INmChannelAudio object. More precisely, the INmChannelAudio object is supposed to provide an automatic callback to the INmChannelAudioNotify class, which I have written according to the samples provided by microsoft. However, for some reason it never calls back that function. Also, when I manually try to check the state of the INmChannelAudio object via the calls GetState and IsIncoming, GetState returns NM_AUDIO_TRANSFERRING once the audio object has become active, unless it has been set to pause, in which case it returns NM_AUDIO_PAUSED. IsIncoming() always returns S_FALSE, even when there is audible data coming from the speakers.
So I am led o a couple of assumptions -- Either my code to check the state is wrong, or I am connected to the object wrong. I'm almost certain my code to check the state is correct, since it changes. I am not sure about IsIncoming though, because it always returns S_FALSE. the code I have been using is
HRESULT hr;
NM_AUDIO_STATE puState;
PUSER pUser = (PUSER) PUserLocal();
INmChannelAudio * pChannel = pUser->m_pChannelAudio;
pChannel->GetState(&puState);
hr = pChannel->IsIncoming();
However, no matter what, this code doesn't really matter. I am using it to debug. My main problem is the class CAudNotify which is the INmChannelAudioNotify class. As I said before, the INmChannelAudio class, which is predefined, is supposed to call back to my CAudNotify class once they are connected. Since it does not, I assume my connect code is flawed. Here is that code:
//Class declaration
class CAudNotify : public RefCount, public CNotify, public INmChannelAudioNotify
{
public:
CAudNotify();
~CAudNotify();
// INmChannelAudioNotify
HRESULT STDMETHODCALLTYPE NmUI(CONFN uNotify);
HRESULT STDMETHODCALLTYPE MemberChanged(NM_MEMBER_NOTIFY uNotify, INmMember * pMember);
HRESULT STDMETHODCALLTYPE StateChanged(NM_AUDIO_STATE uState);
HRESULT STDMETHODCALLTYPE PropertyChanged(DWORD dwReserved);
// ICNotify methods
HRESULT STDMETHODCALLTYPE Connect (IUnknown *pUnk);
HRESULT STDMETHODCALLTYPE Disconnect(void);
// IUnknown methods
ULONG STDMETHODCALLTYPE AddRef(void);
ULONG STDMETHODCALLTYPE Release(void);
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, PVOID *ppvObj);
};
//and class code
HRESULT HookAudio(INmChannel * pChannel)
{
HRESULT hr;
CAudNotify * pNotify;
ASSERT(NULL != pChannel);
if(NULL != g_pChannelAudio)
{
g_pChannelAudio->Release();
MessageBox(NULL,"HookAudio: replacing existing g_pChannelAudio","call",MB_OK);
}
if(NULL != g_pChannelAudio)
{
g_pNotifyAud->Disconnect();
g_pNotifyAud->Release();
}
hr = pChannel->QueryInterface(IID_INmChannelAudio, (void **)&g_pChannelAudio);
if (FAILED(hr))
{
MessageBox(NULL,"HookAudio: Unable to get Audio channel","call",MB_OK);
return hr;
}
pNotify = new CAudNotify();
if(NULL == pNotify)
{
hr = E_OUTOFMEMORY;
}
else
{
hr = pNotify->Connect(g_pChannelAudio);
if(FAILED(hr))
{
MessageBox(NULL,"CAudNotify Failed" ,"call",MB_OK);
pNotify->Release();
}
else
{
MessageBox(NULL,"Audio Connection point established successfully" ,"call",MB_OK);
g_pNotifyAud = pNotify;
}
}
if(FAILED(hr))
{
MessageBox(NULL,"Audio Connection point failed" ,"call",MB_OK);
g_pChannelAudio->Release();
g_pChannelAudio = NULL;
}
return hr;
}
HRESULT STDMETHODCALLTYPE CAudNotify::QueryInterface(REFIID riid, PVOID *ppvObject)
{
HRESULT hr = S_OK;
*ppvObject = NULL;
if (riid == IID_IUnknown)
{
*ppvObject = (IUnknown *)this;
MessageBox(NULL,"CAudNotify::QueryInterface(): Returning IUnknown.","call",MB_OK);
}
else if (riid == IID_INmChannelAudioNotify)
{
*ppvObject = (/*INmChannelAudioNotify*/PVOID *)this;
MessageBox(NULL,"CChannelAudioNotify::QueryInterface(): Returning INmChannelAudioNotify.","call",MB_OK);
}
else
{
hr = E_NOINTERFACE;
*ppvObject = NULL;
MessageBox(NULL,"CAudNotify::QueryInterface(): Called on unknown interface.","call",MB_OK);
}
if (S_OK == hr)
{
AddRef();
}
return hr;
}
HRESULT CAudNotify::Connect(IUnknown *pUnk)
{
MessageBox(NULL,"CAudNotify::Connect","call",MB_OK);
return CNotify::Connect(pUnk, IID_INmChannelAudioNotify, (IUnknown *)this);
}
HRESULT STDMETHODCALLTYPE CAudNotify::MemberChanged(NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
{
MessageBox(NULL,"MemberChanged","caudnotify",MB_OK);
PUSER pUser = PUserFromINmMember(pMember);
if(NULL!=pUser) UpdateUserChannel(pUser, (INmChannel *) (CNotify::GetPunk()), uNotify);
return S_OK;
}
HRESULT STDMETHODCALLTYPE CAudNotify::PropertyChanged(DWORD dwReserved)
{
MessageBox(NULL,"call to caudnotify::propertychanged","call",MB_OK);
return S_OK;
}
HRESULT STDMETHODCALLTYPE CAudNotify::StateChanged(NM_AUDIO_STATE uState)
{
//I believe this is where we'll check whether audio is incoming or outgoing and therefore whether to turn on PTT or off
MessageBox(NULL,"call to caudnotify::statechanged","call",MB_OK);
IID iid;
HRESULT hr;
INmChannelAudio *pAudioChannel;
hr = QueryInterface(iid,(void **)&pAudioChannel);
if (SUCCEEDED(hr))
if (uState == NM_AUDIO_TRANSFERRING){
MessageBox(NULL,"Transferring","duh",MB_OK);
if (pAudioChannel->IsIncoming()==S_OK){
PTTOn('A');
}
else{
PTTOn(0);
}
}
// }
return S_OK;
}
There are other bits and pieces of code in the class, but they probably have no connection.
So the problem is I don't even get that messagebox in ::MemberChanged, ::StateChanged, or ::PropertyChanged.
Please help!!
Thanks a million,
Aniel Sud
--UPDATE--
I found that the QueryInterface method is being called with several IIDs that I had not before heard of -- namely IID_IMarshall, IID_IStdMarshall, IID_IexternalConnection, and 0000001B-0000-0000-C000-000000000046. I did a search for IID_IMarshall, and came back with one newsletter that was very vague. But it did say something about requiring marshalling. What is marshalling? do I need it in this instance?
Thanks again for all the help!!
--UPDATE--
I have found out about marshalling, and I don't think I should need it in an app such as this. Moreover, I don't see anything about marshalling in the samples. Is it ok to just let these requests slide?
Thanks again!
Aniel
|
|
|
|
|
Did I stump you all? I just need some hints here, folks... I'm running out of ideas.
Thanks!
Aniel
|
|
|
|
|
Hi, I have a custom control who have child windows (CWnd) I Know it is possible because we can insert a CButton in a control, CButton is him-self a drived-class from CWnd,
For CButton we have to override the OnDraw function, because this fucntion will be called (instead of the OnPaint commonly used) but this function does'nt exist in a CWnd and DrawItem dosn't seem to work...
ActiveX are hard to do, lot of things to thing and to know, the exception is a rules and what you used to do don't work anymore.
thanks for you'r help
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
Hi,
I want to create a setup for my DCOM-Client Application.
The setup will be created using InstallShield-6.
Now, I dont want the end user to go through DCOMCNFG after
running my SetUp program.
I want my Setup Application to do all that as part of the
SetUp process.
Is it possible using InstallShield ??
Also, My client is a VB Application (I cannot use COM library
functions from within my client)
I am sorry if this post is Off-Topic in a DCOM Forum.
But please somebody direct me to a proper solution..
Thanks
Firoz
|
|
|
|
|
All DCOMCNFG does is set registry settings.
If you just want to do the simple settings such as RunAs=InteractiveUser, then installshield should be able to do it. However, if you are talking about setting up default security options, then you might have to do them programatically in a DLL you created called by installshield.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Thanks Tim.
Firoz
|
|
|
|
|
I'm having trouble getting VB to pass in a String into a ATL Object created with VC++ 6.0 -- I dont use MFC. Please help if ya' can! all i really need to know is how to pass in/return... I found some MSDN articles, but they werent using an ATL object. Thanks in advance...
SHABBA!!
|
|
|
|
|
if the string is input only, use "BSTR". if you need to change the string (output), use "BSTR *".
there are non-MFC classes that can help with BSTR manipulation, such as "bstr_t" and "CComBSTR".
a BSTR is COM's preferred string pasing method.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Sirs,
this is my first COM adventure so I need your advise.
I have an in process server with lots of interfaces and even more methods in it.
The manufacturer of the dll provides a sample code snippet of how to get pointers to all the interfaces:
HRESULT hr = ::CoCreateInstance(...
if ( !FAILED( hr ) ) {
hr = pIUnknown->QueryInterface(...
if ( !FAILED( hr ) ) {
hr = pIUnknown->QueryInterface(...
if ( !FAILED( hr ) ) {
hr = pIUnknown->QueryInterface(...
if ( !FAILED( hr ) ) {
...
...
} else {
...
}
} else {
...
}
} else {
...
}
} else {
...
}
Why are the QI calls NESTED? I tried putting them after each other but the same code taken from the nested structure didn't work (Runtime library: abnormal program termination) although all interfaces were succesfully created.
I would like to create the appropriate interfaces in my dialogs' OnInitdialogs and release in the OnDestroyWindow. Is that possible? Any sugggestions?
Thanks for your help in advance.
Bunburry
A subject that is beautiful in itself gives no suggestion to the Artist. It lacks imperfection. (O.Wilde)
|
|
|
|
|
The nested QI() calls are probably because the ability to QI a second interface depends on the success or failure of QI() of the first interface.
As to the dialog, OnInitDialog() and OnDestroyWindow() are perfect for creating and releasing COM objects in dialogbased applications.
I'm an alien, I'm an alien
it's a beautiful life....
Bush
|
|
|
|
|
I can't tell from your code snippet, but the "Here comes the code that uses the interfaces" part probably uses all three interfaces. Thus all three QIs have to succeed before that code can work.
And BTW it'll be easier to understand if you replace "!FAILED" with "SUCCEEDED"
--Mike--
http://home.inreach.com/mdunn/
"The Earth is doomed." -- Rupert Giles
your with and
|
|
|
|
|
I couldn't call CoUnInitialize function in ExitInstance or in class destructor(there will be crash), since I have COM interfaces (member variables)in application main class,(They are smart pointers),so a calling to COM interfaces release function will make the problem.
|
|
|
|
|
Hi,
If you are using Document/View Architecture, you can put your smart pointers as member variavles in the Document class. At that time you can call CoUnitialize() either in the Main App Destructor or in App ExitInsnance .
ShadiK
Shadi Al-Kahwaji
|
|
|
|
|
You don't have to. You call AfxOleInit() in your app's InitInstance() and that's it. MFC handles uninitializing COM when you app closes.
--Mike--
http://home.inreach.com/mdunn/
"The Earth is doomed." -- Rupert Giles
your with and
|
|
|
|
|
It doesn't solve my problem. The same crash will happen when the application releases smart pointers members.
|
|
|
|
|
Then call their Release() methods in your ExitInstance().
--Mike--
http://home.inreach.com/mdunn/
"The Earth is doomed." -- Rupert Giles
your with and
|
|
|
|
|
Please help! I am getting desperate.
Hello, here is my situation:
I have a normal C++ program that has an instance of a COM object (my own), IMyObject
I have another out-of-process COM server, which exposes a COM object IMyOtherObject. IMyOtherObject is held by my C++ program.
So, I end up with this in my C++ program:
void main()
{
IMyObject
IMyOtherObject
}
Now, IMyOtherObject needs to use IMyObject.
How do I pass IMyObject to IMyOtherObject?
Is this possible?
where should I look?
HELP
Jeremy.
"Hey man, Taliban, Tali me Banana."
|
|
|
|
|