Re: using the CWegPage.dll

From: Frank Hickman (fhickman_nosp_at_m_noblesoft.com)
Date: 04/06/04

  • Next message: Bill Musgrave: "Re: API Gurus"
    Date: Mon, 5 Apr 2004 21:13:36 -0400
    
    

    I looked at the project. It is using the WINAPI (_stdcall) calling
    convention so that isn't your problem. It appears after looking at the code
    that perhaps it is because the DLL is expecting some COM interface items
    that are not present in a regular VB project. I may still be wrong here,
    perhaps someone more in tune with COM could take a look see?

    --
    Frank
    "pat" <anonymous@anon.com> wrote in message
    news:u2Zejw2GEHA.740@tk2msftngp13.phx.gbl...
    > The source code for the DLL is on that page and is in this link to the zip
    > file.
    >
    > http://www.codeguru.com/code/legacy/ieprogram/cwebpage.zip
    >
    > I don't know C but tried installing it from my visual studio 6 CD and
    > unfortunately it doesn't run.  I think I'm having dll conflict issues of
    > some sort as my VB6 also doesn't run on this computer either when I
    > installed it.  In any case, I opened up all the .C files and don't see
    them
    > referencing either _cdecl or _stdcall.  Anybody feel like looking at this
    > once to see if it's a 5 minute change and recompile the dll so I can use
    it
    > in VB?  If not, I'll see if I can dig up a C person around here but I
    think
    > they are few and far between these days where I work.
    >
    > "Frank Hickman" <fhickman_nosp@m_noblesoft.com> wrote in message
    > news:UbGdnQuLmIYeBu3dRVn-hw@comcast.com...
    > > The DLL was probably written using _cdecl (a C calling convention) where
    > as
    > > VB needs _stdcall.  The only way you can fix it is to get the source and
    > > change the calling convention to that which VB can handle.
    > >
    > > --
    > > Frank
    > >
    > >
    > > "pat" <anonymous@anon.com> wrote in message
    > > news:OAxRnmpGEHA.3880@TK2MSFTNGP09.phx.gbl...
    > > > This isn't exactly a Windows API question but I though someone might
    > have
    > > a
    > > > good reason on why this doesn't work for me.  And then hopefully to
    tell
    > > me
    > > > how to fix it.
    > > >
    > > > The goal is to put an internet explorer web browswer on my form.
    > > > I would just take the Internet Explorer control and put it right on
    the
    > > > window however the language I'm using is Dexterity by Microsoft
    Business
    > > > Solutions (which I am an expert in but doesn't help me a whole lot
    > here).
    > > > Unfortunately Dexterity cannot use OCX's to put on their windows such
    as
    > > VB
    > > > can.  I can, however, call Win32 Dll's (with some limits due to the
    > > > datatypes that Dexterity uses) and I can use any COM dll that I can
    use
    > > > CreateObject on.
    > > >
    > > > Now, I'm sure that you out there haven't used or heard of this
    language
    > > but
    > > > what I've found is that for the most part what I can get VB6 working
    > with
    > > I
    > > > can then make work in Dexterity so my attempt right now I am using
    > Visual
    > > > Basic 6 to work with this dll and see if I can get it working.
    > > >
    > > > Anyway, I found an interesting DLL that Jeff Glatt wrote here:
    > > > http://www.codeguru.com/ieprogram/cwebpage.html
    > > >
    > > > Basically it encapsulates the Internet Explorer interface and the only
    > > thing
    > > > that I need is the handle of my window and puts it into a container of
    > > some
    > > > sort on that form.  So now by just calling one function and passing it
    > the
    > > > handle, it'll put the IE browser on my chosen form and then by calling
    > the
    > > > navigation method it'll go to my chosen url.
    > > >
    > > > But to just get that far...
    > > >
    > > > So I'm just trying touse the dll and I get "runtime error 48, file not
    > > > found" calling the EmbedBrowserObject function in this dll.
    > > >
    > > > I took the cwebpage.dll and copied to my c:\windows\system (I'm using
    > > win98
    > > > here at home) so it should be able to find it fine.  At least I'd
    think
    > > so.
    > > >
    > > > From the header file, the function is defined as:
    > > >
    > > > long WINAPI EmbedBrowserObject(HWND);
    > > >
    > > > which I've translated to in VB6
    > > >
    > > > Private Declare Function EmbedBrowserObject Lib "cwebpage.dll" (ByVal
    > hwnd
    > > > As Long) As Long
    > > >
    > > > Thinking that it's just something dumb I'm doing I then figured I'd
    just
    > > try
    > > > to load it using LoadLibrary
    > > >
    > > > This fails as well with no error when GetLastError is invoked.
    > > >
    > > > Private Declare Function LoadLibrary Lib "kernel32.dll" Alias
    > > "LoadLibraryA"
    > > > (ByVal lpLibFileName As String) As Long
    > > > Private Declare Function FreeLibrary Lib "kernel32.dll" (ByVal
    > hLibModule
    > > As
    > > > Long) As Long
    > > > Private Declare Function GetLastError Lib "kernel32.dll" () As Long
    > > >
    > > >     Dim i As Long
    > > >     Dim j As Long
    > > >
    > > >     i = LoadLibrary("cwebpage.dll")
    > > >     If i <> 0 Then
    > > >         MsgBox "handle found: " + Str(i)
    > > >         j = FreeLibrary(i)
    > > >         If j = 0 Then
    > > >           MsgBox "not freed"
    > > >         End If
    > > >     Else
    > > >         i = GetLastError()
    > > >         MsgBox "no handle to dll retrieved. " + Str(i)
    > > >     End If
    > > >
    > > > Thinking that _somehow_ it must just not be able to find the DLL I
    then
    > > > replace "cwebpage.dll" with "user32.dll" and that loads just fine with
    > > > LoadLibrary.  Actually, I can put anything else there and it
    > loads/unloads
    > > > just fine.  But not this one.  So it makes sense then that it doesn't
    > run.
    > > >
    > > > The link provided gives the dll and then a "C" example that calls it
    > > > (including a compiled version so you can see that it works).
    > Interesting,
    > > > though, that the C program does use the same LoadLibrary call here and
    > > then
    > > > calls the functions by address (by using GetProcAddress).  So
    obviously
    > > the
    > > > C code must be loading it correctly.
    > > >
    > > > Here is some of the sample C code:
    > > > // Load our DLL containing the OLE/COM code. We do this once-only.
    It's
    > > > named "cwebpage.dll"
    > > >  if ((cwebdll = LoadLibrary("cwebpage.dll")))
    > > >  {
    > > >   // Get pointers to the EmbedBrowserObject, DisplayHTMLPage,
    > > > DisplayHTMLStr, and UnEmbedBrowserObject
    > > >   // functions, and store them in some globals.
    > > >
    > > >   // Get the address of the EmbedBrowserObject() function. NOTE: Only
    > > > Reginald has this one
    > > >   lpEmbedBrowserObject = (EmbedBrowserObjectPtr
    > > > *)GetProcAddress((HINSTANCE)cwebdll, "EmbedBrowserObject");
    > > >
    > > > {....more code not shown......}
    > > >
    > > > So the questions come down to:
    > > >
    > > > 1. Why do you think that it won't load under VB6 (or does it for you?)
    > > > 2. For the C newsgroup people, is it possible that the DLL was
    > constructed
    > > > in such a way that Yes it would work OK from another C program but not
    > > from
    > > > say VB6?
    > > > 3. Anyone have a good idea how to make this work in VB6 (assuming I'm
    > not
    > > > doing something obviously dumb?)
    > > > 4. Assuming this just totally won't work for some reason in VB6, any
    > other
    > > > good ideas on how to show Internet Explorer on a form w/o using the
    > > Internet
    > > > Explorer control?  Just using WinAPI call to something or
    CreateObject?
    > > >
    > > > thanks for you time and ideas.
    > > >
    > > >
    > > >
    > >
    > >
    >
    >
    

  • Next message: Bill Musgrave: "Re: API Gurus"

    Relevant Pages

    • Re: using the CWegPage.dll
      ... It is using the WINAPI (_stdcall) calling ... > The source code for the DLL is on that page and is in this link to the zip ... >> change the calling convention to that which VB can handle. ... >>> The goal is to put an internet explorer web browswer on my form. ...
      (microsoft.public.vc.language)
    • Re: How to export afunction in class?
      ... but I rarely find that I need stdcall when calling the exported functions of a DLL. ... I'll trade off performance vs. convenience at this level any time, ...
      (microsoft.public.vc.mfc)
    • Re: Possible causes of Err 483 "Cant find DLL entry point"?
      ... >Because of the underscore you will have to use the Declare Function ... It also appears the author is using _stdcall. ... confirms that the DLL was compiled as _stdcall (which is unsual, ... __stdcall calling convention." ...
      (microsoft.public.vb.general.discussion)
    • Re: Calling procedure in a DLL
      ... but I get errors when calling the ... library TestLib; ... And where is that told to use StdCall? ... If you want to know why, then it is because it stops your DLL being ...
      (alt.comp.lang.borland-delphi)
    • Re: The Lib debate
      ... >>Calling Functions in a DLL is a comletely different thing. ... For shared object libraries you have to call ... I have been told that zip comes with a Lib only. ...
      (alt.lang.asm)