Jump to content

[C] Win32 Modeless Dialogs

- - - - -

  • Please log in to reply
No replies to this topic

#1
OnyxDragun

OnyxDragun

    Newbie

  • Members
  • PipPip
  • 15 posts
I am trying to pass data from wndProc to a Modeless Dialogbox (hStats = CreateDialog(...)). Is it possible?


typedef struct _data

{

    TCHAR* szFileName;

}DATA, *PDATA;

...

PDATA myData;

myData = (PDATA)malloc(sizeof(DATA));

...

//set up main window

wnclass.cbWndExtra = sizeof(PDATA);

...

hStats = CreateDialog(...);

SetWindowLongPtr(hStats, 0, (LONG)myData);

...

//in the dlgProc

// how would I extract the myData?

pData = (PDATA)GetWindowLong(hDlg, 0);


Not sure where to, or if I can actually do that?

---------- Post added at 09:07 AM ---------- Previous post was at 08:13 AM ----------

Don't know how proper this is but I used CreateDialogParam() and passed the pointer of my struct into it casting it as a (LPARAM) (which is just a pointer to a long)

Seems to have worked.... this alright?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users