Important alert: (current site time 7/16/2013 2:23:23 AM EDT)
 

winzip icon

UniControls: Unicode aware controls [2008-06-19]

Email
Submitted on: 6/19/2008 3:59:17 PM
By: Vesa Piittinen  
Level: Advanced
User Rating: By 19 Users
Compatibility: VB 6.0
Views: 29437
author picture
(About the author)
 
     It is hard to get Unicode in VB6. The biggest reason is the nowhere-to-be-found support in any of the native controls. In the past few years people have been mostly forced to commercial solutions or to move to another language. With UniControls I try to change this by providing some of the most essential tools for working with Unicode. **** This is the summer release. What you find here are a few powerful controls, and some that are still in an earlier level of development, yet useful for many tasks. Included: UniCaption, UniCommand, UniDialog, UniLabel, UniList, UniMenu & UniText, with some additional bonus code. **** NOTE: despite these controls using SelfSub, SelfHook and SelfCallback by Paul Caton and LaVolpe, not all of these controls are Stop button safe. This is because of UserControl's limited OLE interface, which has forced to some IOleInActivePlaceObject hacking, for which there currently is no perfectly IDE safe solution. If I didn't use it, I would have to use complex hooking to capture Enter, Escape, Tabulator, arrow keys and other navigation keys. **** Hopefully you enjoy these controls!

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 25 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

12/9/2007 11:15:49 PMSooekd

thanks
10/10
but hook menu bug. F10 key menu work but other key don't work. test press F10 menu control active --> press hotkey menu it work but press key arrow it don't. you can fix bug hook key menu next version.
Thanks
(If this comment was disrespectful, please report it.)

 
12/10/2007 10:01:10 AMSooekd

control crash when i change startingtype in menu control. you can fix next version and add icon to menu control. thanks
(If this comment was disrespectful, please report it.)

 
12/10/2007 10:54:45 AMHabin

Find an error in Unitext control at line 1595,error number 5
(If this comment was disrespectful, please report it.)

 
12/10/2007 4:17:05 PMVesa Piittinen

Sooekd: the menu arrow keys problem is caused by the text boxes. This is because if I don't hook keyboard in the textbox the textbox never gets arrow key presses. Instead focus is moved to another control. I haven't yet figured out a way to detect if a menu is open so that the hook would be disabled: I probably need to have a hook looking for menu messages, too.

Habin: thanks, I've fixed the problem in the development version. This problem was caused by an incorrect order of subclassing, which was fixed by detecting usercontrol's WM_DESTROY and doing unsubclassing there (as is done in UniLabel control).

I'm planning to release the next version on next Saturday (15th), fixes will include code order (all controls more to the coding style of UniLabel), removed crash bugs, a few minor optimizations, maybe a few new features.
(If this comment was disrespectful, please report it.)

 
12/11/2007 1:06:59 PMVlad Vissoultchev

You will have to over-ride VB UserControl's default IOLEInPlaceActivate implementation for the focus in the textbox to work w/o hooks (see txtCodeId=41506).
(If this comment was disrespectful, please report it.)

 
12/12/2007 12:49:38 PMVesa Piittinen

Vlad: is it possible to locate the VTable structure's pointer of TranslateAccelerator without the TLB? Because, as such, this solution is unusable for me due to the requirement of a TLB I don't want. And there is tons of code that just replicates nothing. Just replacing one pointer should be enough, from what I understand. And, I do have a code for replacing VB procedures (and I think it can be fitted to work with class ordinals), so I guess it would be possible to have only a custom TranslateAccelerator and nothing more... if the pointer of it could located properly.
(If this comment was disrespectful, please report it.)

 
12/16/2007 4:02:48 AMpietro ing. cecchi

Dear Vesa,
may we ask also the list and the combo controls [when you have time to think about them]?

All the best and thank you for all your beautiful code,
Pietro
(If this comment was disrespectful, please report it.)

 
12/16/2007 8:47:03 PMVesa Piittinen

Listbox is already in the next release, but I'm not sure at this point how much features it'll have. Atleast it'll fix the 32768 items limitation and allows for unlimited amount of items (only limited by available computer memory).
(If this comment was disrespectful, please report it.)

 
1/9/2008 10:56:39 AMbatcha

Hi Vesa, Thanks your nice code. Are you intend to make a unititlebar caption control? You can do it!
(If this comment was disrespectful, please report it.)

 
1/16/2008 8:18:24 AMSooekd

Hi Vesa, Thanks your nice code. I have a question how can use it like class module? I wanna convert control to class module but i can't because it cann't work with class module. you can help me convert to class module. Thanks
(If this comment was disrespectful, please report it.)

 
3/1/2008 10:34:28 AMNguyen Luu Ngoc

try to compile progs that use these control (at least UniLabel)
run it, then close it, and see it crashes
(If this comment was disrespectful, please report it.)

 
3/5/2008 3:26:00 PMRuturaaj

I was working on a non-english editing application and there I really needed what you've posted here!!! Thanks so much for your code!! Nevertheless, ♥ ♥ ♥ ♥ ♥ from me!! ;-)
(If this comment was disrespectful, please report it.)

 
3/29/2008 8:11:34 AMpietro ing. cecchi

thank you Vesa, for the beautiful code... :)
/
åõ÷áñéóôù Vesa, ãéá ôï ïìïñöï êùäéêá... :)
(If this comment was disrespectful, please report it.)

 
3/30/2008 10:20:23 PMMilutzu

5 for dedication, 4.5 for execution. Round the average and keep going. My thanks for sharing cannot be rated :D
(If this comment was disrespectful, please report it.)

 
6/21/2008 2:45:37 PMKowshar Ahmed

Everything is ok but there is one problem that the textbox unable to get unicode keystroke.
(If this comment was disrespectful, please report it.)

 
6/30/2008 8:52:47 AMSooekd

Thanks vesa, but i found bug when i use END command for quit main program. Subclass will crash when i use END. Please, you fix this problem.
(If this comment was disrespectful, please report it.)

 
7/2/2008 11:44:41 AMVesa Piittinen

The crash is there because of IOleInPlaceActiveObject and there currently is no IDE safe solution for it. However, do not use End in your programs: it is a very "cruel" way to stop a program, and you never really need it.
(If this comment was disrespectful, please report it.)

 
4/1/2009 1:55:02 AMhai2hai

I tested most of controls with Vietnamese. All controls worked except the menu (did not display Unicode Vietnamese correctly)

Is there any tips for that?
(If this comment was disrespectful, please report it.)

 
4/1/2009 3:21:16 AMhai2hai

Can you implement image icon/bmp to the menu control?

Thanks
(If this comment was disrespectful, please report it.)

 
9/20/2009 12:25:20 PMthuongall

Label events not work with transparent BackStyle.
(If this comment was disrespectful, please report it.)

 
12/29/2009 9:19:01 AMIsherpal

not working ???
Im using gurmukhi font and when i type only ???? appears. Any solution ?
(If this comment was disrespectful, please report it.)

 
1/4/2010 7:45:04 AMEdgar

Excellent controls! Thank you!
I use the text and label control with VB6 and Access database. I can read and write Unicode to the database and the text is saved in Access in the way it should be. I tried with Unicode special German Umlaute characters and with Thai. No problems!
Some small tips about the usage:
UniText1.Text = “A” works, UniText1 = “A” does not work
If I set at runtime UniText1.Visible = False and UniText1 has the focus then the application hangs (in the IDE and also compiled)
These are not really big problems but it cost me some time to find the .visible problem.

(If this comment was disrespectful, please report it.)

 
4/9/2011 1:19:53 AMRojalde Arintok

suggestion about a features maybe you can put an XP style border when using XP same with Vista and 7, I try the clsBorders of Lavolpe but the unicode turn to (?) questions marks when saving to a file.

thanks
(If this comment was disrespectful, please report it.)

 
8/3/2012 8:43:44 AMadhome

@Edgar: This is bug because unsublassing ist never executed.
See last lines...
If (Not m_ContainerIsParent) Or IDE_DesignTime Then ssc_UnSubclass m_ContainerhWnd
The "Not" is wrong (I think).

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.