GetMessage, TranslateMessage,DispatchMessage

Previous topic - Next topic

Schranz0r

Hi Gernot,

bin am verzweifeln, bekomms einfach nicht hin in GLB...
Könntest du bitte Hilfestellung geben?
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Kitty Hello

Oh mann - ich hab so wenig Zeit....
Code (glbasic) Select
LRESULT CALLBACK WndProc(
    HWND   hWnd,
    UINT   msg,
    WPARAM wParam,
    LPARAM lParam ) {
   switch(msg)
   {
    default:
      return DefWindowProc( hWnd, msg, wParam, lParam);
  }
  return 0;
}


void MachFenter() {

  WNDCLASSEX wce;

  wce.cbSize        = sizeof(wce);
  wce.style         = CS_VREDRAW | CS_HREDRAW;
  wce.lpfnWndProc   = (WNDPROC) WndProc;
  wce.cbClsExtra    = 0;
  wce.cbWndExtra    = 0;
  wce.hInstance     = hInstance;
  wce.hIcon         = LoadIcon((HINSTANCE) NULL, IDI_APPLICATION);
  wce.hCursor       = LoadCursor((HINSTANCE) NULL, IDC_ARROW);
  wce.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
  wce.lpszMenuName  = 0;
  wce.lpszClassName = "WinClass",
  wce.hIconSm       = 0;
 
  if (!RegisterClassEx(&wce)) return 0;
 
  HWND hWnd = CreateWindowEx(
    0,          // Ex Styles
    "WinClass",
    "Test",
     WS_OVERLAPPEDWINDOW,
     CW_USEDEFAULT,  // x
     CW_USEDEFAULT,  // y
     CW_USEDEFAULT,  // Height
     CW_USEDEFAULT,  // Width
     NULL,           // Parent Window
     NULL,           // Menu, or windows id if child
     hInstance,      //
     NULL            // Pointer to window specific data
  );

  ShowWindow( hWnd, nCmdShow );
}

int CheckWindow()
{
  MSG msg;
  int r;
  while ((r = GetMessage(&msg, NULL, 0, 0 )) != 0) {
    if (r == -1) {
      ;  // Error!
    }
    else {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
    }
  }

  // The application's return value
  return msg.wParam;
};
Die CheckMessage in einem Thread aufrufen - oder mit PeekMessage arbeiten.

trucidare

problem an der ganzen sache ist das wir leider keine funktionen wie GetMessage und co haben. Die sind in der Windows.h definiert und die können wir bekanntermaßen ja nicht einfügen.
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

Schranz0r

Doch user32.dll


Nur gibts noch das hInstance & Co problem!
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Kitty Hello

Musst Du hast Copy/Paste aus dem windows.h nehmen. Die funktionen linken dann schon.

trucidare

Danke Gernot.

@ Schranzi: Nun einigen wir uns doch bitte auf eine Lösung... Entweder non DLL oder nur DLL ;)
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC