For Programmers: Free Programming Magazines  


Home > Archive > VC Language > June 2005 > Making DLLs









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Making DLLs
victorsk

2005-05-21, 8:58 pm

Hello,

I am very new to Windows Programming. I need to make a DLL that is called
by another windows application so this DLLs functions get exported. And, my
DLL app has to work inside the parent app NOT as a (vbModal) app. So, a user
would NOT have to cloase the DLL app in order to minimize the parent app but
have control of the parent app while the DLL app is open. I guess this has
something to do with multithreading ora specific DLL type that would work
like that, but I am not sure how to use VC++ for this purpose. Could
somebody please tell me where to start? What are good books on this subject?
Thank you.

Victor.
Scott McPhillips [MVP]

2005-05-22, 4:00 am

victorsk wrote:
> Hello,
>
> I am very new to Windows Programming. I need to make a DLL that is called
> by another windows application so this DLLs functions get exported. And, my
> DLL app has to work inside the parent app NOT as a (vbModal) app. So, a user
> would NOT have to cloase the DLL app in order to minimize the parent app but
> have control of the parent app while the DLL app is open. I guess this has
> something to do with multithreading ora specific DLL type that would work
> like that, but I am not sure how to use VC++ for this purpose. Could
> somebody please tell me where to start? What are good books on this subject?
> Thank you.
>
> Victor.


In C or C++ this would be an ordinary DLL. DLLs do not open and close
and they do not affect the parent app minimizing. The DLL is merely a
collection of functions that can be called by the parent. No
multithreading is used unless you create multiple threads in your DLL.

Where to start depends on what you know and the tools you intend to use.
Have you figured that out yet? C or C++ or C++ with MFC or ????

--
Scott McPhillips [VC++ MVP]

victorsk

2005-05-22, 4:00 am

Hi,

Thanks for the reply. I am definitely going to be working with MFCs in
Visual C++ 6 because I'll be creating an FTP app. So, from what I
understand, if I create a DLL in C++ and run it in a parent app, then, for
example, in order to minimize parent app I wouldn't have to close DLL app
first?

What I need to create is a DLL app hat when a user runs it and wants to
minimize or maximize or access "file" option in parent app, the DLL app
window wouldn't "flicker" when they click outside of the window. Does VC++
make such DLL's by default? Thank you.

Victor.

"Scott McPhillips [MVP]" wrote:

> victorsk wrote:
>
> In C or C++ this would be an ordinary DLL. DLLs do not open and close
> and they do not affect the parent app minimizing. The DLL is merely a
> collection of functions that can be called by the parent. No
> multithreading is used unless you create multiple threads in your DLL.
>
> Where to start depends on what you know and the tools you intend to use.
> Have you figured that out yet? C or C++ or C++ with MFC or ????
>
> --
> Scott McPhillips [VC++ MVP]
>
>

William DePalo [MVP VC++]

2005-05-22, 4:00 am

"victorsk" <victorsk@discussions.microsoft.com> wrote in message
news:BDDEEB74-831A-4EB5-AAD5-98B19E5BC8E4@microsoft.com...
> I am definitely going to be working with MFCs in
> Visual C++ 6 because I'll be creating an FTP app.


FTP and MFC are totally unrelated. Use either or both, your option.

> So, from what I understand, if I create a DLL in C++ and run it in a
> parent app, then, for example, in order to minimize parent app I
> wouldn't have to close DLL app first?


You can look at a DLL as a set of one or more functions or subroutines which
are external to the "main body" of an executable.The relationship is not so
much parent/child as caller/callee.

(In truth some DLLs can be more than a simple set of functions - COM objects
and .Net assemblies are often implemented as DLLs but for the purpose of
this discussion I think we can safely ignore those cases)

> What I need to create is a DLL app


DLLs are not applications. See above.

Regards,
Will


victorsk

2005-05-22, 4:00 am

Hi,

Thanks for the message. Sorry, I am still a bit fuzzy on whether VC++ will
create a DLL that, when called by an external app, will not "flicker" when a
user attempts to close the parent app while the DLL (app?) is open. It's
like those "yes/no" dialogs that we get in Windows that force the user to
respond before they have access to other windows applications. Is this what
VC++ DLL will work as? Sorry if I can't be more clear in my question. Thank
you.

Victor.

"William DePalo [MVP VC++]" wrote:

> "victorsk" <victorsk@discussions.microsoft.com> wrote in message
> news:BDDEEB74-831A-4EB5-AAD5-98B19E5BC8E4@microsoft.com...
>
> FTP and MFC are totally unrelated. Use either or both, your option.
>
>
> You can look at a DLL as a set of one or more functions or subroutines which
> are external to the "main body" of an executable.The relationship is not so
> much parent/child as caller/callee.
>
> (In truth some DLLs can be more than a simple set of functions - COM objects
> and .Net assemblies are often implemented as DLLs but for the purpose of
> this discussion I think we can safely ignore those cases)
>
>
> DLLs are not applications. See above.
>
> Regards,
> Will
>
>
>

Scott McPhillips [MVP]

2005-05-22, 4:00 am

victorsk wrote:
> Hi,
>
> Thanks for the message. Sorry, I am still a bit fuzzy on whether VC++ will
> create a DLL that, when called by an external app, will not "flicker" when a
> user attempts to close the parent app while the DLL (app?) is open. It's
> like those "yes/no" dialogs that we get in Windows that force the user to
> respond before they have access to other windows applications. Is this what
> VC++ DLL will work as? Sorry if I can't be more clear in my question. Thank
> you.
>
> Victor.


A DLL is code, not a window. Since a DLL is not a window it does not
open, or close, or flicker. Your question does not make much sense
because it seems to be based on a mistaken belief that a DLL is some
kind of window.

Do you know what a "function" is? A DLL is a file containing some
functions the parent app can call.

--
Scott McPhillips [VC++ MVP]

victorsk

2005-05-22, 4:00 am

Hi,

Thanks for the message. Yes, I think I know what a function is. In my
three years of univeristy computer science I think I got the idea. What I
can't understand is why it is so hard for you to grasp what I mean in my
question about DLL.

When I created a DLL in VB, I exported a function that called a frame1.show
procedure. This frame1 consisted of an FTP application i.e. a "window" that
flickered when a user clicked outside of it. I really don't know how else to
phrase my question, but what I need to know is if a DLL created in VC++ would
call a function that *creates* a window that would "flicker" if a user would
click outside of it. Do you understand what I mean at least when it comes to
"flickering" part? Sorry, I am quite new to windows programming.


"Scott McPhillips [MVP]" wrote:

> victorsk wrote:
>
> A DLL is code, not a window. Since a DLL is not a window it does not
> open, or close, or flicker. Your question does not make much sense
> because it seems to be based on a mistaken belief that a DLL is some
> kind of window.
>
> Do you know what a "function" is? A DLL is a file containing some
> functions the parent app can call.
>
> --
> Scott McPhillips [VC++ MVP]
>
>

William DePalo [MVP VC++]

2005-05-22, 4:00 am

"victorsk" <victorsk@discussions.microsoft.com> wrote in message
news:0BE9BD83-C38C-4EC8-91C5-82D687B1C78F@microsoft.com...
> Thanks for the message. Yes, I think I know what a function is. In my
> three years of univeristy computer science I think I got the idea. What I
> can't understand is why it is so hard for you to grasp what I mean in my
> question about DLL.


You wrote:

<quote>
"Sorry, I am still a bit fuzzy on whether VC++ will create a DLL that, when
called by an external app, will not "flicker" when a user attempts to close
the parent app while the DLL (app?) is open.
<quote>

So there is no confusion - don't read in any rancor or derision or
condescension in the following which is not there.

However, your question makes no sense. DLLs are neither open nor closed.
They are loaded or not. A loaded DLL is mapped into the virtual address
space of a process. When an application exits, the operating system reclaims
all resources that have not been relinquished by the application. In the
case of DLLs, this reclamation is called "unloading".

Now if a function in your DLL does some painting, then there may be flicker
or there may not be. That has nothing to do with DLLs and everything to do
with the skill of the painting function's author.

Regards,
Will


Jim Carlock

2005-05-22, 8:57 pm

Hi Victor,

There are problems with frames in VB6 that I've run into. I've run into
that problem myself inside of VB, where flickering of "objects inside
a frame" during resizing is extremily annoying.

If anyone wants to see what's happening, create a VB standard exe
project, put a frame on a form, then put a filelist box inside of the
frame.

Then put some code inside of the Frame1_Resize Event to resize
the frame and filelist control. You'll see the filelistbox flickering during
the resize.

Victor, you might want to put a frame inside of a picturebox and then

Randy Birch indicated:
"I found that if you place the controls into a picture box, then set the
clipcontrols property of the pixbox to false, the controls in the frame
no longer flicker!"

I haven't personally checked this out as of yet and I believe Randy means
put the controls inside of a Frame1 which in turn sits inside of PictureBox1
and then set PictureBox1.ClipControls = False. This gets done within the
VB project for the control your using.

Let us know if that works for you.

--
Jim Carlock
Please post replies to newsgroup.

"victorsk" <victorsk@discussions.microsoft.com> wrote:
Hi,

Thanks for the message. Yes, I think I know what a function is. In my
three years of univeristy computer science I think I got the idea. What I
can't understand is why it is so hard for you to grasp what I mean in my
question about DLL.

When I created a DLL in VB, I exported a function that called a frame1.show
procedure. This frame1 consisted of an FTP application i.e. a "window" that
flickered when a user clicked outside of it. I really don't know how else to
phrase my question, but what I need to know is if a DLL created in VC++ would
call a function that *creates* a window that would "flicker" if a user would
click outside of it. Do you understand what I mean at least when it comes to
"flickering" part? Sorry, I am quite new to windows programming.


"Scott McPhillips [MVP]" wrote:

> victorsk wrote:
>
> A DLL is code, not a window. Since a DLL is not a window it does not
> open, or close, or flicker. Your question does not make much sense
> because it seems to be based on a mistaken belief that a DLL is some
> kind of window.
>
> Do you know what a "function" is? A DLL is a file containing some
> functions the parent app can call.
>
> --
> Scott McPhillips [VC++ MVP]



Tim Roberts

2005-05-23, 3:59 am

"victorsk" <victorsk@discussions.microsoft.com> wrote:
>
>Thanks for the message. Yes, I think I know what a function is. In my
>three years of univeristy computer science I think I got the idea. What I
>can't understand is why it is so hard for you to grasp what I mean in my
>question about DLL.


It's because your question is . You said you are new to Windows
programming, so it's not surprising that you are confusing the concepts.
There is no need to get defensive.

>When I created a DLL in VB, I exported a function that called a frame1.show
>procedure.


See, now, that's a detail that you hadn't mentioned before. Your DLL
creates a window, and you asked your question as if DLLs *always* create
windows. Most do not.

>This frame1 consisted of an FTP application i.e. a "window" that
>flickered when a user clicked outside of it.


When you say "FTP", do you really mean the "File Transfer Protocol" that is
used to transfer files between machines? It isn't relevent to the
question, but I ask just to make sure that you aren't using the term to
mean something else.

>I really don't know how else to
>phrase my question, but what I need to know is if a DLL created in VC++ would
>call a function that *creates* a window that would "flicker" if a user would
>click outside of it.


No. There is no reason why an app should care at all when it loses focus.
In fac, there's no reason why your VB app should care, either. Are you
taking some action in the Deactivate or LostFocus events that causes a
redraw??
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc
Jim Carlock

2005-05-23, 8:58 pm

Bahh. I can't seem to duplicate the problems I had last month.
I don't even know if what I said means anything right at the
moment.

Why do things like this happen. Last month I couldn't get rid of
the darn flicker of Drive1, File1 and Dir1 controls sitting inside
of a Frame1, inside of Picture1, on A Form1. Now... everything
looks swell and I can't duplicate my prior problems. Something
is (or was and thus is, because in effect it's now my mind that is)
messed up. Grrr! That is so annoying.

--
Jim Carlock
Please post replies to newsgroup.


Sam Hobbs

2005-06-06, 8:59 pm

It seems very common for VB and programmers to be about what a DLL
is, primarily because VB does not create the kind of DLL you are using VC to
create. There are many terms people use to refer to the kind of DLL that VB
does not create; usually the terms are "Regular DLL", "Windows DLL",
"Standard DLL", "Native DLL", "Ordinary DLL" and a few others probably. Some
people will insist that one term is better than other, but what is important
is the intended meaning, which is that they (among other things) can export
functions but don't implement a COM/OLE/ActiveX object.

According to your description of the DLL you need to write, you "need to
make a DLL that is called by another windows application so this DLLs
functions get exported". I assume that the other application is a VB
application. You will be calling the DLL by use of a VB Declare. Other than
the Declare, the functions in the DLL will called in a manner that is
essentially the same way that VB Subs and VB Functions are called. That is a
useful way to understand what DLLS are. A DLL is a collection of functions in
a separate file that can be found (linked to) during execution.

It helps to understand that the alternative to a DLL is functions that are
linked (statically) following compilation with the executable (exe) file. In
other words, a non-dynamic link combines functions with the calling program
into a single executable file. If a staticly linked function changes, then
every executable that uses it must be re-linked. If a dynamically linked
function (in a DLL) changes, then the DLL must be re-linked (after compiling
it) but only the DLL.

There is very little more that a DLL does or does not do that is unique to
DLLs. About the only thing that is a potential problem with putting a
function in a DLL is that there are sometime incompatibilities with memory
allocated in a DLL but freed in a EXE or memory allocated in a EXE but freed
in a DLL.

"victorsk" wrote:

> Hello,
>
> I am very new to Windows Programming. I need to make a DLL that is called
> by another windows application so this DLLs functions get exported. And, my
> DLL app has to work inside the parent app NOT as a (vbModal) app. So, a user
> would NOT have to cloase the DLL app in order to minimize the parent app but
> have control of the parent app while the DLL app is open. I guess this has
> something to do with multithreading ora specific DLL type that would work
> like that, but I am not sure how to use VC++ for this purpose. Could
> somebody please tell me where to start? What are good books on this subject?
> Thank you.
>
> Victor.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com