NO

Recent Posts

Pages: 1 ... 8 9 [10]
91
Work in progress / Re: High Performance 64-bit CPU Design
« Last post by WiiLF23 on March 08, 2024, 08:24:58 PM »
Designing and implementing a custom operating system is discussed very thoroughly over YouTube. You'll likely be using fat.c with some assembly for the boot loader, registers and more. I would personally be more focused on the OS design, and basic hardware support before consulting a OS-dependent language, which I personally feel would be a logical choice in the full implementation of XYZ OS.

Windows core code never left C/ASM, so I would personally maintain these language fundamentals in the overall design.

Finally, it has already been done. This is called "TempleOS". 100% unique and not a derivative of any UNIX flavor.

Interesting story on this. HolyC (or C+) became the language the OS was written in, as well as the applications within the OS.

This may point the direction of what can be done. This one guy did it all by himself, period. It can be done. He had effective schizophrenia disorder, which just blows my mind. He is no longer with us.

"TempleOS is a 64-bit, non-preemptive multi-tasking, multi-cored, public domain, open source, ring-0-only, single address space, non-networked, PC operating system for recreational programming."
92
Beginner questions / Re: Select text for clipboard
« Last post by WiiLF23 on March 08, 2024, 06:38:55 PM »
I don't really understand the request here, but I am assuming a contextmenu or control that acts as a Copy/Paste for the target string (from Edit control or already stored in clipboard). Obtaining text from Edit control is easy, and you can also "watch" events such as focus and update (this is where you can count string length to perform checks, copy string or simply read string from Edit control among other actions).

This is how I pulled off a responsive Edit control (like typing into Facebook search, same idea - visually). And these events are required for this in my journey:

WM_LBUTTONDOWN
EN_SETFOCUS
EN_KILLFOCUS
EN_CHANGE


eg.
Code: [Select]
case WM_COMMAND:
     case MY_TEXT_CTRL: {
          switch (GET_WM_COMMAND_CMD(wParam, lParam)) {
               case EN_CHANGE: { ... break; }
               // Add more cases
               default:
                    break;
          }
     }
     break;

Just stuff to help. Any string copied into the clipboard is replaced with a new one effectively replacing the last string stored. This applies to OS in general, and all data types it supports for clipboard. Windows also watches and sanitizes copied objects and other data to ensure integrity and security. So it knows when a image is copied from the desktop (BLOB data likely) which allows to insert the image data into accepting applications (like Irfanview), etc.

Strings should be the easiest to work with.
93
Beginner questions / Re: Select text for clipboard
« Last post by DonnyDave on March 08, 2024, 05:55:57 PM »
John,
That's correct, I want to incorporate into a win10 prog. I'm about to write (using Pelles C).
Dave
94
Beginner questions / Re: Select text for clipboard
« Last post by John Z on March 08, 2024, 11:10:56 AM »
Hi DonnyDave,

Checking for understanding  -
You are envisioning that a program you wrote is running on a windows system.  This programs purpose is to allow the highlighting of any text displayed on the window screen from anything that is open and displaying some text in its own program?  It does this by first allowing the highlighting of the text using the mouse, then Ctrl+C is executed to copy to the clipboard.....

So -   Several huge hurdles to overcome, imo.

As an initial thing there is the fact that everything shown on the windows screen is only a picture composed of pixels.  There is actually no 'text' available on the screen there are only pictures of text shown.  It is the underlying program that retains/creates the text in 'characters' that are then transformed into pixels and drawn in the programs window display space. This is unlike days of old where the screen was actually a character map of say 24 x 80 that was actually filled with the 'character' to be displayed ie an 'A' in row 1 column 1 was a value of 65 which is capital A.  The underlying screen map could be accessed by any program.

So for your program to use the mouse to highlight some text in my program window you would need to have access to the underlying programs storage of the text being displayed so that character could be retrieved instead of a picture of the characters.

The next hurdle is the once the mouse is over a programs windows space that program controls what the mouse can do.  If hovering over my program and I don't have a routine to do highlighting, or changed the action of the mouse buttons, then there is no way for your program to do that highlighting without developing a hook or other method to intercept the mouse and do your task before sending the mouse to the underlying program. It is the same with the keyboard btw.  When over a programs window the keystrokes go to that window, so there would need to be a hook for that too...

There are intricate ways of doing some of the above but they are very involved. 

It would be a lot easier to program a screen capture program (there are many already) then send the screen picture through an OCR program to recover the 'text' as characters.

Hopefully I've not misunderstood your intention and just went on and on for nothing  ;D

John Z

95
Beginner questions / Re: Select text for clipboard
« Last post by DonnyDave on March 07, 2024, 01:00:04 PM »
Hi John,
"Text from screen" could be any text on anything ( eg. https://forum.pellesc.de/index.php?action=post;topic=11150.0;last_msg=39148 )
LH Mouse anywhere in any text,
LH Mouse drag to anywhere else in the text, (selected portion goes to inverse video),
Ctrl C to copy selected to clipboard.

Dave
96
Beginner questions / Re: Select text for clipboard
« Last post by John Z on March 07, 2024, 12:06:55 PM »
Hi DonnyDave,

Welcome to the forum.

To try to answer your question a clarification is needed.
How do I select part of on screen text using  left mouse/drag ?

Can you clarify this?  What text from the 'screen', from some user open program, from the windows display, from your own windows program text display?

for example for a edit box you might use
Code: [Select]
  lHWND = GetDlgItem(gHWND, idCtrl);
  long long int tsize = SendMessageW(lHWND, WM_GETTEXTLENGTH, 0, 0);
  if (tsize > 0)
  {
    wchar_t *p_buffer = malloc((tsize * 4 * sizeof(wchar_t)) + 20);
    RetVal = SendMessageW(lHWND, WM_GETTEXT, tsize + 1, (LPARAM)p_buffer);
Now text is in p_buffer which can then be sent to the clipboard. 

You can also limit selection by asking for or setting selected text by SendMessage..to the control for example
Code: [Select]
SendMessage(lHWND, EM_GETSEL, (WPARAM)&Cstart, (LPARAM)&Cend);



John

97
Beginner questions / Select text for clipboard
« Last post by DonnyDave on March 05, 2024, 11:43:27 AM »
I'm trying to replicate the standard Win10 Cut/Copy/Paste.
In the code below all of pString goes into the clipboard.
How do I select part of on screen text using  left mouse/drag ?
I've searched Petzold and Google and found nothing useful.

  char* pGlobal;
  char* hGlobal;
  char pString[] = "Testing, Testing 123";
  char* pStringptr;
  int i;
 
hGlobal = GlobalAlloc(GHND | GMEM_SHARE, 50);
  if(hGlobal == 0)
    ErrorMessage("1");

  pGlobal = GlobalLock(hGlobal);
  if(pGlobal == 0)
    ErrorMessage("2");

  pStringptr = pString;
  for(i=0 ; i < 20 ; i++)
    *pGlobal++ = *pStringptr++;  //  Copy text to global mem.

  GlobalUnlock(hGlobal);
  OpenClipboard(hwnd);
  EmptyClipboard();

  SetClipboardData(CF_TEXT, hGlobal);
  CloseClipboard();
98
Assembly discussions / Re: printf implementation
« Last post by Vortex on March 03, 2024, 11:13:40 AM »
Converting real4 to real8 :

Code: [Select]
.486
.model flat,stdcall
option casemap:none

ExitProcess PROTO :DWORD
__p__iob PROTO C
vfprintf PROTO C :DWORD,:DWORD,:VARARG
printf   PROTO C :DWORD,:VARARG

includelib  kernel32.lib
includelib  msvcrt.lib

_iobuf STRUCT

    _ptr        DWORD ?
    _cnt        DWORD ?
    _base       DWORD ?
    _flag       DWORD ?
    _file       DWORD ?
    _charbuf    DWORD ?
    _bufsiz     DWORD ?
    _tmpfname   DWORD ?

_iobuf ENDS

FILE TYPEDEF _iobuf

.data

pi      real4 3.141592
format  db '%s is nearly equal to %f',0
str1    db 'Pi',0

.data?

pi8     real8 ?

.code

start:

    fld     pi
    fstp    pi8

    invoke  printf,ADDR format,ADDR str1,pi8
           
    invoke  ExitProcess,0

printf PROC C _format:DWORD,args:VARARG

    invoke  __p__iob

;   #define stdout (&__iob_func()[1])

    add     eax,SIZEOF(FILE)

    lea     ecx,args
    invoke  vfprintf,eax,_format,ecx
    ret

printf ENDP

END start
99
General discussion / Re: Top Programming languages 2023 Survey
« Last post by WiiLF23 on March 01, 2024, 08:32:37 PM »
Hi WiiLF23,

Quote
But Java was my entry to ASM

Kindly, could you provide more details? Assembly and Java are totally different worlds.

General logic, structure and how everything binds together - in any language. Just a learning curve. I learn by analyzing. They have no relation to each other, I agree. Also being young at the time, I was exploring everything in-between, including the operating system I was using at the time.
100
General discussion / Re: Top Programming languages 2023 Survey
« Last post by Vortex on March 01, 2024, 10:45:23 AM »
Hi WiiLF23,

Quote
But Java was my entry to ASM

Kindly, could you provide more details? Assembly and Java are totally different worlds.
Pages: 1 ... 8 9 [10]