# ShellExecute in Multi DLL APP not Compiling

**URL:** <https://clarionhub.com/t/shellexecute-in-multi-dll-app-not-compiling/6569>\
**Category:** questions\
**Tags:** dll, winapi\
**Created:** [September 5, 2023, 9:49am UTC](https://clarionhub.com/t/shellexecute-in-multi-dll-app-not-compiling/6569 "2023-09-05T09:49:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rob\_bac](https://clarionhub.com/user_avatar/clarionhub.com/rob_bac/32/686_2.png) [@rob\_bac](https://clarionhub.com/u/rob_bac)\
**Post date:** [September 5, 2023, 9:49am UTC](https://clarionhub.com/t/shellexecute-in-multi-dll-app-not-compiling/6569/1 "2023-09-05T09:49:25Z")

</div>

Clarion 11.0.13630

I do have a multi dll app (Capesoft Multi-project).  
In several of my windows the users can click a button for direct access to web, mail or telephone.  
For this i use ShellExecute.  
In the Global Embeds, inside the Global Map (in each app) i added:

```auto
INCLUDE('CWUTIL.INC'),ONCE
Module('WINAPI')
  ShellExecute(Unsigned, *CString, *CString, *CString, *CString,Signed),Unsigned, Pascal, Raw, Proc,name('ShellExecuteA'),PROC
  GetDesktopWindow(), Unsigned, Pascal
.

```

Then the button to activate this has for instance for a telephone call:

```auto
  Shellex:AssocFile='tel:'&CLIP(AGD:TEL)
  Shellex:Param =''
  Shellex:Directory=''
  Shellex:Operation='open'
  ShellExecute(GetDesktopWindow(),Shellex:Operation,Shellex:AssocFile,Shellex:Param,Shellex:Directory,3)

```

This works fine, but in one dll i get 5 errors;

```
Unknown identiefier: Shellex:AssocFile
Unknown identiefier: Shellex:Param    
Unknown identiefier: Shellex:Directory
Unknown identiefier: Shellex:Operation
No matching prototype available. (pointing at ShellExecute)
```

I don't see any difference between the working dll and the one that fails.  
Any ideas or suggestions would be very nice, thanks!

Rob

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [September 5, 2023, 12:35pm UTC](https://clarionhub.com/t/shellexecute-in-multi-dll-app-not-compiling/6569/2 "2023-09-05T12:35:00Z")

</div>

Hi Rob,

so you’ve skipped one part in the explanation, which I guess would explain everything;

This line;  
Shellex:AssocFile=‘tel:’&CLIP(AGD:TEL)

Implies that Shellex:AssocFile is a variable, defined in the app, even possibly in the procedure.  
Go to one of the apps where it works, and see where that is defined. then either define it (and friends) in the problem app or…

It’s possible those variables are being exported by one of your DLL’s. Multi-Proj includes the ability to generate a template for you to “include” that DLL. So, for example, if you are exporting it from the A.DLL then you’d have an Activate\_A extension template, which might be missing from the problem DLL? You’ll know for sure by looking at a working DLL to see how the variables are declared there.

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [September 5, 2023, 4:33pm UTC](https://clarionhub.com/t/shellexecute-in-multi-dll-app-not-compiling/6569/3 "2023-09-05T16:33:32Z")

</div>

> [@rob\_bac](#):
>
> ```auto
> Shellex:AssocFile='tel:'&CLIP(AGD:TEL)
> Shellex:Param =''
> Shellex:Directory=''
> Shellex:Operation='open'
> ShellExecute(GetDesktopWindow(),Shellex:Operation,Shellex:AssocFile,Shellex:Param,Shellex:Directory,3)
> 
> ```

As Bruce said the `Shellex:Xxxx CSTRING()` variables need to be defined some place in scope in the APP. Likely you made them Global. Find them where they work in the other APPs.

IMO there is no need to pass`GetDesktopWindow()` for Window Handle, you can pass a Zero. Another improvement would be to place the 4+ ShellEx: variables inside a GROUP so you can CLEAR(Shellex:Group) to clear them All and not miss one.

* * *

Since you are including CWUtil you can call it’s Shell Execute wrapper function OpenUrlLink() which I pasted below so you can see how it works and the parameters. I think you could call as `OpenUrlLink('tel:'&CLIP(AGD:TEL), False)`. This will not pass Show as 3 to Maximize so a bit different but fine IMO.

Rather than define your ShellEx CSTRING variables and call the API Shell Execute what I usually do is create a wrapper function of my own, like below, so I can pass STRINGs and deal with the CSTRINGs in that one procedure.

```auto
OpenUrlLink PROCEDURE(STRING urlLink,BYTE forceHttp=1,<STRING path>, <STRING params>)
lWHandle LONG
lOperation CSTRING(255)
lFileUrl CSTRING(255)
lPath CSTRING(255)
lParam CSTRING(255)
lShowCmd LONG(1)
lRetVal ULONG
 CODE
    IF LEFT(UPPER(urlLink),4)<>'HTTP' AND forceHttp
       lFileUrl = 'http://'&clip(urlLink)
    ELSE
       lFileUrl = clip(urlLink)
    END
    lWHandle = 0{PROP:Handle}!Get the handle of the current window
    lOperation = 'Open'    
    lPath = path
    lParam = params
    lShowCmd = 1
    lRetVal = SV_ShellExecuteURL(lWHandle,lOperation,lFileUrl,lParam,lPath,lShowCmd)
    
    RETURN lRetVal

```

---

<div class="post-metadata">

**Author:** ![rob\_bac](https://clarionhub.com/user_avatar/clarionhub.com/rob_bac/32/686_2.png) [@rob\_bac](https://clarionhub.com/u/rob_bac)\
**Post date:** [September 6, 2023, 7:43am UTC](https://clarionhub.com/t/shellexecute-in-multi-dll-app-not-compiling/6569/4 "2023-09-06T07:43:50Z")

</div>

> [@Bruce](#):
>
> Shellex:AssocFile

Thanks Bruce and Carl.  
Strange thing i couldn’t find where the Shellex:AssocFile variable was defined, neither Global or in the procedure where it did work.  
Looking for the truth takes too much time for me now, so i skipped to Carl’s suggestion using the OpenUrlLink.  
This works fine:  
OpenUrlLink(‘tel:’&CLIP(AGD:TEL), False)

Still confused but i can go on.  
Thanks.

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [September 6, 2023, 2:18pm UTC](https://clarionhub.com/t/shellexecute-in-multi-dll-app-not-compiling/6569/5 "2023-09-06T14:18:44Z")

</div>

Another thing about GetDesktopWindow(), is that you shouldn’t accept its value verbatim.  
Many years back, had at least one user where it returned a “bogus” value (a very low non-zero number, but I don’t remember what the value was). It only happened to one or two users out of many, but it did happen.

> [@CarlBarnes](#):
>
> `GetDesktopWindow()`

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [September 6, 2023, 4:22pm UTC](https://clarionhub.com/t/shellexecute-in-multi-dll-app-not-compiling/6569/6 "2023-09-06T16:22:27Z")

</div>

> [@rob\_bac](#):
>
> Strange thing i couldn’t find where the Shellex:AssocFile variable was defined, neither Global or in the procedure where it did work.

Maybe its from an Include(file) try searching the files in your  
Clarion##\Accessory\LibSrc\Win  
or  
Clarion##\LibSrc\Win
