| View previous topic :: View next topic |
| Author |
Message |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Jul 10, 2003 3:32 pm Post subject: Smart Autocomplete - SHLWAPI.DLL |
|
|
This is otherwise a nice autocomplete box to put for browser element file browser etc etc.
Can be made further selective by changing constants.
Works in IDE but seemed to crash in compiled exe.
Any ideas ?
| Code: |
DIALOG CREATE,Auto-Complete,-1,0,386,85
DIALOG ADD,EDIT,EDIT1,34,54,296,18,,,EXIT
DIALOG SHOW
LOADLIB SHLWAPI
%H = @strdel(@WINEXISTS(~EDIT1),1,1)
if %H
%I = @lib(SHLWAPI,SHAutoComplete,STR:,%H,$0)
else
ERROR -1
end
END
FREELIB SHLWAPI
:EVLOOP
Wait event
goto @event()
:Close
Exit
|
_________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 10, 2003 3:49 pm Post subject: |
|
|
I'm not sure if this is your problem or not, but SHAutoComplete returns an INT.
| Code: |
%I = @lib(SHLWAPI,SHAutoComplete,INT,%H,$0)
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Jul 10, 2003 4:28 pm Post subject: |
|
|
I have tried all types of variables:
STR: NIL: VOID INT:
Actually this dll is not seroius about the the type used. It works well in IDE. I think the drawing of the autocomplete entries over the dialog causes it to crash(not inside IDE) - but why ?
I dont understand. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 10, 2003 4:35 pm Post subject: |
|
|
I can't compile so I'm just guessing..
Does the following work? If not, does it crash when typing something in the editbox or loading?
| Code: |
DIALOG CREATE,Auto-Complete,-1,0,386,85
DIALOG ADD,EDIT,EDIT1,34,54,296,18,,,EXIT
DIALOG SHOW
LOADLIB SHLWAPI
%H = @strdel(@WINEXISTS(~EDIT1),1,1)
if %H
%I = @lib(SHLWAPI,SHAutoComplete,INT,%H,$0)
else
ERROR -1
end
:EVLOOP
Wait event
goto @event()
:Close
FREELIB SHLWAPI
Exit |
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Jul 10, 2003 4:48 pm Post subject: |
|
|
| CodeScript wrote: | I have tried all types of variables:
STR: NIL: VOID INT:
Actually this dll is not seroius about the the type used. It works well in IDE. I think the drawing of the autocomplete entries over the dialog causes it to crash - but why ?
I dont understand. |
SnarlingSheep is correct well sort of. MSDN defines the return of the ShAutoComplete as being a HRESULT which is Type defined as a Long variable type. A Long variable type takes the same amount of memory as a Int variable type. So you should be able to use a Int variable type as the return.
C definition code below
| Code: | | HRESULT SHAutoComplete(HWND hwndEdit, DWORD dwFlags); |
VDS code below
| Code: | | %A = @lib(SHLWAPI,SHAutoComplete,INT:,%H,0) |
Just make sure that the Window handle in %H does not have the '%' symbol as the first character. Also if the VDS code above does not work try using
| Code: | %H = @binary(DWORD,@strdel(%H,1))
%A = @lib(SHLWAPI,SHAutoComplete,INT:,DWORD:%H,DWORD:0) |
You may not need the parameters to have their types defined? I am not sure about that. I have used @lib both ways and it does not seem to make alot of difference. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Jul 10, 2003 6:02 pm Post subject: |
|
|
I understand the diffrent varable types there. I only said that with this particular dll INT/STR works in IDE. Infact the first thing I tried was with INT: Then I htought i give others a try.
BTW i checked the window handle returned (for the edit) it's oK i have used
%H = @strdel(@WINEXISTS(~EDIT1),1,1) to remove the % at begining and above all it works perfectly inside IDE. The moment htis function is called from the exe it crashes I had similar problems when a dll gdi32 i think tried to directly draw over the dialog on exe. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Jul 10, 2003 6:20 pm Post subject: |
|
|
I think I have the answer to your problem here. Are you calling CoInitialize before calling this function and CoUninitialize when you close the program. Since the script works in the IDE I figured the IDE is already Initializing the COM libraries but when you compile it to a EXE the EXE is running independently and is not initializing the COM libraries.
You can use this to initialize COM
| Code: | DIALOG CREATE,Auto-Complete,-1,0,386,85
DIALOG ADD,EDIT,EDIT1,34,54,296,18,,,EXIT
DIALOG SHOW
LOADLIB SHLWAPI
LoadLib ole32.dll
%A = @lib(ole32,CoInitialize,INT:,NIL:)
%H = @strdel(@WINEXISTS(~EDIT1),1,1)
if %H
%I = @lib(SHLWAPI,SHAutoComplete,INT,%H,$0)
else
ERROR -1
end
:EVLOOP
Wait event
goto @event()
:Close
FREELIB SHLWAPI
%A = @lib(ole32,CoUninitialize,NIL:)
FREELIB ole32
Exit |
_________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Fri Jul 11, 2003 3:31 am Post subject: |
|
|
| mindpower wrote: | | I figured the IDE is already Initializing the COM libraries but when you compile it to a EXE the EXE is running independently and is not initializing the COM libraries. |
Yes mindpower you are perfectly right. Exe doesnot initialize the COM libraries. Doing that makes it work perfect in the exe.
Thanx _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Fri Jul 11, 2003 2:21 pm Post subject: |
|
|
Addtional Info :
The default constant $0 can be changed to :
1. $1 -- SHACF_FILESYSTEM (file system only)
2. $2 -- Const SHACF_URLHISTORY (only URL history) _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|