Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COM

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Win32
Win32  
Author Message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sat Sep 16, 2006 10:48 am    Post subject: COM Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sat Sep 16, 2006 10:49 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Fri Sep 22, 2006 7:40 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Fri Sep 22, 2006 8:26 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Tue Nov 07, 2006 11:58 pm    Post subject: Reply with quote

HM!? need to use C to create/edit excel spreadsheet

"very simple, very basic example?"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Tue Nov 28, 2006 5:40 pm    Post subject: Reply with quote

CodeGuru: Open Excel in VC++ and write data

"I want to write this data to an excel sheet and draw graphs using this data.
As of now I wrote the output of my program in csv format, so after I run the
program it creates an excel file."

"The place to start is
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoffdev/html/vsofficedev.asp "

"To find the methods and the arguments specifically for C, I look in the
excel9.olb type library using OLEView."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Fri Dec 08, 2006 4:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sat Oct 20, 2007 3:28 am    Post subject: Reply with quote

RC: Other problems traced to violating COM single-threaded apartment
rules in the shell


"Probably the biggest category of problems that can be traced to violating COM
single-threaded apartment rules in the shell is using an object from the wrong
thread."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun Sep 06, 2009 1:43 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Jan 25, 2012 2:08 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Jan 25, 2012 2:17 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Sep 28, 2020 9:32 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Thu Dec 01, 2022 9:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Win32 All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group