Win32 |
Author |
Message |
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
Posted: Sat Sep 16, 2006 10:48 am Post subject: COM |
|
|
Raymond Chen:
1. The layout of a COM object
"A COM interface pointer is a pointer to a structure that consists of just
a vtable. The vtable is a structure that contains a bunch of function
pointers. Each function in the list takes that interface pointer (p) as its
first parameter ("this")."
2. The vtable does not always go at the start of the object
"It is perfectly legal for the vtable to be in the middle or even at the
end of the object, as long as the functions in the vtable know how to
convert the address of the vtable pointer to the address of the underlying
object."
3. The macros for declaring and implementing COM interfaces
"...let the MIDL compiler generate your COM interface for you. If you
let MIDL do the work, then you also get __uuidof support at no extra
charge, which is a very nice bonus." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
Posted: Sat Sep 16, 2006 10:49 am Post subject: |
|
|
The Mother of all COM Tutorials: The COM Programmer's Cookbook,
by Crispin Goswell, Microsoft Office Product Unit
"This cookbook shows you how to create Microsoft® OLE Component
Object Model (COM) objects and use them effectively. The examples are
mostly in C, as this shows most clearly what is actually being done."
Mike Panitz's Introduction to COM & Creating the COM Server in C,
by Michael William Panitz
"Creating an in-proc (in-process, meaning that the server will be
located in a DLL, and loaded into the same process /address space as the
client) server is a bit involved, though the basic outline of what we'll be
doing isn't complex" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
Posted: Fri Sep 22, 2006 7:40 pm Post subject: |
|
|
CodeGuru: Discover COM: Connection Points Versus Mailslots in Replication Directory
"This module is designed to solve the old problem of directory replication.
In fact, we want to put a resource (file or directory) on a server machine
and obtain the same structure of directory on the client machine that was
advising to the server." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
Posted: Fri Sep 22, 2006 8:26 pm Post subject: |
|
|
What OLE Is Really About,
Kraig Brockschmidt, OLE Team, Microsoft Corporation, July 1996
"Kraig Brockschmidt is a member of the OLE design team at Microsoft,
involved in many aspects of the continuing development and usage of
this technology. Prior to holding this position, he was a software engineer
in Microsoft's Developer Relations Group for three years, during which
time he focused his efforts on OLE, versions 1 and 2, and produced the
books Inside OLE 2 and Inside OLE, 2nd Edition for Microsoft Press®. He
has worked at Microsoft since 1988." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
Posted: Fri Dec 08, 2006 4:52 pm Post subject: |
|
|
Raymond Chen: Do not overload the E_NOINTERFACE error
"One of the more subtle ways people mess up IUnknown::QueryInterface is
returning E_NOINTERFACE when the problem wasn't actually an unsupported
interface. The E_NOINTERFACE return value has very specific meaning. Do
not use it as your generic "gosh, something went wrong" error. (Use an
appropriate error such as E_OUTOFMEMORY or E_ACCESSDENIED.)" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
Posted: Sun Sep 06, 2009 1:43 pm Post subject: |
|
|
RC - Why do new controls tend to use COM instead of window messages?
"It's just less of a hassle using separate member functions, where you don't
have to try to pack all your parameters into two parameters (cryptically na-
med WPARAM and LPARAM) on the sending side, and then unpack the para-
meters on the window procedure side." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
Posted: Wed Jan 25, 2012 2:08 am Post subject: |
|
|
msdn - CoCreateGuid function
"Creates a GUID, a unique 128-bit integer used for CLSIDs and interface
identifiers."
Code: | #define _OLEAUT32_
#include <stdio.h>
#include <unknwn.h>
GUID guid;
WORD* wstrGUID[100];
char strGUID[100];
int count, i;
int main (int argc, char* argv[])
{
if (argc != 2) {
fprintf (stderr, "SYNTAX: UUIDGEN <number-of-GUIDs-to-generate>\n");
return (1);
}
count = atoi (argv[1]);
for (i = 0; i < count; i++) {
CoCreateGuid (&guid);
StringFromCLSID (&guid, wstrGUID);
WideCharToMultiByte (CP_ACP, 0, *wstrGUID, -1, strGUID, MAX_PATH, NULL, NULL);
strGUID[strlen(strGUID)-1] = '\0';
printf ("%s\n", strGUID+1);
}
return (0);
} |
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
Posted: Wed Jan 25, 2012 2:17 am Post subject: |
|
|
Code: | static int (__stdcall *CoCreateGuid)(char*) = NULL;
if (CoCreateGuid == NULL) {
HMODULE hOleDll = LoadLibrary("OLE32.DLL");
*((void**)&CoCreateGuid) = GetProcAddress(hOleDll, "CoCreateGuid");
}
CoCreateGuid((char*)uuid); |
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3523 Location: Zagreb
|
Posted: Mon Sep 28, 2020 9:32 am Post subject: |
|
|
RC - The macros for declaring COM interfaces, revisited: C version
"Quite some time ago, I covered The macros for declaring and implementing
COM interfaces. I spelled out the rules, but I didn't go into much detail as to
how the rules lead to the desired results." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3036 Location: Europe
|
Posted: Thu Dec 01, 2022 9:45 pm Post subject: |
|
|
codeguru.com - Display a Web Page in a Plain C Win32 Application
"Here is an article and working example in C to specifically show you what
you need to do in order to embed IE in your own window, and more generally,
show you how to interact with OLE/COM objects and create your own objects
in plain C." |
|
Back to top |
|
|
|