Control ID..which type?
Control ID..which type?
hi
which type of varible must be used as control id ?
parameter after parent (hwnd)
i tried integer, integer ptr ,long ,long ptr ..all of them cose error or warnnings ?
static1 = CreateWindowEx( 0, "static", "" , WS_Border or WS_VISIBLE Or WS_CHILD , 10 , 10 , 100 , 100 , hWnd, st1_id, 0, 0)
which type of varible must be used as control id ?
parameter after parent (hwnd)
i tried integer, integer ptr ,long ,long ptr ..all of them cose error or warnnings ?
static1 = CreateWindowEx( 0, "static", "" , WS_Border or WS_VISIBLE Or WS_CHILD , 10 , 10 , 100 , 100 , hWnd, st1_id, 0, 0)
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: Control ID..which type?
Here:aurelVZAB wrote:hi
which type of varible must be used as control id ?
parameter after parent (hwnd)
i tried integer, integer ptr ,long ,long ptr ..all of them cose error or warnnings ?
static1 = CreateWindowEx( 0, "static", "" , WS_Border or WS_VISIBLE Or WS_CHILD , 10 , 10 , 100 , 100 , hWnd, st1_id, 0, 0)
https://docs.microsoft.com/en-us/window ... ewindowexa
Re: Control ID..which type?
Come on Xusinboy...is that help ???
from someone like you who build IDE
i am not interested what MS offer than experience from FreeBasic user...is that right?
so ..in o2 i used for control id a Long or Int (Integer) and i cannot figure why FB use Null
what is NULL in fb case ?
and how NULL if is pointer or INT can be used for control ID ?
please anyone with experience in winapi programming ...
from someone like you who build IDE
i am not interested what MS offer than experience from FreeBasic user...is that right?
so ..in o2 i used for control id a Long or Int (Integer) and i cannot figure why FB use Null
what is NULL in fb case ?
and how NULL if is pointer or INT can be used for control ID ?
please anyone with experience in winapi programming ...
-
- Posts: 1002
- Joined: Jul 14, 2005 23:41
Re: Control ID..which type?
Try the following:
CAST(HMENU, st1_id)
CAST(HMENU, st1_id)
Re: Control ID..which type?
Thanks Paul
but that is not a problem compiler not complain about argument in function
but main complain is about variable type
like in declaration:
suspicious pointer assignment ?
is this some kind of bug or what
i used latest fb 1.0.9
but same in older release too
but that is not a problem compiler not complain about argument in function
but main complain is about variable type
like in declaration:
no mether which type i use ..i getdim static1_id as integer ptr
static1_id = 500
suspicious pointer assignment ?
is this some kind of bug or what
i used latest fb 1.0.9
but same in older release too
Re: Control ID..which type?
here is error message i am using poseidonFB
\FreeBASIC-1.09.0-win32\Aurel_FB_Scintilla\FBSci.bas(135) warning 4(2): Suspicious pointer assignment
Compile Success! But got warning...
\FreeBASIC-1.09.0-win32\Aurel_FB_Scintilla\FBSci.bas(135) warning 4(2): Suspicious pointer assignment
Compile Success! But got warning...
-
- Posts: 564
- Joined: Sep 27, 2016 18:20
- Location: Valencia, Spain
Re: Control ID..which type?
Why do you declare it as a pointer if it is not a pointer?
dim static1_id as integer
static1_id = 500
and when you pass it to CreateWIndowEx, do te casting
static1 = CreateWindowEx( 0, "static", "" , WS_Border or WS_VISIBLE Or WS_CHILD , 10 , 10 , 100 , 100 , hWnd, CAST(HMENU, static1_id), 0, 0)
dim static1_id as integer
static1_id = 500
and when you pass it to CreateWIndowEx, do te casting
static1 = CreateWindowEx( 0, "static", "" , WS_Border or WS_VISIBLE Or WS_CHILD , 10 , 10 , 100 , 100 , hWnd, CAST(HMENU, static1_id), 0, 0)
Re: Control ID..which type?
Yes Jose
That is why i asking all the time I DON'T know which type i must use
and i agree with you ,and i already tried this using Integer
look code :
then after that i get message :
D:\FreeBASIC-1.09.0-win32\Aurel_FB_Scintilla\FBSci.bas(135) error 14: Expected identifier
D:\FreeBASIC-1.09.0-win32\Aurel_FB_Scintilla\FBSci.bas(136) error 146: Only valid in -lang deprecated or fblite or qb
can you explain this ?
i am confused totally ....
to remind myself:
Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA"(ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, ByRef lpParam As Long) As Long
i use this in o2 and work allways of course ... it is type Long
That is why i asking all the time I DON'T know which type i must use
and i agree with you ,and i already tried this using Integer
look code :
Code: Select all
dim static1_id as integer
static1_id = 500
dim classname as any ptr
dim cname as string
cname = "FBWin"
classname = strptr(cname)
function = 0
with wcls
.style = CS_HREDRAW or CS_VREDRAW
.lpfnWndProc = @WndProc
.cbClsExtra = 0
.cbWndExtra = 0
.hInstance = hInstance
.hIcon = LoadIcon( NULL, IDI_APPLICATION )
.hCursor = LoadCursor( NULL, IDC_ARROW )
.hbrBackground = GetStockObject( WHITE_BRUSH )
.lpszMenuName = NULL
.lpszClassName = classname
end with
if( RegisterClass( @wcls ) = FALSE ) then
MessageBox( null, "Failed to register wcls", "Error", MB_ICONERROR )
exit function
end if
hWnd = CreateWindowEx( 0, classname, "Aurel_FB_SCi", WS_OVERLAPPEDWINDOW, 100, 100, 800, 600,NULL,NULL,hInstance,NULL)
static1 = CreateWindowEx( 0, "static", "" , WS_Border or WS_VISIBLE Or WS_CHILD , 10 , 10 , 100 , 100 , hWnd,cast(HMENU,static1_id), 0, 0)
D:\FreeBASIC-1.09.0-win32\Aurel_FB_Scintilla\FBSci.bas(135) error 14: Expected identifier
D:\FreeBASIC-1.09.0-win32\Aurel_FB_Scintilla\FBSci.bas(136) error 146: Only valid in -lang deprecated or fblite or qb
can you explain this ?
i am confused totally ....
to remind myself:
Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA"(ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, ByRef lpParam As Long) As Long
i use this in o2 and work allways of course ... it is type Long
-
- Posts: 564
- Joined: Sep 27, 2016 18:20
- Location: Valencia, Spain
Re: Control ID..which type?
This is not O2, it is FreeBasic.
declare function CreateWindowExA(byval dwExStyle as DWORD, byval lpClassName as LPCSTR, byval lpWindowName as LPCSTR, byval dwStyle as DWORD, byval X as long, byval Y as long, byval nWidth as long, byval nHeight as long, byval hWndParent as HWND, byval hMenu as HMENU, byval hInstance as HINSTANCE, byval lpParam as LPVOID) as HWND
What are you doing with?
dim classname as any ptr
dim cname as string
cname = "FBWin"
classname = strptr(cname)
You can simply do
dim classname as zstring * 6 = "FBWin"
and change
.lpszClassName = classname
to
.lpszClassName = @classname
BTW you're posting incomplete code, so nobody can test it.
declare function CreateWindowExA(byval dwExStyle as DWORD, byval lpClassName as LPCSTR, byval lpWindowName as LPCSTR, byval dwStyle as DWORD, byval X as long, byval Y as long, byval nWidth as long, byval nHeight as long, byval hWndParent as HWND, byval hMenu as HMENU, byval hInstance as HINSTANCE, byval lpParam as LPVOID) as HWND
What are you doing with?
dim classname as any ptr
dim cname as string
cname = "FBWin"
classname = strptr(cname)
You can simply do
dim classname as zstring * 6 = "FBWin"
and change
.lpszClassName = classname
to
.lpszClassName = @classname
BTW you're posting incomplete code, so nobody can test it.
Re: Control ID..which type?
Ok
it seems that returned hendler of CreateWindowEx in FB must be HWND ..why is that i am not sure?
ok this work
thanks for replays..
so i will use same method for scintilla id..because it looks that is the only way
it seems that returned hendler of CreateWindowEx in FB must be HWND ..why is that i am not sure?
ok this work
thanks for replays..
Code: Select all
dim static1 as HWND
dim static1_id As Long
static1_id = 500
static1 = CreateWindowEx ( 0, "static", "" , WS_Border or WS_VISIBLE Or WS_CHILD , 10 , 10 , 100 , 100 , hWnd,cast(HMENU,static1_id), 0,byval NULL)
Re: Control ID..which type?
BUT
i just found here on forum one old topic about Richedit control where is handler a Integer
this is the way i am more familiar..
i just found here on forum one old topic about Richedit control where is handler a Integer
this is the way i am more familiar..
Code: Select all
DIM hRich1 AS INTEGER
hLib = LoadLibrary("RICHED32.DLL")
hRich1 = CreateWindowEx(WS_EX_CLIENTEDGE, "RichEdit", "", WS_CHILD OR WS_VISIBLE OR _
WS_CHILD OR WS_VISIBLE OR WS_TABSTOP OR WS_VSCROLL OR ES_WANTRETURN OR ES_AUTOVSCROLL OR _
ES_MULTILINE OR ES_NOHIDESEL OR ES_SAVESEL OR ES_DISABLENOSCROLL, _
10, 148, 475, 361, hDlg, 101, 0, BYVAL NULL)
SendMessage hRich1, EM_SETSEL, 1, 1 ' to reset pos/selection in text
SendMessage hRich1, EM_SCROLLCARET, 0, 0 ' Make caret scroll into view..
SendMessage hRich1, EM_SETOPTIONS, ECOOP_OR, ECO_SELECTIONBAR
SendMessage hRich1, EM_SETMARGINS, EC_LEFTMARGIN, 0 'Set Left Margin