PowerBASIC Peer Support Forums
 

Go Back   PowerBASIC Peer Support Forums > User to user Discussions > PowerBASIC for Windows

PowerBASIC for Windows User to user discussions about the PB/Win (formerly PB/DLL) product line. Discussion topics include PowerBASIC Forms, PowerGEN and PowerTree for Windows.

Reply
 
Thread Tools Display Modes
  #91  
Old Apr 7th, 2012, 11:02 PM
Gary Beene Gary Beene is offline
Administrator
 
Join Date: May 2008
Location: Dallas, Tx
Posts: 9,868
Hi Dave,
Thanks again for your help. This seems to have sunk in with me ...
Quote:
In either case the control is deemed Unicode by IsWindowUnicode().
CCM_GETUNICODEFORMAT will however return true or false depending upon what notifications the control will send.
But the idea that a control can be called Unicode when it sends ANSI notifications surely rates as one of the many MSDN documentation confusions that are often cleared up only by relying on folks who have already gone down that path.
__________________
Reply With Quote
  #92  
Old Apr 7th, 2012, 11:10 PM
Gary Beene Gary Beene is offline
Administrator
 
Join Date: May 2008
Location: Dallas, Tx
Posts: 9,868
Hey Jose,
Thanks for this comment on your approach:
Quote:
I just define %UNICODE = 1 or not.
I think that's the route I'll take as well, for upgrading my PBWin9 snippets to support PBWin10.

Even though I like the idea of explicitly seeing which A/W equate is used in my code, there's way too much unnecessary leg work associated with identifying which equates have A/W versions. Since the PBWin10 includes have the information, ready to be used by simply defining %Unicode, the knowledge that defining %Unicode is needed to default to W equates will suffice for me.
__________________
Reply With Quote
  #93  
Old Apr 7th, 2012, 11:17 PM
Dave Biggs Dave Biggs is offline
Member
 
Join Date: Feb 2001
Location: Australia
Posts: 2,219
Hi Gary,

Well that's sorted then?

The Elephant In The Room for me is:

Is #Option AnsiApi doing what was intended ??

It would be most valuable if it could ensure that any Common Controls would default to Ansi Notifications as well as causing the creation of 'Ansi' Dialogs and Standard Controls.

As it stands right now it seems that the WM_NotifyFormat messages, sent from common controls when they are created, are being lost somehow.

It seems to me that it should not be neccessary to manualy direct the controls to requery the parent later.

Otherwise just when is #Option AnsiApi useful?
__________________
Rgds, Dave
Reply With Quote
  #94  
Old Apr 7th, 2012, 11:27 PM
Gary Beene Gary Beene is offline
Administrator
 
Join Date: May 2008
Location: Dallas, Tx
Posts: 9,868
Thanks to all of you who've helped in this thread. I'm sure I'll re-read this thread several times to see if I've missed points the posters intended for me to capture. And beyond that, there are still some loose ends I need to clear up.

I want to go document exactly which of the controls that support WM_NotifyFormat require the "manual" re-issue of WM_NotifyFormat with ReQuery (as with the TreeView example Dave mentioned). I'm assuming TreeView may not be the only one?

I need to redo the tests I ran in post #55, using CCM_GetUnicodeFormat in lieu of IsWindowUnicode.

I still haven't tested the child controls that are built-in children of the Common/Standard controls, to show their Unicode states

And I haven't looked at what Dominic brought up
Quote:
The exception is tooltip "controls" and the notifications received in the subclassed procedures of their ANSI owners.
__________________

Last edited by Gary Beene; Apr 8th, 2012 at 10:49 AM.
Reply With Quote
  #95  
Old Apr 7th, 2012, 11:50 PM
Gary Beene Gary Beene is offline
Administrator
 
Join Date: May 2008
Location: Dallas, Tx
Posts: 9,868
Whoops, Dave, I was writing as you were speaking!

There are two aspects to #Option ANSIAPI that I'm still unclear on.

1. I don't have a legacy code example, such as Help refers to, that would have an incompatibility problem with PBWin10, that would be fixed by #OPTION ANSIAPI. An example would perhaps help clarify the intent of #OPTION ANSIAPI.

2. Regarding your comment that #Option ANSIAPI does not result in ANSI controls and that we're still required to re-issue WM_NotifyFormat with ReQuery to assure ANSI control operation: I'm not sure that's what PowerBASIC Inc intended - to give us the option to revert to all ANSI DDT controls. I understand your suggestion that you'd want that option, but when I read Help on #OPTION ANSIAPI, I don't read it to say that it affects control notifications at all. The words notifications and controls don't appear in the Help paragraph on #OPTION ANSIAPI.

I need to go re-run the tests from post #55 to see what the Unicode status is of each control, with #Option ANSIAPI executed, to see what PBWin10 actually does. I'll go do that now and be right back ....
__________________

Last edited by Gary Beene; Apr 7th, 2012 at 11:53 PM.
Reply With Quote
  #96  
Old Apr 8th, 2012, 12:06 AM
Gary Beene Gary Beene is offline
Administrator
 
Join Date: May 2008
Location: Dallas, Tx
Posts: 9,868
Hi Dave,
Ok, switching my earlier code over to %CCM_GetUnicodeFormat and including #OPTION ANSIAPI, here's the results:



This confirms that #OPTION ANSIAPI does not result in ANSI controls for these controls:
Quote:
Header, ListView, StatusBar, TAB, Toolbar, TreeView
Here's the test code:
Code:
'Compilable Example:
#Compile Exe
#Option AnsiApi
#Dim All
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
   Dialog New Pixels, 0, "Test Code",300,300,500,750, %WS_OverlappedWindow To hDlg
   Control Add Button, hDlg, 100,"Test for Unicode", 10,50,120,20

   Control Add Button, hDlg, 201, "Button", 10,100,50,20
   Control Add Check3State, hDlg, 202, "Check3State", 10,150,100,20
   Control Add CheckBox, hDlg, 203, "CheckBox", 10,200,100,20
   Control Add ComboBox,  hDlg, 204, , 10,250,100,20
   Control Add Frame, hDlg, 205, "Frame", 10,300,100,20

   Control Add Graphic, hDlg, 206, "Graphic", 10,350,30,30, %WS_Border
   Control Add Header, hDlg, 207, "Header", 10,400,30,20, %WS_Border
   Control Add Image, hDlg, 208, "Image", 10,450,30,30, %WS_Border
   Control Add ImageX, hDlg, 209, "ImageX", 10,500,30,30, %WS_Border
   Control Add ImgButton, hDlg, 210, "ImgButton", 10,550,30,20
   Control Add ImgButtonX, hDlg, 211, "ImgButtonX", 10,600,30,20

   Control Add Label, hDlg, 212, "Label", 300,100,30,20
   Control Add Line, hDlg, 213, "Line", 300,150,30,20
   Control Add ListBox, hDlg, 214, , 300,200,100,40
   Control Add ListView, hDlg, 215, "ListView", 300,250,100,40

   Control Add Option, hDlg, 216, "Option", 300,300,50,20
   Control Add Progressbar, hDlg, 217, "ProgressBar", 300,350,100,20
   Control Add ScrollBar, hDlg, 218, "ScrollBar", 300,400,100,20
   Control Add Statusbar, hDlg, 219, "StatusBar", 300,450,30,20

   Control Add Tab, hDlg, 220, "TAB", 300,500,100,20
   Control Add TextBox, hDlg, 221, "TextBox", 300,550,100,20
   Control Add Toolbar, hDlg, 222, "Toolbar", 300,600,100,20
   Control Add Treeview, hDlg, 223, "TreeView", 300,650,100,40

   Dialog Show Modal hDlg Call DlgProc
End Function

CallBack Function DlgProc() As Long
   Local temp$, iResult As Long
   Select Case Cb.Msg
      Case %WM_Command
         Select Case Cb.Ctl
            Case 100
               temp$ = temp$ + "Button " + Str$(SendMessage(GetDlgItem(hDlg,201),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Check3State " + Str$(SendMessage(GetDlgItem(hDlg,202),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "CheckBox " + Str$(SendMessage(GetDlgItem(hDlg,203),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ComboBox " + Str$(SendMessage(GetDlgItem(hDlg,204),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Frame " + Str$(SendMessage(GetDlgItem(hDlg,205),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Graphic " + Str$(SendMessage(GetDlgItem(hDlg,206),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Header " + Str$(SendMessage(GetDlgItem(hDlg,207),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Image " + Str$(SendMessage(GetDlgItem(hDlg,208),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ImageX " + Str$(SendMessage(GetDlgItem(hDlg,209),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ImgButton " + Str$(SendMessage(GetDlgItem(hDlg,210),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ImbButtonX " + Str$(SendMessage(GetDlgItem(hDlg,211),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Label " + Str$(SendMessage(GetDlgItem(hDlg,212),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Line " + Str$(SendMessage(GetDlgItem(hDlg,213),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ListBox " + Str$(SendMessage(GetDlgItem(hDlg,214),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ListView " + Str$(SendMessage(GetDlgItem(hDlg,215),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Option " + Str$(SendMessage(GetDlgItem(hDlg,216),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ProgressBar " + Str$(SendMessage(GetDlgItem(hDlg,217),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ScrollBar " + Str$(SendMessage(GetDlgItem(hDlg,218),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "StatusBar " + Str$(SendMessage(GetDlgItem(hDlg,219),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "TAB " + Str$(SendMessage(GetDlgItem(hDlg,220),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "TextBox " + Str$(SendMessage(GetDlgItem(hDlg,221),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Toolbar " + Str$(SendMessage(GetDlgItem(hDlg,222),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "TreeView " + Str$(SendMessage(GetDlgItem(hDlg,223),%CCM_GetUnicodeFormat,0,0))
               MsgBox temp$, %MB_Ok + %MB_IconInformation, "With #Option ANSIAPI"
         End Select
   End Select
End Function
__________________
Reply With Quote
  #97  
Old Apr 8th, 2012, 12:17 AM
Gary Beene Gary Beene is offline
Administrator
 
Join Date: May 2008
Location: Dallas, Tx
Posts: 9,868
And Dave,
Going the next step further, to address your suggestion to have all of the controls be ANSI ...

In the previous code, if I send WM_NotifyFormat with ReQuery to all 6 of those controls, all reply as ANSI when queried with CCM_GetUnicodeFormat. That would get the result you wanted, but not simply by including #OPTION ANSIAPI.



Test Code:
Code:
'Compilable Example:
#Compile Exe
#Option AnsiApi
#Dim All
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
   Dialog New Pixels, 0, "Test Code",300,300,500,750, %WS_OverlappedWindow To hDlg
   Control Add Button, hDlg, 100,"Test for Unicode", 10,50,120,20
   Control Add Button, hDlg, 101,"Send WM_Notify", 150,50,120,20

   Control Add Button, hDlg, 201, "Button", 10,100,50,20
   Control Add Check3State, hDlg, 202, "Check3State", 10,150,100,20
   Control Add CheckBox, hDlg, 203, "CheckBox", 10,200,100,20
   Control Add ComboBox,  hDlg, 204, , 10,250,100,20
   Control Add Frame, hDlg, 205, "Frame", 10,300,100,20

   Control Add Graphic, hDlg, 206, "Graphic", 10,350,30,30, %WS_Border
   Control Add Header, hDlg, 207, "Header", 10,400,30,20, %WS_Border
   Control Add Image, hDlg, 208, "Image", 10,450,30,30, %WS_Border
   Control Add ImageX, hDlg, 209, "ImageX", 10,500,30,30, %WS_Border
   Control Add ImgButton, hDlg, 210, "ImgButton", 10,550,30,20
   Control Add ImgButtonX, hDlg, 211, "ImgButtonX", 10,600,30,20

   Control Add Label, hDlg, 212, "Label", 300,100,30,20
   Control Add Line, hDlg, 213, "Line", 300,150,30,20
   Control Add ListBox, hDlg, 214, , 300,200,100,40
   Control Add ListView, hDlg, 215, "ListView", 300,250,100,40

   Control Add Option, hDlg, 216, "Option", 300,300,50,20
   Control Add Progressbar, hDlg, 217, "ProgressBar", 300,350,100,20
   Control Add ScrollBar, hDlg, 218, "ScrollBar", 300,400,100,20
   Control Add Statusbar, hDlg, 219, "StatusBar", 300,450,30,20

   Control Add Tab, hDlg, 220, "TAB", 300,500,100,20
   Control Add TextBox, hDlg, 221, "TextBox", 300,550,100,20
   Control Add Toolbar, hDlg, 222, "Toolbar", 300,600,100,20
   Control Add Treeview, hDlg, 223, "TreeView", 300,650,100,40

   Dialog Show Modal hDlg Call DlgProc
End Function

CallBack Function DlgProc() As Long
   Local temp$, iResult As Long
   Select Case Cb.Msg
      Case %WM_Command
         Select Case Cb.Ctl
            Case 100
               temp$ = temp$ + "Button " + Str$(SendMessage(GetDlgItem(hDlg,201),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Check3State " + Str$(SendMessage(GetDlgItem(hDlg,202),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "CheckBox " + Str$(SendMessage(GetDlgItem(hDlg,203),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ComboBox " + Str$(SendMessage(GetDlgItem(hDlg,204),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Frame " + Str$(SendMessage(GetDlgItem(hDlg,205),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Graphic " + Str$(SendMessage(GetDlgItem(hDlg,206),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Header " + Str$(SendMessage(GetDlgItem(hDlg,207),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Image " + Str$(SendMessage(GetDlgItem(hDlg,208),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ImageX " + Str$(SendMessage(GetDlgItem(hDlg,209),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ImgButton " + Str$(SendMessage(GetDlgItem(hDlg,210),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ImbButtonX " + Str$(SendMessage(GetDlgItem(hDlg,211),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Label " + Str$(SendMessage(GetDlgItem(hDlg,212),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Line " + Str$(SendMessage(GetDlgItem(hDlg,213),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ListBox " + Str$(SendMessage(GetDlgItem(hDlg,214),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ListView " + Str$(SendMessage(GetDlgItem(hDlg,215),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Option " + Str$(SendMessage(GetDlgItem(hDlg,216),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ProgressBar " + Str$(SendMessage(GetDlgItem(hDlg,217),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ScrollBar " + Str$(SendMessage(GetDlgItem(hDlg,218),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "StatusBar " + Str$(SendMessage(GetDlgItem(hDlg,219),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "TAB " + Str$(SendMessage(GetDlgItem(hDlg,220),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "TextBox " + Str$(SendMessage(GetDlgItem(hDlg,221),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Toolbar " + Str$(SendMessage(GetDlgItem(hDlg,222),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "TreeView " + Str$(SendMessage(GetDlgItem(hDlg,223),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               MsgBox temp$, %MB_Ok + %MB_IconInformation, "With #Option ANSIAPI"
            Case 101
               Control Send hDlg, 207, %WM_NotifyFormat, hDlg, %NF_REQUERY  'header
               Control Send hDlg, 215, %WM_NotifyFormat, hDlg, %NF_REQUERY  'listview
               Control Send hDlg, 219, %WM_NotifyFormat, hDlg, %NF_REQUERY  'statusbar
               Control Send hDlg, 220, %WM_NotifyFormat, hDlg, %NF_REQUERY  'tab
               Control Send hDlg, 222, %WM_NotifyFormat, hDlg, %NF_REQUERY  'toolbar
               Control Send hDlg, 223, %WM_NotifyFormat, hDlg, %NF_REQUERY  'treeview
         End Select
   End Select
End Function
__________________

Last edited by Gary Beene; Apr 8th, 2012 at 12:26 AM.
Reply With Quote
  #98  
Old Apr 8th, 2012, 12:33 AM
Gary Beene Gary Beene is offline
Administrator
 
Join Date: May 2008
Location: Dallas, Tx
Posts: 9,868
Hey Dave,
I also modified my test code to send %CCM_SetUnicodeFormat to all 6 of the controls.

The result was that all of the controls convert over to ANSI - same result as with using WM_NotifyFormat.

I'm not immediately sure of the advantage to using one over the other. As I read MSDN, CCM_SetUnicodeFormat explicitly calls out the mode to use, whereas WM_NotifyFormat is slightly more round-about, using the mode of the parent to select the mode of the child control.

Code used to test CCM_SetUnicodeFormat:
Code:
'Compilable Example:
#Compile Exe
#Option AnsiApi
#Dim All
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
   Dialog New Pixels, 0, "Test Code",300,300,500,750, %WS_OverlappedWindow To hDlg
   Control Add Button, hDlg, 100,"Test for Unicode", 10,50,120,20
   Control Add Button, hDlg, 101,"Send WM_Notify", 150,50,120,20

   Control Add Button, hDlg, 201, "Button", 10,100,50,20
   Control Add Check3State, hDlg, 202, "Check3State", 10,150,100,20
   Control Add CheckBox, hDlg, 203, "CheckBox", 10,200,100,20
   Control Add ComboBox,  hDlg, 204, , 10,250,100,20
   Control Add Frame, hDlg, 205, "Frame", 10,300,100,20

   Control Add Graphic, hDlg, 206, "Graphic", 10,350,30,30, %WS_Border
   Control Add Header, hDlg, 207, "Header", 10,400,30,20, %WS_Border
   Control Add Image, hDlg, 208, "Image", 10,450,30,30, %WS_Border
   Control Add ImageX, hDlg, 209, "ImageX", 10,500,30,30, %WS_Border
   Control Add ImgButton, hDlg, 210, "ImgButton", 10,550,30,20
   Control Add ImgButtonX, hDlg, 211, "ImgButtonX", 10,600,30,20

   Control Add Label, hDlg, 212, "Label", 300,100,30,20
   Control Add Line, hDlg, 213, "Line", 300,150,30,20
   Control Add ListBox, hDlg, 214, , 300,200,100,40
   Control Add ListView, hDlg, 215, "ListView", 300,250,100,40

   Control Add Option, hDlg, 216, "Option", 300,300,50,20
   Control Add Progressbar, hDlg, 217, "ProgressBar", 300,350,100,20
   Control Add ScrollBar, hDlg, 218, "ScrollBar", 300,400,100,20
   Control Add Statusbar, hDlg, 219, "StatusBar", 300,450,30,20

   Control Add Tab, hDlg, 220, "TAB", 300,500,100,20
   Control Add TextBox, hDlg, 221, "TextBox", 300,550,100,20
   Control Add Toolbar, hDlg, 222, "Toolbar", 300,600,100,20
   Control Add Treeview, hDlg, 223, "TreeView", 300,650,100,40

   Dialog Show Modal hDlg Call DlgProc
End Function

CallBack Function DlgProc() As Long
   Local temp$, iResult As Long
   Select Case Cb.Msg
      Case %WM_Command
         Select Case Cb.Ctl
            Case 100
               temp$ = temp$ + "Button " + Str$(SendMessage(GetDlgItem(hDlg,201),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Check3State " + Str$(SendMessage(GetDlgItem(hDlg,202),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "CheckBox " + Str$(SendMessage(GetDlgItem(hDlg,203),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ComboBox " + Str$(SendMessage(GetDlgItem(hDlg,204),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Frame " + Str$(SendMessage(GetDlgItem(hDlg,205),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Graphic " + Str$(SendMessage(GetDlgItem(hDlg,206),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Header " + Str$(SendMessage(GetDlgItem(hDlg,207),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Image " + Str$(SendMessage(GetDlgItem(hDlg,208),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ImageX " + Str$(SendMessage(GetDlgItem(hDlg,209),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ImgButton " + Str$(SendMessage(GetDlgItem(hDlg,210),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ImbButtonX " + Str$(SendMessage(GetDlgItem(hDlg,211),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Label " + Str$(SendMessage(GetDlgItem(hDlg,212),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Line " + Str$(SendMessage(GetDlgItem(hDlg,213),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ListBox " + Str$(SendMessage(GetDlgItem(hDlg,214),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ListView " + Str$(SendMessage(GetDlgItem(hDlg,215),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Option " + Str$(SendMessage(GetDlgItem(hDlg,216),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ProgressBar " + Str$(SendMessage(GetDlgItem(hDlg,217),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "ScrollBar " + Str$(SendMessage(GetDlgItem(hDlg,218),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "StatusBar " + Str$(SendMessage(GetDlgItem(hDlg,219),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "TAB " + Str$(SendMessage(GetDlgItem(hDlg,220),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "TextBox " + Str$(SendMessage(GetDlgItem(hDlg,221),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "Toolbar " + Str$(SendMessage(GetDlgItem(hDlg,222),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               temp$ = temp$ + "TreeView " + Str$(SendMessage(GetDlgItem(hDlg,223),%CCM_GetUnicodeFormat,0,0)) + $CrLf
               MsgBox temp$, %MB_Ok + %MB_IconInformation, "With #Option ANSIAPI"
            Case 101
               Control Send hDlg, 207, %CCM_SetUnicodeFormat, 0, 0  'header
               Control Send hDlg, 215, %CCM_SetUnicodeFormat, 0, 0  'listview
               Control Send hDlg, 219, %CCM_SetUnicodeFormat, 0, 0  'statusbar
               Control Send hDlg, 220, %CCM_SetUnicodeFormat, 0, 0  'tab
               Control Send hDlg, 222, %CCM_SetUnicodeFormat, 0, 0  'toolbar
               Control Send hDlg, 223, %CCM_SetUnicodeFormat, 0, 0  'treeview
'               Control Send hDlg, 207, %WM_NotifyFormat, hDlg, %NF_REQUERY  'header
'               Control Send hDlg, 215, %WM_NotifyFormat, hDlg, %NF_REQUERY  'listview
'               Control Send hDlg, 219, %WM_NotifyFormat, hDlg, %NF_REQUERY  'statusbar
'               Control Send hDlg, 220, %WM_NotifyFormat, hDlg, %NF_REQUERY  'tab
'               Control Send hDlg, 222, %WM_NotifyFormat, hDlg, %NF_REQUERY  'toolbar
'               Control Send hDlg, 223, %WM_NotifyFormat, hDlg, %NF_REQUERY  'treeview
         End Select
   End Select
End Function
__________________

Last edited by Gary Beene; Apr 8th, 2012 at 10:51 AM.
Reply With Quote
  #99  
Old Apr 8th, 2012, 02:51 AM
Dave Biggs Dave Biggs is offline
Member
 
Join Date: Feb 2001
Location: Australia
Posts: 2,219
Hi Gary,

Thanks for doing the extra tests. They do confirm what I expected.

If a window is created as Ansi in PBWin10 using SDK, CreateWindowEx (AKA CreateWindowExA courtesy of the declaration selected in WinUser.inc if %Unicode is not defined) etc, when common controls are added to it they do implement Ansi notifications - ie WM_NotifyFormat is doing it's thing automatically.

If a dialog is created as Ansi in PBWin10 using DDT and #Option AnsiApi is used, any common controls added do not implement Ansi notifications without help from source code.

That's just not fair!

There are work-arounds as discussed above but my feeling is that #Option AnsiApi isn't doing what it should.

My (one eyed) reading of help would be that code previously written to support Common Controls should qualify here..
Quote:
This version of PowerBASIC offers complete support for Wide Unicode text, so it follows that the internal runtime library would call Unicode versions of functions in the Windows API. In some fairly rare cases, this could cause an incompatibility with code you have written, if your code calls ANSI functions in the Windows API. If you specify #OPTION ANSIAPI in your source code, PowerBASIC will call only ANSI versions of these functions.
Ok, code written to support the use of Common Controls is hardly 'rare' but if use of #Option AnsiApi is not for that situation why make it available at all, while not dealing with an inconvienience PB DDT users are much more likely to encounter when trying to use legacy code ??
__________________
Rgds, Dave
Reply With Quote
  #100  
Old Apr 8th, 2012, 09:47 AM
Gary Beene Gary Beene is offline
Administrator
 
Join Date: May 2008
Location: Dallas, Tx
Posts: 9,868
Hi Dave,
Bob will have to weigh in on this, but I don't see that #Option ANSIAPI was provided to affect the use of Common Controls as you suggest here:
Quote:
Ok, code written to support the use of Common Controls is hardly 'rare' but if use of #Option AnsiApi is not for that situation why make it available at all, while not dealing with an inconvienience PB DDT users are much more likely to encounter when trying to use legacy code ??
My take-away from this (very long) thread is that the path to using legacy code would be to define %Unicode, so that all previous instances of the neutral equates (in legacy code) would be converted over to Unicode equates - matching the Unicode status of common controls in PBWIn10.

That's just one line of code to add to legacy code to make it work in PBWin10. Have we seen a code example where that's not true? I need to go look at some of the posts folks have made to see if there were any exceptions noted.

But further to your point, in PBWin10 #OPTION ANSIAPI does make all of the non-Common Controls ANSI. So why did it stop short of making the Common Controls ANSI as well, thus requiring the extra 6 lines of code (WM_NotifyFormat or CCM_SetUnicodeFormat) to complete the ANSI conversion of all controls? Again, Bob will have to weigh in on this one, but nothing I read in Help made me think that conversion of all controls to ANSI was a goal of any of the PowerBASIC statements.

And, I still cannot give you a code example of where #OPTION ANSIAPI was intended to apply.

PS. I made up the term "neutral equates" - just meaning that equates such as %TVN_ItemExpanded, which are written with no A or W ending are "neutral". Whether the neutral equate is replaced with an A or W version in PBWin10 depends on the Includes and whether %Unicode is defined. The term neutral equate sounded reasonably. Note that in PBWin9, there are no A equates in win32apil.inc. Instead the neutral equates were defined with A values, whereas in PBWin10 defining %Unicode directs the includes to select A or W when neutral equates are used in the code.
__________________

Last edited by Gary Beene; Apr 8th, 2012 at 09:53 AM.
Reply With Quote
  #101  
Old Apr 8th, 2012, 10:49 AM
Dave Biggs Dave Biggs is offline
Member
 
Join Date: Feb 2001
Location: Australia
Posts: 2,219
Hi Gary,

I agree (not just that this is a long thread ), the way to prepare legacy code for compilation with the PBWin10 compiler is just to define %Unicode. Well that and convert Strings to wStrings too as required.

New code should probably have %Unicode routinely defined too. As Microsoft advise in the MSDN topic Conventions for Function Prototypes
Quote:
Note New Windows applications should use Unicode to avoid the inconsistencies of varied code pages and for ease of localization. They should be written with generic functions, and should define UNICODE to compile the functions into Unicode functions.
I noted that they use the term 'generic functions' but I favour the use of 'neutral equates' that you have adopted (indeed I had used the same expression in some of me own notes that never made it to the forum!).

Thanks for persevering with the thread (through all your personal distractions!) - it's been very useful for me by teasing out details on a few topics that I have dabbled with recently.
__________________
Rgds, Dave
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:28 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1999-2011 PowerBASIC, Inc. All Rights Reserved.
Error in my_thread_global_end(): 1 threads didn't exit