473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

More Thread CoInitialiseEx woes.........

I'm going to kindof restart this thread, because its going up in the list
(on my browser anyway). I'm still not able to call OleSetClipboard from
within my thread in my VB application. As a refresher, the reason I want to
do this is so I can paste links into a Word document from some Ole object I
have lying around. The problem I'm having is that OleSetClipboard returns
HRESULT -2147221008 ("CoInitialize has not been called.").

Anyway, I set my thread up like this:

' Create the worker thread

m_Thread = New Thread(New ThreadStart(AddressOf _Start))
m_Thread.ApartmentState = ApartmentState.STA
m_Thread.Start()

At the start of my thread main() I write this to initialise COM:

m_ComInitialized = DLLImports.CoInitializeEx(0,
DLLImports.COINIT.COINIT_APARTMENTTHREADED)

(
Note that CoInitialiseEx is defined as:

Public Declare Function CoInitializeEx Lib "OLE32.DLL" ( ByVal
pvReserved As Int32, ByVal dwCoInit As Long) As Int32
)

When I want to set OLE to clipboard I write this:

m_Result = DLLImports.OleSetClipboard ( theObject )

(
Note that OleSetClipboard is defined as:

Public Declare Auto Function OleSetClipboard Lib "OLE32.DLL" _

(<MarshalAs(UnmanagedType.Interface)> ByVal theDataObject As
COM.IDataObject) As Integer
}
m_ComInitialized returns a value of 1. And m_Result after OleSetClipboard
returns "CoInitialize has not been called".
Any further ideas?
Thanks

Robin
Nov 20 '05 #1
0 1121

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Cedric | last post by:
This is a 3 weeks old problem, but having found a solution (and having looked for one here, finding only this message), I'm replying now. From: Jive (someone@microsoft.com) Subject: Upgrade...
3
by: Angel Cat | last post by:
Trying to get my jobs to send mail when job fails. Should be easy but it's giving me headache Had a whole slew of issues. Outlook is installed with a n outlook mail profile set up that can...
2
by: Andrew Thompson | last post by:
- NN 4.78 rendering woes, links at far left - I am trying to rework an old site, make it valid html and css, improving the x-browser and 'older browser' compatibility. My efforts so far, have...
7
by: Johnathan Doe | last post by:
I am trying to do some bit fiddling with unsigned chars. Don't ask me why I am doing this, I don't know. It's just an exercise. :) Here's what I am trying to do: I have one unsigned char of a...
8
by: John Nagle | last post by:
I've been running M2Crypto successfully using Python 2.4 on Windows 2000, and now I'm trying to get it to work on Python 2.3.4 on Linux. Attempting to initialize a context results in Traceback...
9
by: Mark Rae | last post by:
Hi, This time, I'm looking for a regular expression which says "the string must contain exactly seven or exactly eight digits" e.g. 123456 fails 1234567 passes 12345678 passes 123456789...
1
by: hdogg | last post by:
Scope Woes - IF statement nested in WHILE statement -PHP I have an array $actuals_sum. <?php while(conditions) { if($i == '24) {
4
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
I am at my witless end here, please help! I have an ASP.Net aspx web page, hosted on Windows Server 2003, that receives a query string with the path to an autocad drawing file selected from a...
1
by: Mike Howarth | last post by:
I've been having a few problems with connecting to SQL Server, initially I was using dblib however found some problems with returning text fields whereby all text fields were ignored and it bawked...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.