![]() |
Von C nach D (elphi) - Äh wie ?
Hi,
isch habe da so ein kleines Problemschen. Ich habe mit mal das Winamp Plugin SDK angeschaut. Soweit so gut, aber an diesen Stellen komm ich nicht weiter:
Code:
void config(struct winampVisModule *this_mod)
{ MessageBox(this_mod->hwndParent,"This module is Copyright (c) 1997-1998, Justin Frankel/Nullsoft\n" "-- This is just a demonstration module, it really isn't\n" " supposed to be enjoyable --","Configuration",MB_OK); } embedWindowState myWindowState; // <--<<< // winampVisModule *g_mod = NULL; int width; int height; // initialization. Registers our window class, creates our window, etc. Again, this one works for // both modules, but you could make init1() and init2()... // returns 0 on success, 1 on failure. int init(struct winampVisModule *this_mod) { int styles; HWND parent = NULL; HWND (*e)(embedWindowState *v); // <--<<< // width = (this_mod == &mod3)?256:288; // width and height are the same for mod1 and mod2, height = (this_mod == &mod3)?32:256; // but mod3 is shaped differently // >>>--> // g_mod = this_mod; config_read(this_mod); // uncomment this line if your plugin draws to the screen using directx OVERLAY mode // myWindowState.flags |= EMBED_FLAGS_NOTRANSPARENCY; myWindowState.r.left = config_x; // <--<<< // myWindowState.r.top = config_y; myWindowState.r.right = config_x + width; myWindowState.r.bottom = config_y + height; // <--<<< // *(void**)&e = (void *)SendMessage(this_mod->hwndParent,WM_WA_IPC,(LPARAM)0,IPC_GET_EMBEDIF); // >>>--> // if (!e) { MessageBox(this_mod->hwndParent,"This plugin requires Winamp 5.0+","blah",MB_OK); return 1; } parent = e(&myWindowState); // <--<<< // SetWindowText(myWindowState.me, this_mod->description); // set our window title { // Register our window class WNDCLASS wc; memset(&wc,0,sizeof(wc)); wc.lpfnWndProc = WndProc; // our window procedure wc.hInstance = this_mod->hDllInstance; // hInstance of DLL wc.lpszClassName = szAppName; // our window class name if (!RegisterClass(&wc)) { MessageBox(this_mod->hwndParent,"Error registering window class","blah",MB_OK); return 1; } } styles = WS_VISIBLE|WS_CHILDWINDOW|WS_OVERLAPPED|WS_CLIPCHILDREN|WS_CLIPSIBLINGS; hMainWnd = CreateWindowEx( 0, // these exstyles put a nice small frame, // but also a button in the taskbar szAppName, // our window class name NULL, // no title, we're a child styles, // do not make the window visible config_x,config_y, // screen position (read from config) width,height, // width & height of window (need to adjust client area later) parent, // parent window (winamp main window) NULL, // no menu this_mod->hDllInstance, // hInstance of DLL 0); // no window creation data |
Re: Von C nach D (elphi) - Äh wie ?
Ich übersetze die markierten Stellen einfach mal nach Delphi.
Code:
embedWindowState myWindowState;
Delphi-Quellcode:
var myWindowState: embedWindowState; //globale Variable
Code:
HWND (*e)(embedWindowState *v); //Funktionszeiger in C sind etwas schwierig
Delphi-Quellcode:
var e: function(v: pEmbedWindowState): hwnd;
Code:
g_mod = this_mod;
Delphi-Quellcode:
g_mod:=this_mod
Code:
myWindowState.r.left = config_x; //Wo liegt das Problem?
Code:
*(void**)&e = (void *)SendMessage(this_mod->hwndParent,WM_WA_IPC,(LPARAM)0,IPC_GET_EMBEDIF); //köstlich!
Delphi-Quellcode:
Das geht auch einfacher als
PPointer(@@e)^:=Pointer(SendMessage(this_mod^.hwndParent, WM_WA_IPC, LPARAM(0), IPC_GET_EMBEDIF))
Delphi-Quellcode:
Pointer(e):=Pointer(SendMessage(this_mod^.hwndParent, WM_WA_IPC, LPARAM(0), IPC_GET_EMBEDIF))
Code:
parent = e(&myWindowState);
Delphi-Quellcode:
Parent:=e(@MyWindowState)
|
Re: Von C nach D (elphi) - Äh wie ?
Vielen Dank. :thumb:
Code:
Solche Stellen find ich immer toll. ;)
*(void**)&e = (void *)SendMessage(...
Code:
Ich habe k.Ahnung wo die Leutchen den Record her haben.
myWindowState.r.left = config_x; //Wo liegt das Problem?
|
Re: Von C nach D (elphi) - Äh wie ?
Zitat:
|
Re: Von C nach D (elphi) - Äh wie ?
Ich habe in die falsche Headerdatei geschaut.
Code:
... ist ein Fall von Selberschult. :wall:
typedef struct
{ HWND me; //hwnd of the window int flags; RECT r; void *user_ptr; // for application use int extra_data[64]; // for internal winamp use } embedWindowState; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:37 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz