| View previous topic :: View next topic |
| Author |
Message |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Fri Aug 22, 2003 2:06 pm Post subject: @lib() ModifyMenu Question |
|
|
Hi,
on my way to replace ssmenu.dll in my app with api calls I need some
help on moving a menu to another menu (as submenu).
I use this code:
| Code: | | %%dummy = @lib(user32,ModifyMenu,BOOL:,%%dateiMenu,6,@sum($400,16,0),%%einstellungenMenu,STR:&Einstellungen) |
%%dateiMenu holds the Handle of the menu where the submenu should appear. %%einstellungenMenu is the Menuhandle of the new submenu and &Einstellung should be the menu name.
Does somebody know a way to help me ?
Thank you very much.
Bye, Fabian |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Aug 22, 2003 6:52 pm Post subject: |
|
|
Hi All,
I have tried this also and I get Errorcode 38 I don't know why VDS is thinking we want a resource but it is Anyway this function works with Gadget just fine but it does not seem to work with VDS @lib(). _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Aug 22, 2003 11:57 pm Post subject: |
|
|
While we're on the subject, I've noticed that VDS has given strange
error codes to me before. Sometimes it errors in the IDE with the
error: "Missing WEND" but I had never used one WHILE in my code.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Aug 23, 2003 11:25 pm Post subject: |
|
|
FF,
Are you using any Extension DLL's? There is already a known bug about VDS not showing the correct errorcode from DLL's... I think Tommy posted it in the Bug section already... _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Sun Aug 24, 2003 4:13 am Post subject: |
|
|
I don't think he is talking that. Some times this happens with @lib() function. VDS says missing WEND or Invalid List operation when neither exist or returns the last bracket in the return value e.g. 56345). It happened with some freeware dll sometime back though I have thrown away those thinking that the dlls were faulty and causing some overflow or something.
If I encounter it again I will post an example. _________________ 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: Sun Aug 24, 2003 2:57 pm Post subject: |
|
|
Well then that is strange...That could mean that there is a problem with VDS and returning the proper errorcode all together. I thought the problem only exsisted with Extensions Well I hope Commercial Research hurrys with the fixes... _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Sun Aug 24, 2003 6:08 pm Post subject: |
|
|
Also in @LIB() function if you provide a filename path eg: d:\somefolder\test.txt It never works even if @shortname and/or quotes "d:\somefolder\test.txt" is added. I was under the impression that I am doing something wrong and placed the images etc used in parameters in the app directory only. I think the backslash or : causes a break in the string ??. Mindpower did U have this problem ?
If so it is certainly a bug.
Regards _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Mon Aug 25, 2003 3:01 am Post subject: |
|
|
No None work :
e:\ole2\test.doc
E:\OLE2\test.doc
@SHORTNAME(e:\ole2\test.doc) //doesn't make sense in this case right??
File:///E:\OLE2\test.doc
e@CHR(58)\ole2\test.doc
e:@CHR(92)ole2@CHR(92)test.doc
e@CHR(58)@CHR(92)ole2@CHR(92)test.doc
e:\ole2\test@CHR(46)doc
OR even
e:\ole2\test
after removing file extension.
I am reluctant to blame the dll as it works perfectly in VB with even LFN's(long file names) and paths with spaces.
Further it occurs with system dlls also.
I think it is a bug and it is highly disturbing and severely cripples the
functionality of API use as you cannot always get the file you want into the app directory.
I was planning examples of things like recursive directory search, file deletion with API, file copy using API with progress dialog as these operations can be almost 20 times faster with API. I have dropped the ideas.
EDIT:
Most likely VDS adds a character/space at the end or beginning of the file path which some DLLs tolerate and others donot.
e.g It is OK with kernel32 but never with user32 or gdi32.
All these tests were done on XP only.
Regards _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Aug 25, 2003 2:06 pm Post subject: |
|
|
advapi32.dll supports filenames as a parameter too... I used it in my
Windows XP file encryption example.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Wed Aug 27, 2003 7:35 am Post subject: |
|
|
| X-Tools wrote: | | Does somebody know a way to help me ? |
Yes
I gave the code a quick spin. This is the simplest way to make it work I think. You should have used ModifyMenuA instead of ModifyMenu because of ANSI widechar stuff. Any way I have commented the script at each step and that should help I think. This is the same example as used in the set menu bitmaps in VDS 5 Source section. So you can download the bitmaps if you want.
I am thinking of writing a dsu with open source for this but that needs time - sometime later.
_________________________________________________________________________
| Code: | #-----------------------------------------------------------------------------#
#-Calling a Non-VDs dll Add bitmaps to Menu by CodeScript--------------------#
#-Author: CodeScript----------------------------------------------------------#
#-Copyright: You can remove this info while Using this code in your app.------#
#------------but may be kind enough to add a word to documentation------------#
REM USE AT YOUR OWN RISK !!
REM MISTAKES MADE WHILE USING A NON VDS DLL MAY INVITE A VDS/SYSTEM CRASH.
REM SAVE YOUR WORK BEFORE RUNNING/DEBUGGING THIS SCRIPT.
Title Add bitmaps to Menu and add Submenu by CodeScript
DIALOG CREATE,Add bitmaps to Menu and add Submenu - CodeScript,-1,0,498,106,CLASS MYWIN,RESIZABLE
DIALOG ADD,TEXT,TEXT1,10,90,240,16,Make Sure bitmaps are in the app directory !
DIALOG ADD,MENU,File,&New|Ctrl+N,&Open|Ctrl+O,Save|Ctrl+S,-,Print Preview,Print|Ctrl+P,-,Confirm Exit,-,E&xit|Alt+F4
DIALOG ADD,MENU,Temp1,A,B,C
DIALOG ADD,BUTTON,BUTTON1,36,134,124,32,Disable Save
DIALOG ADD,BUTTON,BUTTON2,36,134,124,32,Enable Save
DIALOG ADD,TEXT,TEXT2,72,80,240,16,After clicking this button have a look at the MENU !
IF @NULL(@regread(DEFAULT, MenuCtrl,Save))
Dialog Disable,BUTTON2
Dialog Hide,BUTTON2
else
Dialog Disable,BUTTON1
Dialog Hide,BUTTON1
end
LOADLIB USER32
%H = @strdel(@WINEXISTS(#MYWIN),1,1)
IF %H
REM First load all the bitmaps into memory and get their handles:
%A = @lib(user32,LoadImageA,INT:,0,new.bmp,0,0,0,$10)
%B = @lib(user32,LoadImageA,INT:,0,open.bmp,0,0,0,$10)
%C = @lib(user32,LoadImageA,INT:,0,save.bmp,0,0,0,$10)
%D = @lib(user32,LoadImageA,INT:,0,preview.bmp,0,0,0,$10)
%E = @lib(user32,LoadImageA,INT:,0,print.bmp,0,0,0,$10)
%F = @lib(user32,LoadImageA,INT:,0,yes.bmp,0,0,0,$10)
%G = @lib(user32,LoadImageA,INT:,0,no.bmp,0,0,0,$10)
REM GET THE HANDLE TO THE MENU BAR OF THE DIALOG
%I = @lib(user32,GetMenu,INT:,%H)
REM NOW GET THE HANDLE OF THE FIRST MENU OF THE DIALOG ie "FILE"
REM IT WILL BE ZERO'th ITEM - ZERO BASED NAMING
%K = @lib(user32,GetSubMenu,INT:,%I,0)
REM
REM
REM I have added the Temp1 menu to use as a submenu under OPEN item
REM of FILE menu. I am going to delete this menu Temp1 after it is
REM inserted as a submenu under OPEN item of FILE menu.
REM This step is just to give VDS the handle of the menu so that it
REM can monitor that and fire up a menuEVENT when the items are clicked.
REM This does cause a little flicker and user may see the menus being removed :)
REM which you can mask by calling DIALOG SHOW only after all the drama is over
REM as done in this example.
REM Alterntively you can use the API function CreatePopupMenu and items
REM of your choice to it, but then VDS will not respond to clicking these
REM items and you have to use OPTION MSGEVENT, <message_no>, <event_name>
REM and under the event <event_name> you use @MSGPARAMS and get the message
REM info and go to the appropriate label. This is a little more complicated
REM and not shown here.
REM
REM
REM Now I am getting the handle of Temp1 menu i.e. Item 1 (zero based naming)
%Y = @lib(user32,GetSubMenu,INT:,%I,1)
REM Use the Modify menu API and add Temp1 menu as a pop-up/sub menu for
REM OPEN (second Item on Menu 0 i.e. FILE)
%Z = @lib(user32,ModifyMenuA,INT:,%K,1,@SUM($400,$10),%Y,STR:Open)
REM NOW Delete the Temp1 menu which we don't want anymore
%Z = @lib(user32,DeleteMenu,BOOL:,%I,1,$400)
REM NOW START APPLYING THE BITMAPS FROM THE ZERO'th ITEM OF FILE
%J = @lib(user32,SetMenuItemBitmaps,BOOL:,%K,0,$400,%A,%A)
%J = @lib(user32,SetMenuItemBitmaps,BOOL:,%K,1,$400,%B,%B)
%J = @lib(user32,SetMenuItemBitmaps,BOOL:,%K,2,$400,%C,%C)
REM REMEMBER !! EVEN SEPERATORS ARE COUNTED AS A MENU ITEM
%J = @lib(user32,SetMenuItemBitmaps,BOOL:,%K,4,$400,%D,%D)
%J = @lib(user32,SetMenuItemBitmaps,BOOL:,%K,5,$400,%E,%E)
REM REMEMBER !! EVEN SEPERATORS ARE COUNTED AS A MENU ITEM
%J = @lib(user32,SetMenuItemBitmaps,BOOL:,%K,7,$400,%F,%G)
%J = @lib(user32,DrawMenuBar,INT:,%H)
FREELIB USER32
ELSE
ERROR -1
end
DIALOG SHOW
:evloop
Wait event
goto @EVENT()
:RESIZE
goto EVLOOP
:NewMenu
INFO New
goto EVLOOP
:Amenu
INFO A menu
goto EVLOOP
:BMenu
INFO B menu
goto EVLOOP
:Cmenu
INFO C menu
goto EVLOOP
:SaveMenu
INFO Add code to save your document !
goto EVLOOP
:BUTTON1BUTTON
REGISTRY WRITE, DEFAULT, MenuCtrl,Save, X
Dialog Disable,BUTTON1
Dialog Hide,BUTTON1
Dialog Enable,BUTTON2
Dialog show,BUTTON2
goto EVLOOP
:BUTTON2BUTTON
REGISTRY WRITE, DEFAULT, MenuCtrl,Save,
Dialog Disable,BUTTON2
Dialog Hide,BUTTON2
Dialog Enable,BUTTON1
Dialog show,BUTTON1
goto EVLOOP
:Print PreviewMenu
goto EVLOOP
:PrintMenu
goto EVLOOP
:Confirm ExitMenu
REM READ VDS 5 HELP ON MENU DIALOG ELEMENT
REM IF U DON'T UNDERSTAND CHECKING MENU ITEMS
REM AND DISABLING MENU ITEMS !
IF @NOT(@NULL(@regread(DEFAULT,,Confirm Exit)))
REGISTRY WRITE, DEFAULT, ,Confirm Exit,
ELSE
REGISTRY WRITE, DEFAULT, ,Confirm Exit,1
END
goto Evloop
:CLOSE
:ExitMenu
IF @NULL(@regread(DEFAULT,,Confirm Exit))
%Q = @ASK(Are sure you want to Quit?@CR()@CR()To avoid seeing this message:@CR()Goto File->Confirm Exit and uncheck it !")")
IF @EQUAL(%Q,1)
exit
else
goto EVLOOP
end
ELSE
EXIT
END
|
_________________ 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: Mon Sep 01, 2003 5:30 am Post subject: |
|
|
Anyone tried ?
Does it work or not  _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Mon Sep 01, 2003 6:41 am Post subject: |
|
|
Hi Codescript,
thanks for your help.
It works
Bye, Fabian |
|
| 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
|
|