• Welcome to PlanetSquires Forums.
 

CWindow dwExStyle

Started by James Fuller, June 04, 2016, 09:15:18 AM

Previous topic - Next topic

James Fuller

Jose,
  My tests with the Fb Richter layout code shows significant less flicker with WS_EX_COMPOSITED added to your
default CWindow dwExStyle. Might be a good addition to the CWindow class default.

James

José Roca

Can't be used willy-nilly. If you want to use it, specify it in the window creation or calling the AfxAddWindowExStyle function.

José Roca

Hi James,

Can you make a library for FreeBASIC (both 32 and 64 bit) from Propsys.dll?

This library is essential to work with variants and propvariants and it is missing.

James Fuller

Quote from: Jose Roca on June 04, 2016, 10:45:38 PM
Hi James,

Can you make a library for FreeBASIC (both 32 and 64 bit) from Propsys.dll?

This library is essential to work with variants and propvariants and it is missing.

I took a quick look and I can see why there is not an Fb version. Many includes from Propsys.h which has close to 5k lines of code itself.
I'm afraid gcc does not have very good COM support.
I think the only(?) approach would be DyLibLoad and DyLibSymbol.

James


José Roca

I'm only asking for the import libraries. I can deal with the headers myself.

If I'm not wrong, we need to to do something like

reimp -d propsys.lib
dlltool -k -d propsys.def -l libpropsys.a

But to make life easy, reimp does not come with FreeBASIC. It is a MinGW tool.

James Fuller

Jose,
  Try this for 64bit.

James

José Roca

#6
Does not compile. The linker fails.

compiling C:  C:\Users\Pepe\FreeBASIC64\bin\win64\gcc.exe -m64 -march=x86-64 -S -nostdlib -nostdinc -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-main -Werror-implicit-function-declaration -O0 -fno-strict-aliasing -frounding-math -fno-math-errno -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -masm=intel "2.c" -o "2.asm"
assembling:   C:\Users\Pepe\FreeBASIC64\bin\win64\as.exe --64 --strip-local-absolute "2.asm" -o "2.o"
linking:      C:\Users\Pepe\FreeBASIC64\bin\win64\ld.exe -m i386pep -o "2.exe" -subsystem windows "C:\Users\Pepe\FreeBASIC64\lib\win64\fbextra.x" --stack 1048576,1048576 -s -L "C:\Users\Pepe\FreeBASIC64\lib\win64" -L "." "C:\Users\Pepe\FreeBASIC64\lib\win64\crt2.o" "C:\Users\Pepe\FreeBASIC64\lib\win64\crtbegin.o" "C:\Users\Pepe\FreeBASIC64\lib\win64\fbrt0.o" "2.o" "-(" -lkernel32 -lgdi32 -lmsimg32 -luser32 -lversion -ladvapi32 -limm32 -lcomctl32 -luuid -lole32 -loleaut32 -lpropsys -lshlwapi -lshell32 -lfb -lgcc -lmsvcrt -lmingw32 -lmingwex -lmoldname -lgcc_eh "-)" "C:\Users\Pepe\FreeBASIC64\lib\win64\crtend.o"
linking failed: 'C:\Users\Pepe\FreeBASIC64\bin\win64\ld.exe' terminated with exit code 1

James Fuller

Jose,
  I'm not too surprised it did not work. None of the compilers PellesC or MingGW have a library for that dll. Only VC++
They do have include files and it appears the dll exports c++ classes as well as functions.
I have a utility with TinyC that scans dll's for their type of library file and both the 64 and 32 bit utility fail with propsys.dll
You probably will have to go the DyLibLoad DyLibSymbol route.
James

José Roca


James Fuller

Jose,
  What is all the text from in your previous message?
I tried using #inclib "propsys" in an Fb app and it gave no messages, but of course I did not call any function in the dll.

James


José Roca

> What is all the text from in your previous message?

The messages of the compiler.

> I tried using #inclib "propsys" in an Fb app and it gave no messages, but of course I did not call any function in the dll.

If you don't call any function, the linker is not going to use the library.

James Fuller

Jose,
  Would you post a small sample source using propsys.
Id like to whack on library creation a bit.

James

José Roca

#12
Now that I have deleted everything...

Something like

File: Propvarutil.bi


#inclib "propsys"

extern "Windows"

DECLARE FUNCTION VariantGetElementCount (BYVAL varIn AS VARIANT PTR) AS ULONG

end extern



#include "windows.inc"
#nclude once "win/ole2.bi"
#include "Propvarutil.bi

CoInitialize NULL

DIM v AS VARIANT
DIM n AS ULONG = VariantGetElementCount(@v)

CoUninitialize


James Fuller

Jose,
  No errors with this one and that snippet.
The first was created with the reimp from the link with no options. It does the whole dlltool itself.
This version was created with the instructions you gave.
I removed the last entry in the def file which was definitely VC only as it referred  to the RT, and then ran dlltool.
TA-DA.
If there still are problems I think I could create a def file with just the functions you need removing all the interface items.
I probably could parse your PB propsys.inc for the function names.

James

José Roca

It works. Congratulations!

Can you make another for 32-bit, please.

I will prepare an include file with the function declares and constants, and also the inline functions.

I had replaced already some of the functions with procedures written with FB, but the ones that deal with arrays are difficult to code.

After many headaches, I finally have decided to use AFX_BSTR (defined as WSTRING PTR) for the functions that return text, e.g.


' ========================================================================================
' Gets the text of a window or control.
' Note: GetWindowText cannot retrieve the text of a control in another application.
' Usage examples:
' DIM pbstr AS AFX_BSTR = AfxGetWindowText(hButton)
' MessageBoxW 0, pbstr, "", MB_OK
' SysFreeString pbstr
' -or-
' DIM cb AS CBSTR = AfxGetWindowText(hButton)
' MessageBoxW 0, *cb, "", MB_OK
' ========================================================================================
PRIVATE FUNCTION AfxGetWindowText (BYVAL hwnd AS HWND) AS AFX_BSTR
   DIM nLen AS LRESULT = SendMessageW(hwnd, WM_GETTEXTLENGTH, 0, 0)
   IF nLen = 0 THEN EXIT FUNCTION
   DIM pbuffer AS WSTRING PTR = CAllocate(nLen + 1, 1)
   nLen = SendMessageW(hwnd, WM_GETTEXT, nLen + 1, CAST(LPARAM, pbuffer))
   IF pbuffer THEN
      DIM pbstr AS AFX_BSTR = SysAllocString(pbuffer)
      FUNCTION = pbstr
      Deallocate pbuffer
   END IF
END FUNCTION
' ========================================================================================