forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Windows API question???????????
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Fri Dec 20, 2002 10:42 pm    Post subject: Reply with quote

Well, that's kinda correct mindpower... Wink

Multiple edit boxes (or whatever) in the same program that
share the same style will have the same font handle. It's
specific to the current instance though, and won't be the
same for that program every time, or for multiple instances
at once. Any change in style also adds a different font handle.

In this example, the top button, the checkbox, and the 2 edit
boxes all share the same font. The edit boxes will show info
when ya EXIT them, the other stuff just click on.
__________________________________________________________________________________________________________________________
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"Test Program",-1,0,170,220
  DIALOG ADD,STYLE,S1,MS Sans Serif,10
  DIALOG ADD,STYLE,S2,MS Sans Serif,10,B
  DIALOG ADD,STYLE,S3,MS Sans Serif,10,I
  DIALOG ADD,STYLE,S4,MS Sans Serif,10,BI

  DIALOG ADD,BUTTON,B1,5,5,160,25,MS Sans Sanserif,,S1
  DIALOG ADD,BUTTON,B2,35,5,160,25,MS Sans Sanserif B,,S2
  DIALOG ADD,BUTTON,B3,65,5,160,25,MS Sans Sanserif I,,S3
  DIALOG ADD,BUTTON,B4,95,5,160,25,MS Sans Sanserif BI,,S4

  DIALOG ADD,CHECK,CK,130,5,160,25,MS Sans Sanserif,,,S1,CLICK

  DIALOG ADD,EDIT,E1,160,5,160,25,MS Sans Sanserif,,,S1,READONLY,EXIT
  DIALOG ADD,EDIT,E2,190,5,160,25,MS Sans Sanserif,,,S1,READONLY,EXIT
DIALOG SHOW

:EVLOOP
  WAIT EVENT
  %e = @event()
  if @equal(%e, CLOSE)
     goto CLOSE
  end
  %%element = @substr(%e, 1, 2)
  rem -- Get the text where we have the font name --
  %%fontname = @sendmsg(@win(~%%element),$0D,90,@STRBUF())
  %%fonthandle = @sendmsg(@winexist(~%%element),$031,0,0)
  INFO Element = %%element@cr()@cr()Font = %%fontname@cr()@cr()Font handle = %%fonthandle
  goto EVLOOP

:CLOSE
  EXIT

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Sat Dec 21, 2002 4:23 pm    Post subject: Reply with quote

Yes Mac,
You are prob. right there Smile But if you are trying to find out what font a non-VDS window is using then you could not do what skit3000 mentioned. Also without seeing the code for VDS I was not sure if they were dynamicly allocating the font with every message loop of if they were just building all fonts in the main window process. VDS is a strange beast and sometimes it does not always play by normal rules of engagement Wink hehehehehehe
Also lets say that you added a VDS style later in the program with the same font just a different name for the style element. Does VDS use the same font handle Question
I suspect that bweckel prob. wanted to make a program that could detect what fonts are being used on an external program and not a VDS dialog? Prob. for his "Script Checker" proggy and that would explain why he didn't want to use a DLL to do this if he could help it. Since the "Script Checker" is OpenSource....

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Dec 21, 2002 6:10 pm    Post subject: Reply with quote

I was also playing a bit with that sendmessage stuff, and found out another thing: If you edit the content of an edit-box, the fontnumber @sendmsg() will give, is also different...

Btw. Mac, what does @strbuf() do? Cause you used it in your script, but the VDS doesn't contain any help about it...
Back to top
View user's profile Send private message
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1567

PostPosted: Sat Dec 21, 2002 6:13 pm    Post subject: Reply with quote

It's a string buffer used mainly for the Win Api. It a built in function to hold data when a buffer (storage) is needed with an API call. The Api HelpFile uses that function in some cases.
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Dec 21, 2002 10:29 pm    Post subject: Reply with quote

Mindpower, I don't think @sendmsg() works on apps
other than the one it's coded in... Wink

Someone correct me if I'm wrong here... Confused

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Dec 21, 2002 10:35 pm    Post subject: Reply with quote

Skit3000 wrote:
I was also playing a bit with that sendmessage stuff,
and found out another thing: If you edit the content of an edit-box, the
fontnumber @sendmsg() will give, is also different...

Skit, if ya remove the READONLY style from the edit boxes
in the example I posted, you can type whatever ya want
and the font handle NUMBER doesn't change (although the
font NAME will be whatever is in the edit box). I made 'em
readonly because it was easier to use the contents for the
font name in this example. Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Dec 21, 2002 10:52 pm    Post subject: Reply with quote

Hey Mindpower, I forgot to answer one of your questions... Embarassed

If you add another style with an identical font, apparently
the fonthandle does stay the same.

I used the example above and copied STYLE S1, named
it to S5, and used it for the top button. It returned the same
fonthandle number as the checkbox and the two edit boxes
who's STYLE was still S1. Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Sat Dec 21, 2002 11:40 pm    Post subject: Reply with quote

Thanks to Mac's last post on this subject I've come up with a solution to my problem.

This is written in VDS 4. I will post it also in the VDS 4 Source and convert
it for use by VDS3 users and post it there also.

NOTE:
There is a draw back. The elements added to the dialog must remain for
this to work properly.


Code:


  TITLE Font Handle Converter
 
rem     You could load all of the font names from the registry here
  list create,1
  list loadtext,1
"Arial
"Courier New
"Ms Sans Serif
"Tahoma
"Times New Roman
"Verdana

rem    Use this list to write the font names and handles to
  list create,2

  dialog create,Handle Converter,-1,0,250,220
  dialog add,Style,StL1,Courier New,9,,White,LtBlue
  dialog add,List,L1,0,0,250,200,,StL1,DBLCLICK
  dialog add,Status,Stat,DblClick list to change to that font
  dialog show

 
  %%st = 1
  %c = @count(1)
  %x = 0
  list add,2,HANDLE@tab()@tab()FONT
  repeat
    list seek,1,%x
    dialog add,Style,St%%st,@item(1),10
    dialog add,EDIT,Ed%%st,0,0,0,0,,,St%%st
    %%fHandle = @sendmsg(~Ed%%st, $0031,0,0)
    list add,2,%%fHandle@tab()@tab()@item(1)
    %%st = @succ(%%st)
    %x = @succ(%x)
  until @equal(%x,%c)
  list assign,L1,@text(2)
  list close,2
 
:Evloop
  wait event
  goto @event()
 
:L1DBLCLICK
  if @greater(@index(1),0)
    %%font = @substr(@item(L1),1,@pred(@pos(@tab(),@item(L1))))
    %G = @sendmsg(~L1, $0030,%%font,1)
  end
  goto Evloop
 
:CLOSE
  exit




Have fun! Razz Razz

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."


Last edited by ShinobiSoft on Sat Dec 21, 2002 11:49 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Sat Dec 21, 2002 11:49 pm    Post subject: Reply with quote

Not sure if this is really what you meant but, just for the record, certain sendmessage functions will work on other apps.
Code:

REM Set IDE title to "New Text"
%P = @sendmsg(@WINEXISTS(Visual DialogScript),$0C,0,New Text)

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Dec 21, 2002 11:57 pm    Post subject: Reply with quote

Thanks Sheep, Smile

I didn't know for sure if any worked on other apps, I
think I've tried some for modifying controls (lists or
something maybe?) with no success... Wink

DUH, just remembered I've changed window text on
another app before... Embarassed

LOL, memory is the first thing to go... (right Garrett? Razz ) Laughing

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2150
Location: A House

PostPosted: Sun Dec 22, 2002 4:42 am    Post subject: Reply with quote

Mac wrote:
LOL, memory is the first thing to go... (right Garrett? Razz ) Laughing

Cheers, Mac Smile


Ain't Dat Da Truth!!!

-Garrett
Back to top
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Sun Dec 22, 2002 4:53 am    Post subject: Reply with quote

How do you remember what the first thing was? Keep a journal? How do you remember where you kept your journal?
This raises alot of questions I want answers for..and make it snappy before you forget. Wink

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1567

PostPosted: Sun Dec 22, 2002 5:04 am    Post subject: Reply with quote

more soda please
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2150
Location: A House

PostPosted: Sun Dec 22, 2002 9:04 am    Post subject: Reply with quote

SnarlingSheep wrote:
How do you remember what the first thing was? Keep a journal? How do you remember where you kept your journal?
This raises alot of questions I want answers for..and make it snappy before you forget. Wink


I'm sorry, what was the question again?

-Garrett
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group