Results 1 to 10 of 565

Thread: Tests Copying, Pasting, API Cliipboard issues. and Rough notes on Advanced API stuff

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    Page 4
    https://www.excelfox.com/forum/showt...PI-stuff/page4
    https://www.excelfox.com/forum/showt...ll=1#post17896
    https://www.excelfox.com/forum/showt...age3#post24934
    #post17896 , Thread2824 , Post 31



    Some notes related loosely to these forum posts
    https://eileenslounge.com/viewtopic....322955#p322955 https://eileenslounge.com/viewtopic....323065#p323065
    https://eileenslounge.com/viewtopic.php?f=30&t=41659

    https://www.excelfox.com/forum/showt...dows-API/page3
    https://www.excelfox.com/forum/showt...ll=1#post24934
    https://www.excelfox.com/forum/showt...age3#post24934
    post24934, Thread2989

    Theory Ælstein
    This is not necessarily a final answer, ( an unlikely to be the final word on the issue ), but this is an attempt to get the thing out, and keep it simmering while I take a break to write my Xmas cards. I have only looked in depth at less than a third of the book chapter

    API App message box renewed experiments
    Because I am new and still very flaky with API stuff, and because whilst on Panzer Schokolade a few years back, I got to know this API MessageboxAA very well, almost as well probably as a computer professional, exceptionally for Layman me, and as part of my recent API revision I revisited there.
    So let me see if I can apply some of my initial findings and solution/ Theory suggestions to that.
    In my research and experiments I went off in a tangent into very basic Unicode and ANSI/Ascii associated with VB strings and windoew32 API. In the long run, that may not be such a bad thing. The detailed discussions will be continued in more detail in this page 2 ++

    Some (Vague for now) thoughts / Clues gleaned from a week of research
    In no particular order, yet….
    ( These thoughts are given in more detail and better ordered in this page 2 ++ But it’s not finished yet. I have only looked in depth at less than a third of that book chapter
    _ Things windows API certainly where and in many ways still are, or efficiently use, ANSI. This does cause issues with String things
    _ The issues have been known about for over 20 years and we have things like strPtr extra made to help us, along with things like LongPtr which compliment it in some ways
    _ a VBA string variable is a pointer to a VB pointer which final points to some form or part of the final string you actually want. Pointing to a pointer is possibly not so bad, whereas mixing up a pointer with a string is more deadly.
    _** At some point in that book chapter , the author is hinting that his attempts to explain what is going on with existing VB documentation are his ideas and that other smart people were thinking something extra might be going on,
    _ Somewhat less known as it perhaps should be, … for almost, if not all, API functions/ Sub routines, there is two versions, denoted by the last character in the name of A and W. Very briefly W can be thought of as meaning Unicode, A as ANSI/Ascii. The W things are not so new….
    _ I noticed some strange things with types and type documentation. When considering string arguments, they seem to be wording things sometimes as if they are not talking about the string, but the pointer. I got some strange feeling that talking pointers is more low level, or more fundamental
    _ I notice some things giving me the string problem issues were actually, (not always), sometimes in documentation or in working API stuff, declared As Any when String was either more intuitive or more often used.

    My brain went off in some lateral thinking that rarely produce anything other than time and resource loss, but when they do 1 in 10 times produce something, it is usually more than worth the "lost" investment.



    What did I decide to look at, and why
    _ (For one thing the computer Unicode ANSI/Ascii very basics and History thereof. But maybe I may not have needed that if I was not so doubly ignorant in this area….)
    _ I decided to look in strings, and string types, and string related pointer things.
    _ I went off in an absurd diverse direction, thinking to get a way to do something involving a string by avoiding the string.


    ** As I went on, I started thinking that this original throw away thought of mine was not so bad after all …
    …....... the simple answer is that ByVal and ByRef behaviour in windows API Declare lines is different, at least with As String.. ….
    .... no one could figure out a more ordered logical well organised interface so the nearest looking combination of Declare line, call line and associated coding is used as an enigma type coding that sets off some particular back end coding to do something….
    As I went on, I came to an idea, which with hindsight later searching, some people, al be it very few, but computer Profis never the less, also thought…. As soon as VBA sees a Declare line, it decides to do some Unicode to ANSI transformations, in particular when it sees a string argument. I am thinking I don’t want that.**
    For one thing, Excel spreadsheets and word documents, I have noticed seem very good with many exotic characters and languages. Even my preferred earlier Office versions.
    I think I, (and likely some others, possibly even some Microsoft people ) , may have been mislead sometimes in code development by apparent failings of passing characters due to failures in the VB Editor, and possibly then even overlooked that we have some (less commonly known and less commonly used) in most cases an API function version that it is regarded as a Unicode version.
    I want to see if I can get a more Unicode API thing, and perhaps try at the same time to stop VBA messing with things so much…..My brain started one of its lateral thinking that rarely produce anything other than time and resource loss, but when they do 1 in 10 times produce something, it is usually more than worth the "lost" investment. This time it may have got something interesting and useful. Maybe not
    This is just a provisional initial theory:
    _ Behold: I have seen a API World, where direct ANSI Strings stuff f is often avoided, and that World is good. In this regard, String is anything at a API Declare line or related main code lines. This will include anything in API related VBA code lines that include As String
    _In VBA, VB and possibly in other computer things, much involving string manipulations involves the handling not directly of the string itself, but of numbers: addresses of a Long type. This may be able to be exploited, when the string manipulation involves simple transferring: We can try to pass a pointer. This may effectively being something like a ByRef, when it is ByVal declared. This can help reduce certain conflicts associated with an actual explicit ByRef usage
    (We note possible parallels here to hacks to arguments in VBA Application.Run)

    Having done many empirical measurements, I may have found a way to do Unicode API things, and that may to soime extent explain issues which initiated this Thread https://eileenslounge.com/viewtopic.php?f=30&t=41659


    Here we go for now (and a lot to be added to and edited later

    MessageBoxÆ function https://www.excelfox.com/forum/showt...ge4#post417897
    Last edited by DocAElstein; 02-15-2025 at 01:19 PM.

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    MessageBoxÆ function
    The standard/ old Declareation looks like this
    Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
    In this case disappointingly, the string arguments are given As String
    However, take a look at the moderner documentation. ( That is usually in C language , but translating them is usually straight forward. )
    int MessageBoxA(
    [in, optional] HWND hWnd,
    [in, optional] LPCSTR lpText,
    [in, optional] LPCSTR lpCaption,
    [in] UINT uType
    );
    int MessageBoxW(
    [in, optional] HWND hWnd,
    [in, optional] LPCWSTR lpText,
    [in, optional] LPCWSTR lpCaption,
    [in] UINT uType
    );

    Encouraging we see the pointer stuff is there on the two string arguments.
    So
    We is trying to get something that very likely does a Unicode thing, as much as possible. That is to say the provisional Ælstein Theory proclamates something like:
    _ Behold: I have seen a API World, where direct ANSI Strings stuff is often avoided, or at least cropped back / restrained a bit, and that World is good. In this regard, String is anything at a API Declare line or related main code lines. This will include anything in API related VBA code lines that include As String
    _In VBA, VB and possibly in other computer things, much involving string manipulations involves the handling not directly of the string itself, but of numbers: addresses of a Long type. This may be able to be exploited, when the string manipulation involves simple transferring: We can try to pass a pointer. This may effectively being something like a ByRef, when it is ByVal declared. This can help reduce certain conflicts associated with an actual explicit ByRef usage
    (We note possible parallels here to hacks to arguments in VBA Application.Run)

    Worked example
    I got an interesting word, or rather interesting first character of a word, in the first cell of a worksheet
    Whilst Excel seems very good with displaying a massive amount of exotic high up the Unicode list characters, initially both the inbuilt VBA MsgBox and initially the API MessageBoxA don’t do at all well, not even if it's an ANSI that is probably not on my code page .


    later.....
    Last edited by DocAElstein; 02-15-2025 at 01:21 PM.

Similar Threads

  1. Some Date Notes and Tests
    By DocAElstein in forum Test Area
    Replies: 5
    Last Post: 03-26-2025, 02:56 AM
  2. Replies: 116
    Last Post: 02-23-2025, 12:13 AM
  3. Replies: 21
    Last Post: 12-15-2024, 07:13 PM
  4. Replies: 42
    Last Post: 05-29-2023, 01:19 PM
  5. Replies: 11
    Last Post: 10-13-2013, 10:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •