Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GUI app and winAPI calls
#41
(03-24-2023, 09:51 AM)aurel Wrote: another bad thing is that message loop is created with DO/LOOP
and in C/C++ most used way is with WHILE/WEND

Why is it a bad thing? Just add "DO" in front of "WHILE" statement, and at the bottom write "LOOP" instead of "WEND".
"DO/LOOP" exists to give us a loop that could run once. I have never used "WHILE... WEND", it's unnecessary to me. There was the attempt to make it count with "EXIT WHILE" which arrived too late I think, because many programmers resisted so much using "DO... LOOP" instead.

In fact, "EXIT DO" was the only way to replicate "break;" statement in C, and the excellent code example in the QB64 Wiki, the only way to "_CONTINUE" until of course that QB64-only statement was invented.

The message loop involves "SELECT CASE... END SELECT" also, doesn't it?
Reply
#42
And that is your main problem?

no While  GetMessage(msg,0,0,0) <> 0

without "stupid" bRet ..in combination with "stupid"
 SELECT CASE bRet

Dodgy 

Main problem is why QB64 not know for type or structure called WNDCLASSEX
or why is not recognized when is there ..in mingW header ?
Reply
#43
This is how typical C++ app should look:


#include <windows.h>

/* window procedure */
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdParam, int cmdShow)
{
    MSG messages;        /* for messages queue manipulation */
    WNDCLASSEX WndClass; /* data struct for window class */
    HWND hWnd;          /* handle for window */

    /* define window class */
    WndClass.cbSize = sizeof(WNDCLASSEX);
    WndClass.style = CS_DBLCLKS;
    WndClass.hInstance = hInst;
    WndClass.lpszClassName = "WindowClassName";
    WndClass.lpfnWndProc = WndProc;

    /* icons, cursor and menu */
    WndClass.hIcon = LoadIcon(hInst, "MAINICON"); /* default icon */
    WndClass.hIconSm = LoadIcon(hInst, "MAINICON"); /* default icon */
    WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); /* cursor */
    WndClass.lpszMenuName = NULL; /* no menu */
    WndClass.cbClsExtra = 0;
    WndClass.cbWndExtra = 0;

    /* window background color */
    WndClass.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
    RegisterClassEx(&WndClass);
   
    hWnd = CreateWindowEx(0,                    /* extended window style */
                          "WindowClassName",    /* registered class */
                          "Windows Application", /* window title */
                          WS_OVERLAPPEDWINDOW,  /* default window style */
                          CW_USEDEFAULT,        /* x position */
                          CW_USEDEFAULT,        /* y position */
                          640,                  /* width of window */
                          480,                  /* heigth of window */
                          HWND_DESKTOP,          /* The window is a child-window to desktop */
                          NULL,                  /* no menu */
                          hInst,                /* Program Instance handler */
                          NULL);                /* No Window Creation data */
                         
    ShowWindow(hWnd, SW_SHOW);
    UpdateWindow(hWnd); 

    /* loop messages. run until GetMessage return 0*/ 
    while (GetMessage(&messages, NULL, 0, 0))
    {
        TranslateMessage(&messages); /* translate virtual keys into character messages*/
        DispatchMessage(&messages);  /* Send message to WndProc */
    }
    /* return value to system */
    return messages.wParam;
}

/*  This function is called by the Windows function DispatchMessage()  */
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
        case WM_DESTROY:
            PostQuitMessage(0); /* send a WM_QUIT to the message queue */
            break;
        default:                /* for messages that we don't deal with */
            return DefWindowProc(hwnd, message, wParam, lParam);
    }
    return 0;
}
Reply
#44
maybe i lost my mind ..or i am ... Big Grin 

I am looking over whole old archived forum and still no clue what i need
thanks RhoSigma
i just looking into your LARGE framework - really impressive !!!
but also very complex (shame on me)

it looks that is easier to write native winApi gui program in C++ than in QB64
also it is obvious that new declares are not supported or built in qb64
source code of qb64 is a large 24000 LOC  Rolleyes

if i find something concrete i will let you know
Reply
#45
ok i found old topic
https://qb64forum.alephc.xyz/index.php?topic=4279.15
Reply
#46
Only thing which is not clear to me is this about manifest:

Quote:With the release of QB64 v2.0  a seperate manifest nolonger required for Windows controls:
"Automatically embeds a manifest file when compiling an exe with $VersionInfo, so that Common Controls v6.0 gets linked at runtime.


So my question is what is $VersionInfo ?
Reply
#47
(03-25-2023, 09:35 PM)aurel Wrote: Only thing which is not clear to me is this about manifest:

Quote:With the release of QB64 v2.0  a seperate manifest nolonger required for Windows controls:
"Automatically embeds a manifest file when compiling an exe with $VersionInfo, so that Common Controls v6.0 gets linked at runtime.


So my question is what is $VersionInfo ?

Just look into the first 20 lines of source/qb64pe.bas, and the respective Wiki page.
Reply
#48
Thanks RhoSigma

Now ..how i don't know that
i must investigate this better
Reply
#49
(03-26-2023, 07:16 AM)aurel Wrote: Thanks RhoSigma

Now ..how i don't know that
i must investigate this better

It's basically the informations shown in the File Properties Dialog under the "Details" tab.

$VERSIONINFO:FileDescription is also used in Filemanager/Resourcetracking as desciption of the process.
Reply




Users browsing this thread: 28 Guest(s)