By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,321 Members | 1,909 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,321 IT Pros & Developers. It's quick & easy.

How to handle custom-messages in VBA from a custom DLL

P: n/a
Hi,
I'm active in VC++ for several years now, so I know some things (I think).
Using MS-Access I store a db with lots of entries and uses the VBA
techniques to export those data to e.g. HTML, XML and other kind of data.
I'm using MS-VC++6.0-Enterprise (with sp6) at NT4-Workstation (sp6a) and
MS-Access97 (from MS-Office97). Reason that I won't upgrade to latest
Office/VisualStudio is that I must ensure that any application I develop
still works at Windows9x (and so on) - so for full compatibility with any
configuration.

Lately I ran into a problem, while I use an external function from a VC++
DLL (DLL build as a 'MFC Regular DLL' using dynamic linkage over MFC) to
export all my data in a fixed file (must use the DLL for performance, while I
first create a directory with files in VBA then use the functions inside the
DLL to grab the contents of the exported directory and put it all into a
bynarie file - it's intended to be used by an installation procedure for
customers).

The DLL creates a worker-thread in which it creates a modal-dialog box using
'DialogBoxIndirectParam'. This Dialog stays on top of the calling HWND until
it receives a message from the calling thread that it may close (using
'EndDialog').
From start-up until end of the dialog it receives custom message
(combinations of WM_USER) to display a progress-bar of the running thread.
This works fine when calling from a MFC-module (.exe) but appearently it
doesn't when called from MS-Access: the dialog popups, but halfway it stops
receiving messages and in rare cases it does handle all send messages, but
then it won't disapear from the desktop when the dll has finished.

I gues the problem is MS-Access, maybe it's STA (single threaded) while my
DLL is multi-threaded, so I would try another solution : sending the progress
messages directly to the calling Access module. But then I come into my
problem.
How can I let MS-Access react at my own 'custom' messages, while the VBA
module is still 'waiting' for my DLL to finish.
I already tried to develop a COM object, but while this asks a lot of
development it didn't resolve my problem!

If anyone would know a good suggestion/answer for me, I would appreciate it
very much. Currently I run the exported DLL-function in VBA without popping
up the progress dialog (Access is blocking anyway while my DLL is in
progress, and that can take up a very long time, while I've got a lot of data
in the DB), so Access won't react strange anymore.
I also tried to 'talk' directly to MS-Access by linking to the Access-COM
module in VC++ so I could try to get an interface to the Access.Application
object and so modify the statusbar, but as soon I do MS-Access popups with a
Kernel failure !?

So I come with my question, would it be possible to run my DLL-procedure in
a seperate thread, so Access can go into idle-status, so it could react to
custom messages I send from the DLL, so Access can write to the statusbar
itself...?
But is it possible at all, to launch a seperate thread in MS-Access? Or
should I better call a seperate thread from inside the DLL and then return
immediately so I could have MS-Access to go into a timer-loop (event
'OnTimer') - but then I still don't know how to react at custom messages from
my DLL.

Thank you very much if you can help me!
Laurens K.
--
Developer of lkVCDimager, lkCDRtools, lkMFCext, lkMpegTools, ...
Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

Can you point us on where your question is DotNet related and because I
write this from the language VBNet newsgroup especially about VBNet and
dotnet

Cor
Nov 17 '05 #2

P: n/a
Hi Cor,

"Cor Ligthert" <no************@planet.nl> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
Can you point us on where your question is DotNet related and because I
write this from the language VBNet newsgroup especially about VBNet and
dotnet


I don't know to which part my question realy belongs.
First of all, I'm not using .NET but still VistualStudio6.
Second, the messages would come from a C++ custom DLL I wrote which VBA
should call internally.

So I gues it's partially C++, C++/library's and VB(A) (maybe partially
Office Development too).
That's also why I cross-posted this question in the above mentioned
newsgroups.

I already tried to search for any usable Office-SDK, but without any luck.
The HTML-version which is available on-line (for Office97) doesn't help me
at all.

If you still could help me, I'll appreciate it much.
cu.
--
Laurens Koehoorn
\\\ | ///
( @.@ )
+-----------oOOo------(_)------oOOo---------------+
Author of VCDwizard, get your copy at
http://www.labdv.com/vcdwizard/
Author of lkVCDimager, get your copy at
http://lkvcdimager.sourceforge.net/
Nov 17 '05 #3

P: n/a
LhK,

From what you wrote I think it are all the wrong newsgroups. In your
situations I would try.

microsoft.public.vc.language

Probably then when you are in the wrong group, they will lead you furter.

Cor
Nov 17 '05 #4

P: n/a
"Cor Ligthert" wrote:
From what you wrote I think it are all the wrong newsgroups. In your
situations I would try.

microsoft.public.vc.language

Probably then when you are in the wrong group, they will lead you furter.


Thanks, I've searched for newsgroups concerning more specific about my
problem (access/vc/office.vba), hope one can help me from there.
Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.