Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - mekanixx

Pages: [1]
1
User Contributions / ListView SubClass Demo with "in place" Editing
« on: November 11, 2023, 03:22:54 PM »
Hi All,
I needed a listview that could be edited in place for a project so I whipped this up. I thought someone else might benefit from it so here is the code. I added some notes on how to use the code in the files along with the MIT license. Enjoy!

Doyle

Edit: New code uploaded with MrBCX's suggestions applied.


2
Wish List / BcxSplitPath
« on: April 23, 2023, 04:08:14 PM »
Hi folks,

Could we get an option for BcxSplitPath to drop the "." when returning FEXT? I'm using this quite a bit and following with a line to remove the "." is getting old! :)

Not to mention when I forget that last line!

Code: [Select]
ext$ = BCXSPLITPATH$(filename$, FEXT)
IF INSTR(ext$, ".") THEN REMOVE "." FROM ext$

Something like:

Code: [Select]
BCXSPLITPATH$(filename$, FEXT [, bRemove])
where if bRemove is TRUE/FALSE (or 1/0) to remove the "." or keep as is.

If not I might have a crack at it but you guys know c way better than I do.

Thanks,
Doyle




3
Questions & Answers / MingW64
« on: January 02, 2023, 10:32:48 PM »
Hi All,

I'm looking to upgrade my MingW64. Which/where to get the best distribution? What do you recommend?

TIA,
Doyle

4
User Contributions / New Grid Demo
« on: December 23, 2022, 06:37:00 PM »
This is a demo of the free ZeeDrid64.dll located at https://www.kycsepp.com/zeecontrols/.
There is also a 32 bit version of the dll in the download. The docs are only on the web site
with no seperate download (that I could find).

Beware the 64 bit dll in the download does not have the resources compiled into it. I used
Resource Hacker and copied the resources into the 64 bit dll from the 32 bit dll.
Gotta love Resource Hacker!

There are several more types of controls that you can use in the cells that are not shown here.
There are checkbox, combobox, edit, calendar, button, etc.


Enjoy this early Christmas present!
Doyle Whisenant
Mekanixx Software - 12/23/2022

5
User Contributions / Menu Maker 2.0
« on: December 07, 2022, 06:38:12 PM »
Hello folks,

Welcome to Menu Maker 2.0! This is an updated version of the MenuMaker program I
wrote back in 2001 or so. Please read the Readme.txt file to get started using Menu Maker 2.0.

Code: [Select]
        1. Creates an "BCXMenu.inc" file to include directly into your source *.bas file.
2. Copies the source into the clipboard to paste into your file.
3. Use a treeview so images can be used for menu items.
4. You can drag and drop menu items in the treeview.
5. Right click for a context menu for deleting items.
6. Includes the ability to use bitmap items in your menus.
            (MrBCX, I like a challenge) :)
7. Loads bitmaps from files instead of using resources.
            You can choose your own bitmaps and add/delete these as you like.
            Any *.bmp files in the "bmp" folder will automatically load at startup.
8. Save/Reload menu file when doing large menus.
        9. If there is not a menu caption you want to use, you can click in the combo
            edit box and enter whatever you need. It will be used for your menu name.
      10. A data file ("mm2.dat") has a list of menu names and shortcuts .
           These can be edited to include any menu names or shortcuts not included.
           Change to your menu names.
 

 Consider this an alpha version as I'm sure there are bugs.
 Have fun!

Doyle

6
User Contributions / Themer - A Theme file editor for BED and derivatives
« on: November 09, 2022, 03:33:28 PM »
Themer a theme file editor for BED. I threw this together in a couple of days so probably has it's fair share of bugs...   I did change the style file extension from "*.txt" to "*.style". If this doesn't work for you, well you have the source code.  :)  I used Visual Studio 2022 v17.2.4 to compile. Source code and a compiled exe are included in the zip file. I added a "Readme.txt" file so read that before asking why it doesn't compile for you.  ;D

Get it here: https://app.box.com/s/2o72erxa2kvcbgltbkl8stmjpsu3zo4y

Enjoy!
Doyle

7
Tips & Tricks / Got a memory leak? Try this.
« on: May 30, 2022, 02:06:46 PM »
Hello, I found a simple way to check your programs for memory leaks. All you need to do is include the *.h file at the URL below with your code and call dumpUnfreedMemory() when your program exits and it dumps the error messages to stderr.

Code: [Select]
https://avdongre.wordpress.com/2012/08/09/finding-memory-leak-in-c-application-on-windows/
I tried it and it seems to work ok but it's not been heavily tested by me. YMMV

Have fun,
Doyle


8
Bug Reports / Version 7.8.6 has a bug...
« on: May 10, 2022, 10:28:22 AM »
Hello Kevin,

It seems  Version 7.8.6 (05/08/2022) has a buggy translation:

This code:
 
Code: [Select]
JSObjectSetProperty(ctx, JSContextGetGlobalObject(ctx), jname, func, 0, 0)

translates to:

 JSObjectSetSUB(ctx,JSContextGetGlobalObject(ctx),jname,func,0,0);

Note the "SUB" in the translated line.  Version 7.8.5 (04/12/2022) translates it correctly.

 
Code: [Select]
JSObjectSetProperty(ctx, JSContextGetGlobalObject(ctx), name, func, 0, 0);
Thanks,
Doyle






9
Questions & Answers / A question for Robert
« on: April 07, 2022, 01:27:54 PM »
Hello Robert,

First of all - thanks for the work you do on keeping the BCX Help up to date. I appreciate it.  Now my question: Do you have a recent copy of the help sources uploaded anywhere? If  not could I persuade you to send me a copy?

I would like the sources to create an api file for my editor. Basically this api file gives me calltips and auto completion popups for BCX (or other) code.

Thanks again,
Doyle

10
Questions & Answers / 64 bit DLL Example, anyone?
« on: March 01, 2022, 06:31:01 PM »
Well I've messed with this a while now with no luck. Does anyone have any working code they would share?

I've tried MSVC, Pelles C and Mingw64. Your compiler and linker command lines would be useful too. I'm trying the files in the BCX Distribution DLL_Demo folder Byref-Bc if that helps.

DLL code:

Code: [Select]
$NODLLMAIN
$DLL

Sub Mult ( A![], B![], C![], Count)
Local N
For N = 1 To Count
  C[N] = A[N] * B[N]
Next
End Sub

Test Code:

Code: [Select]
$HEADER
extern void  Mult(float*,float*,float*,int);
$HEADER

Sub Multipl (A![], B![], C![], Count)

Dim a![11]
Dim b![11]
Dim c![11]

Dim q

For q = 1 to 10
  a![q] = q * 1.1
  b![q] = q * 2.2
Next


Mult ( &a![0], &b![0], &c![0] , 10 )


For q = 1 to 10
  ? c![q]
Next
End Sub

I get the dll but the test fails with:

Code: [Select]
Translating C:\BCX\DLL_Demo\Byref-Bc\Test.bas...
Pelles C is compiling C:\BCX\DLL_Demo\Byref-Bc\Test as a 64-bit console app...
POLINK: error: Unresolved external symbol 'Mult' - referenced from 'C:\BCX\DLL_Demo\Byref-Bc\Test.obj'.
POLINK: fatal error: 1 unresolved external(s).

Thanks,
Doyle


11
Wish List / Hello again!
« on: February 19, 2022, 09:35:33 PM »
Hi Guys,

Recently I've been working on a little app and wanted the listboxes to be ownerdrawn. After a long session of trying this and that I found that it worked using BCX_WND and friends. I was using a splitter and could not get it to work here. So back to FORMLOAD as usual. For the life of me I could never get the WM_MEASUREITEM or WM_DRAWITEM message to work.

So I looked into the bc.bas source code and found that when using a splitter the SplitterWndProc didn't forward the WM_MEASUREITEM or WM_DRAWITEM message back to the main WinProc. Ah Ha!

So I Added the following line at line no:29684 in version 7.8.1 (02/07/2022)

Code: [Select]
     
      FPRINT FP_WRITE, "     msg==WM_MEASUREITEM||msg==WM_DRAWITEM)"     

The complete section looks like so:

Code: [Select]
      FPRINT FP_WRITE, "     if (msg==WM_COMMAND||msg==WM_NOTIFY||msg==WM_HSCROLL||msg==WM_VSCROLL||msg==WM_CTLCOLOREDIT||"
      FPRINT FP_WRITE, "     msg==WM_CTLCOLORSTATIC||msg==WM_CTLCOLORBTN||msg==WM_CTLCOLORLISTBOX||msg==WM_CTLCOLORSCROLLBAR||"
      FPRINT FP_WRITE, "     msg==WM_MEASUREITEM||msg==WM_DRAWITEM)"     

I then compiled the source and replaced it as my bc.exe and Woohoo! It all worked a treat.

So my question, can this be added to BCX?

Thanks,
Doyle

12
User Contributions / Regarding dictionaries...
« on: February 04, 2022, 12:53:27 PM »
Below is a set of routines for a simple dictionary that is based on c code by Paul Hankin found on stackoverflow:

https://stackoverflow.com/questions/4384359/quick-way-to-implement-dictionary-in-c

I'm sure that it could be improved by some of the guru's here. Anyways, enjoy.

Code: [Select]
'*************************************************************************************
'Paul Hankin
'https://stackoverflow.com/questions/4384359/quick-way-to-implement-dictionary-in-c
'                   Converted to BCX by Doyle Whisenant Feb 2022
'*************************************************************************************

TYPE DICT_ENTRY
   DIM key   AS LPCCH
   DIM value AS LPCCH
END TYPE

TYPE DICT
   DIM length AS INTEGER
   DIM cap    AS INTEGER
   DIM entry  AS DICT_ENTRY PTR
END TYPE

FUNCTION DictFindIndex(d AS DICT PTR, key AS LPCCH) AS INTEGER
DIM i
FOR i = 0 TO d->length - 1
   IF NOT strcmp(d->entry[i].key, key) THEN
      FUNCTION = i
   END IF
NEXT i
FUNCTION = -1
END FUNCTION

FUNCTION DictFind$ (d AS DICT PTR, key AS LPCCH) 
DIM idx
idx = DictFindIndex(d, key)
IF idx = -1 THEN
   FUNCTION = NULL
ELSE
   FUNCTION = d->entry[idx].value
END IF
END FUNCTION

FUNCTION DictAdd(d AS DICT PTR, key AS LPCCH, value AS LPCCH) AS BOOL
DIM idx
idx = DictFindIndex(d, key)
IF idx <> -1 THEN
   d->entry[idx].value = value
   FUNCTION = TRUE
END IF
IF d->length = d->cap THEN
   d->cap *= 2
   d->entry = (DICT_ENTRY*)realloc(d->entry, d->cap * SIZEOF(DICT_ENTRY))
   IF NOT d->entry THEN FUNCTION = FALSE
END IF
d->entry[d->length].key = _strdup(key)
IF NOT d->entry[d->length].key THEN FUNCTION = FALSE
d->entry[d->length].value = _strdup(value)
IF NOT d->entry[d->length].value THEN FUNCTION = FALSE
d->length++
FUNCTION = TRUE
END FUNCTION

FUNCTION DictNew() AS DICT PTR
DIM proto AS DICT
DIM d AS DICT PTR
proto.length = 0
proto.cap    = 10
proto.entry  = (DICT_ENTRY*)malloc(10 * SIZEOF(DICT_ENTRY))
d = (DICT*)malloc(SIZEOF(DICT))
*d = proto
FUNCTION = d
END FUNCTION

SUB DictFree(d AS DICT PTR)
   DIM i
   FOR i = 0 TO d->length - 1
  !free((void*)d->entry[i].key);
   NEXT i
!free(d->entry);
!free(d);
END SUB



Sample of use:

Code: [Select]
dim d as DICT PTR
dim i

d = DictNew()

DictAdd(d, "1",    "value1")   ' Index 0
DictAdd(d, "key2", "value2")   ' Index 1
DictAdd(d, "33",   "value3")   ' Index 2
DictAdd(d, "key4", "value4")   ' Index 3

i = DictFindIndex(d, "key4")                                    ' Return 3
MSGBOX ("key4 found in index:" + STR$(i))

MSGBOX ("Key 33 contains the value: " + DictFind$(d, "33"))     ' Return "value3"
DictFree(d)


Maybe this will be useful for someone.
Doyle


( Updated by MrBcx )

13
Questions & Answers / Newbie Help Needed :)
« on: February 02, 2022, 09:38:05 PM »
Hello guys and gals, long time. I recently bought a new computer and thought I'd try some Win 10 programming again. I've been using Linux Mint for several years now so my Win programming is a tad rusty. Anyway, on to the topic at hand...

I have the following program:

Code: [Select]
GUI "Test Form"

CONST ID_FORM = 100
GLOBAL Form1 AS HWND

SUB FORMLOAD

  Form1 = BCX_FORM ("Test Form",0, 0, 640, 480, 0)

  CENTER(Form1)
  SHOW(Form1)

END SUB

Yeah, super simple or so I thought. When using the latest 64bit BCX (also tried 32bit) and the latest 64bit Pelles C, I get the following errors:

Code: [Select]
Compiling C:\BCXProj\DictTest.c as a windows app...
C:\BCXProj\DictTest.c(418): error #2048: Undeclared identifier 'WndProc' (did you mean: ?).
C:\BCXProj\DictTest.c(418): error #2140: Type error in argument 2 to 'BCX_RegWnd'; expected 'WNDPROC (aka long int __stdcall (*)(struct HWND__ *, unsigned int, unsigned int, long int))' but found 'int'.


Portions of my batch file. This is probably my problem since I haven't been around for the 64bit Windows compilers/linkers.

Code: [Select]
%PELLESPATH%pocc.exe  /W0 /Go /Gd /Ze /Zx /MT /Zi /Tx86-coff %1.c
%PELLESPATH%polink.exe /release /machine:ix86 /subsystem:windows %1.obj %PRES% /out:%1.exe

So where did I go wrong? TIA
Doyle


14
Questions & Answers / C break statement
« on: September 25, 2021, 02:49:15 PM »
Hey folks,

What is the BCX equivalent to the break statement in the following c code?

Code: [Select]
  if (max_line >= INI_MAX_LINE)
          break;

Thanks,
Doyle

15
Questions & Answers / BCX Code Beautifier?
« on: February 19, 2020, 03:34:47 PM »
Hello guys,

I think I have seen a program to "Beautify" basic code somewhere, but can't seem to find anything in my archives. Anyone got anything like that they would be willing to share? Ian and I are working on my BCXIDE code and it's a mess.

Thanks,
Doyle

Pages: [1]