NO

Recent Posts

Pages: 1 2 3 [4] 5 6 ... 10
31
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
32
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

33
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();
34
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
35
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.
36
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.
37
General discussion / Re: Top Programming languages 2023 Survey
« Last post by WiiLF23 on February 29, 2024, 09:16:47 PM »
If I hear about Rust one more time... I'll implode lol (jokes). But seriously.

Next will be Python competing with Rust, now that they are considering moving to this language in the Linux codebase (memory safety, etc)

I am blind to the first 2 in the list, I am fluent in the rest for many years now. PHP and C until the day I no longer touch a keyboard  8)

PHP has a lot of issues, but it has really become a solidified player since PHP 7 (I started using it since 5.6), and is much faster now. The async support is next to a laugh. I leave that up to PECL now for heavy multi-threaded tasks. Of course, this expects a thread-safe compilation. I hope it improves. I know they push out Fibres support, but I have not played with it because I don't feel like rewriting core classes to accommodate the new feature and experience breakage across the board. Very risky for critical cron tasks that should not be interrupted and get out of sync at a large scale. The PECL parallel extension works fine for me.

String/array manipulation is beyond easy and I am very pleased with the OpenSSL support (my app appreciates it too).

SQL is SQL. I can write it blind, but the focus is the RDMS and its engine performance long before advanced syntax. The rest falls into place quite easily, and is hand in hand with multiple languages.

I'll never touch Python or Java. But Java was my entry to ASM and other learning curvs in the early 2000s ironically. I never stayed with it, I peeled off to web technologies at the time and shaped my learning. Today its second nature.



38
User contributions / Re: Enable Dark Mode for Title bar
« Last post by WiiLF23 on February 29, 2024, 09:00:19 PM »
Looking good John Z.

I've been off the map for a bit (literally), and I am very thankful I produced the app to accommodate mass interruption. This leaves me with 1 foot in the door and the other pending for an undetermined timeframe.

I guess this is time to dig even deeper in C programming, and provide what I learn and prove possible.

I know it is not the end. I just have massive hopes and dreams, and it is hard for one person to pull it off on this scale.

Wish me luck!
39
Announcements / Re: Server outage today
« Last post by WiiLF23 on February 29, 2024, 08:55:46 PM »
Leverage caching while your at it. And it would be highly beneficial to move to FastCGI (php-fpm).

VB should support the 3 main caching methods for PHP. Opcache, memcached, etc.

Lastly, the latency seems fine but other than the forum script itself, it would do just fine on a VPS if on a budget. I don't know how it is performing as of current, but keeping a note on the CPU usage and database load will direct those in charge in a solid direction.

I would personally TAR/GZ the entire www root, so you retain file system permissions and extract that on the new hosts disk (so you rid yourself of CHMOD duties later). It saves a great deal of time.

God luck!
40
Announcements / Re: Server outage today
« Last post by Marco on February 29, 2024, 10:41:12 AM »
I echo John's thanks.
Pages: 1 2 3 [4] 5 6 ... 10