Restored from previous forum. Originally posted by Arbitrage.
I bought purebasic a few months ago and haven't had time to play with it yet.
What I'm wondering is how to initialize COM. Here's some simple code from the help file the name of the dll is sapi.dll. If someone could help get started on this. There's also VB source and DHML source using activex. I haven't seen much on how to access .DLL's.
#include
#include
int main(int argc, char* argv[])
{
ISpVoice * pVoice = NULL;
if (FAILED(::CoInitialize(NULL)))
return FALSE;
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
if( SUCCEEDED( hr ) )
{
hr = pVoice->Speak(L"Hello world", 0, NULL);
pVoice->Release();
pVoice = NULL;
}
::CoUninitialize();
return TRUE;
}
S
Microsoft SAPI
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
Hello Arbitrage, and welcome to the Forum,
> I haven't seen much on how to access .DLL's.
If you take a look at the PB-Help under the Topic Library, you'll find all the Functions needed to access DLLs.
Here's a short listing:
OpenLibrary - Opens a DLL
CloseLibrary - closes it.
IsFunction - checks, wether a DLL-Function exists
CallFunction - calls a Function from a dll
CallFunctionFast - calls a Function faster (for expirienced users)
There's also an example in your PB-Dir under 'Examples\Sources\Library.Pb' which should be easy to understand.
> What I'm wondering is how to initialize COM.
Someone posted a small and easy to understand Example on how to create COM-Opbjects. You can find it viewtopic.php?t=1211
Sorry, but I don't know VB and DHML, maybe someone else can help you out there
That's it...
Timo
--
A debugged program is one for which you have not yet found the conditions that make it fail.
Edited by - freak on 10 May 2002 10:25:42
Hello Arbitrage, and welcome to the Forum,
> I haven't seen much on how to access .DLL's.
If you take a look at the PB-Help under the Topic Library, you'll find all the Functions needed to access DLLs.
Here's a short listing:
OpenLibrary - Opens a DLL
CloseLibrary - closes it.
IsFunction - checks, wether a DLL-Function exists
CallFunction - calls a Function from a dll
CallFunctionFast - calls a Function faster (for expirienced users)
There's also an example in your PB-Dir under 'Examples\Sources\Library.Pb' which should be easy to understand.
> What I'm wondering is how to initialize COM.
Someone posted a small and easy to understand Example on how to create COM-Opbjects. You can find it viewtopic.php?t=1211
Sorry, but I don't know VB and DHML, maybe someone else can help you out there
That's it...
Timo
--
A debugged program is one for which you have not yet found the conditions that make it fail.
Edited by - freak on 10 May 2002 10:25:42
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm