Hi there...
Here we go:
I wrote a custom control which is compareable with an edit control and
it is called CEE. So much for the class CEECLIENT
The code is taken partwise from the PBNote example.
Now the problem:
If I use the GetOpenFileName to select a text file and load this
file into my custom control by sending the message %CEE32EM_INSERTTXTFILE
the control is dead after a few seconds.
If I do not use the GetOpenFilename and load the text file directly
the control is working.
Is there something wrong in the following snippet? - Any ideas?
Oh, if I use the predefined function OpenFileDialog() from the
'comdlg32.inc' file the result is the same.
.
.
.
CASE %IDM_NEW
hMdi = CreateMdiChild("CEECLIENT", hWndClient, "", 0)
ShowWindow hMdi, %SW_SHOW
'EXIT FUNCTION
CASE %IDM_OPEN
Path = "c:\windows\desktop\"
f = "email.txt"
Style = %OFN_FILEMUSTEXIST OR %OFN_HIDEREADONLY OR %OFN_LONGNAMES
DIM ofn AS OPENFILENAME
DIM fa AS ASCIIZ * %MAX_PATH
DIM pa AS ASCIIZ * %MAX_PATH
DIM flt AS ASCIIZ * 256
DIM tit AS ASCIIZ * 256
fa = f + CHR$(0)
pa = path + CHR$(0)
flt = "Textfiles (*.txt)|*.txt|All files (*.*)|*.*" + CHR$(0)
REPLACE "|" WITH CHR$(0) IN flt
tit = "Open file" + CHR$(0)
ofn.lStructSize = SIZEOF(ofn)
ofn.hwndowner = hWndMain
ofn.lpstrInitialDir = %NULL
ofn.lpstrFile = VARPTR(fa)
ofn.nMaxFile = %MAX_PATH
ofn.lpstrFilter = VARPTR(flt)
ofn.nFilterIndex = 1
ofn.hInstance = hInst
ofn.Flags = Style
ofn.lpstrTitle = VARPTR(tit)
retVal = GetOpenFileName(ofn)
IF retVal THEN
f = fa
hMdi = CreateMdiChild("CEECLIENT", hWndClient, "", 0)
ShowWindow hMdi, %SW_SHOW
CALL UpdateWindow(hMdi)
retVal = SendMessage(GetEdit, %CEE32EM_INSERTTXTFILE, STRPTR(f), LEN(f))
END IF
.
.
.
l8er
---Tom
------------------
[email protected]
Here we go:
I wrote a custom control which is compareable with an edit control and
it is called CEE. So much for the class CEECLIENT
The code is taken partwise from the PBNote example.
Now the problem:
If I use the GetOpenFileName to select a text file and load this
file into my custom control by sending the message %CEE32EM_INSERTTXTFILE
the control is dead after a few seconds.
If I do not use the GetOpenFilename and load the text file directly
the control is working.
Is there something wrong in the following snippet? - Any ideas?
Oh, if I use the predefined function OpenFileDialog() from the
'comdlg32.inc' file the result is the same.
.
.
.
CASE %IDM_NEW
hMdi = CreateMdiChild("CEECLIENT", hWndClient, "", 0)
ShowWindow hMdi, %SW_SHOW
'EXIT FUNCTION
CASE %IDM_OPEN
Path = "c:\windows\desktop\"
f = "email.txt"
Style = %OFN_FILEMUSTEXIST OR %OFN_HIDEREADONLY OR %OFN_LONGNAMES
DIM ofn AS OPENFILENAME
DIM fa AS ASCIIZ * %MAX_PATH
DIM pa AS ASCIIZ * %MAX_PATH
DIM flt AS ASCIIZ * 256
DIM tit AS ASCIIZ * 256
fa = f + CHR$(0)
pa = path + CHR$(0)
flt = "Textfiles (*.txt)|*.txt|All files (*.*)|*.*" + CHR$(0)
REPLACE "|" WITH CHR$(0) IN flt
tit = "Open file" + CHR$(0)
ofn.lStructSize = SIZEOF(ofn)
ofn.hwndowner = hWndMain
ofn.lpstrInitialDir = %NULL
ofn.lpstrFile = VARPTR(fa)
ofn.nMaxFile = %MAX_PATH
ofn.lpstrFilter = VARPTR(flt)
ofn.nFilterIndex = 1
ofn.hInstance = hInst
ofn.Flags = Style
ofn.lpstrTitle = VARPTR(tit)
retVal = GetOpenFileName(ofn)
IF retVal THEN
f = fa
hMdi = CreateMdiChild("CEECLIENT", hWndClient, "", 0)
ShowWindow hMdi, %SW_SHOW
CALL UpdateWindow(hMdi)
retVal = SendMessage(GetEdit, %CEE32EM_INSERTTXTFILE, STRPTR(f), LEN(f))
END IF
.
.
.
l8er
---Tom
------------------
[email protected]
Comment