Hi,
How would you convert the following C++ code to MASM and any vars,defs needed, not having any luck, thanks for any help.
LPCBT_CREATEWND lpCbtCreate = (LPCBT_CREATEWND)lParam;
if(WC_DIALOG == lpCbtCreate->lpcs->lpszClass)
The CBT_CREATEWND structure contains information passed to a WH_CBT hook procedure.
HCBT_CREATEWND set wParam and lParam as follows.
wParam=Specifies the handle to the new window.
lParam=Specifies a long pointer to a CBT_CREATEWND structure containing initialization parameters for the window.
The parameters include the coordinates and dimensions of the window. By changing these parameters,
a CBTProc hook procedure can set the initial size and position of the window.
***************C++ Structure Defs**************************
* HCBT_CREATEWND parameters pointed to by lParam
*/
typedef struct tagCBT_CREATEWNDA
{
struct tagCREATESTRUCTA *lpcs;
HWND hwndInsertAfter;
} CBT_CREATEWNDA, *LPCBT_CREATEWNDA;
typedef struct tagCREATESTRUCTA {
LPVOID lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
int cy;
int cx;
int y;
int x;
LONG style;
LPCSTR lpszName;
LPCSTR lpszClass;
DWORD dwExStyle;
} CREATESTRUCTA, *LPCREATESTRUCTA;
***************From MASM windows.inc*********************
CREATESTRUCTA STRUCT
lpCreateParams DWORD ?
hInstance DWORD ?
hMenu DWORD ?
hWndParent DWORD ?
ly DWORD ?
lx DWORD ?
y DWORD ?
x DWORD ?
style DWORD ?
lpszName DWORD ?
lpszClass DWORD ?
ExStyle DWORD ?
CREATESTRUCTA ENDS
CREATESTRUCT equ <CREATESTRUCTA>
CBT_CREATEWNDA STRUCT
lpcs DWORD ?
hWndInsertAfter DWORD ?
CBT_CREATEWNDA ENDS
CBT_CREATEWND equ <CBT_CREATEWNDA>
;; LPCBT_CREATEWND lpCbtCreate = (LPCBT_CREATEWND)lParam;
mov edx,lParam
assume edx:ptr CBT_CREATEWND
;; if (WC_DIALOG == lpCbtCreate->lpcs->lpszClass) { ...
mov eax,[edx].lpcs ;eax = lpCbtCreate->lpcs
assume eax:ptr CREATESTRUCT
mov eax,[eax].lpszClass ;eax = (lpCbtCreate->lpcs)->lpszClass
assume eax:nothing
assume edx:nothing
.IF (eax == WC_DIALOG)
;...more code...
.ENDIF
Tedd,
Thanks alot, that did the trick.