Click here to Skip to main content
15,568,616 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: inet error Pin
Richard MacCutchan16-Oct-17 6:35
mveRichard MacCutchan16-Oct-17 6:35 
QuestionMFC Activex Control Pin
RichardK15115-Oct-17 21:53
RichardK15115-Oct-17 21:53 
GeneralRe: MFC Activex Control Pin
Richard MacCutchan16-Oct-17 4:55
mveRichard MacCutchan16-Oct-17 4:55 
GeneralRe: MFC Activex Control Pin
RichardK15116-Oct-17 5:36
RichardK15116-Oct-17 5:36 
GeneralRe: MFC Activex Control Pin
Richard MacCutchan16-Oct-17 6:37
mveRichard MacCutchan16-Oct-17 6:37 
GeneralRe: MFC Activex Control Pin
leon de boer16-Oct-17 21:34
leon de boer16-Oct-17 21:34 
GeneralRe: MFC Activex Control Pin
RichardK15123-Oct-17 0:49
RichardK15123-Oct-17 0:49 
GeneralRe: MFC Activex Control Pin
leon de boer25-Oct-17 10:18
leon de boer25-Oct-17 10:18 
You don't have to add the resource you make a memory template, its the exact opposite of a resource ... I am not sure you are really getting it

In code you do this creating a memory block which you make the template in
bool CreateRotation (HWND parent){
   int nchar, ret;
   HGLOBAL hgbl;
   LPDLGTEMPLATE lpdt;
   LPWORD lpw;
   LPWSTR lpwsz;
   hgbl = GlobalAlloc(GMEM_ZEROINIT, 1024);							 // Allocate memory
   if (!hgbl) return false;											 // If allocate fail exit
   lpdt = (LPDLGTEMPLATE)GlobalLock(hgbl);							 // Lock the allocated memory
   lpdt->style = WS_POPUP | WS_CAPTION | WS_SYSMENU;											 // Window style
   lpdt->cdit = 0;													 // Number of controls
   lpdt->x  = 80;												 // X position
   lpdt->y  = 80;												 // Y position
   lpdt->cx = 300;												 // Window width
   lpdt->cy = 100;												 // Window height
   lpw = (LPWORD)(lpdt + 1);										 // Set pointer address
   *lpw++ = 0;														 // No menu
   *lpw++ = 0;														 // Predefined dialog box class (by default)
   lpwsz = (LPWSTR)lpw;												 // Typecast pointer
   nchar = 1 + MultiByteToWideChar(CP_ACP, 0, LanguageString[652], 
	  -1, lpwsz, 50);												 // Create name of window
   lpw += nchar;													 // Increment by size of name
   *lpw++ = 0;														 // No creation data
   GlobalUnlock(hgbl);												 // Release lock on the memory block 
   ret = (int)DialogBoxIndirectParam(GetModuleHandle(0), 
     (LPDLGTEMPLATE)hgbl, 
     parent, 
     (DLGPROC)RotationHandler,
	  0);		     											 // Create the dialog from template
   GlobalFree(hgbl);												 // Free the allocated memory
   if (ret == ID_Ok) {
	  PostMessage(parent, WM_COMMAND, WSC_UPDATEEVERYTHING, 0);
	  return true; 
   } else return false;				 // Return result
};


They are called runtime dialogs or dynamic dialogs but you can always know you are on the right track when you see the use of GlobalAlloc because you have to lock a block of memory to create the dialog in, which is why you don't need resource files etc.

Dynamic Dialog Boxes and C++ | Dr Dobb's[^]
In vino veritas

QuestionTo arrange n numbers in descending order ? Pin
Tarun Jha13-Oct-17 10:02
Tarun Jha13-Oct-17 10:02 
AnswerRe: To arrange n numbers in descending order ? Pin
jeron113-Oct-17 10:08
jeron113-Oct-17 10:08 
QuestionRe: To arrange n numbers in descending order ? Pin
David Crow13-Oct-17 17:06
David Crow13-Oct-17 17:06 
AnswerRe: To arrange n numbers in descending order ? Pin
Richard MacCutchan13-Oct-17 23:44
mveRichard MacCutchan13-Oct-17 23:44 
AnswerRe: To arrange n numbers in descending order ? Pin
«_Superman_»15-Oct-17 19:02
professional«_Superman_»15-Oct-17 19:02 
AnswerRe: To arrange n numbers in descending order ? Pin
CPallini16-Oct-17 4:21
mveCPallini16-Oct-17 4:21 
QuestionTo find biggest of n numbers ? Pin
Tarun Jha13-Oct-17 6:44
Tarun Jha13-Oct-17 6:44 
AnswerRe: To find biggest of n numbers ? Pin
jschell13-Oct-17 6:56
jschell13-Oct-17 6:56 
GeneralRe: To find biggest of n numbers ? Pin
Tarun Jha13-Oct-17 7:02
Tarun Jha13-Oct-17 7:02 
GeneralRe: To find biggest of n numbers ? Pin
jschell15-Oct-17 8:11
jschell15-Oct-17 8:11 
AnswerRe: To find biggest of n numbers ? Pin
Richard MacCutchan13-Oct-17 7:16
mveRichard MacCutchan13-Oct-17 7:16 
GeneralRe: To find biggest of n numbers ? Pin
Tarun Jha13-Oct-17 7:22
Tarun Jha13-Oct-17 7:22 
GeneralRe: To find biggest of n numbers ? Pin
jeron113-Oct-17 7:34
jeron113-Oct-17 7:34 
GeneralRe: To find biggest of n numbers ? Pin
Richard MacCutchan13-Oct-17 7:51
mveRichard MacCutchan13-Oct-17 7:51 
GeneralRe: To find biggest of n numbers ? Pin
Tarun Jha13-Oct-17 8:14
Tarun Jha13-Oct-17 8:14 
GeneralRe: To find biggest of n numbers ? Pin
David Crow13-Oct-17 17:10
David Crow13-Oct-17 17:10 
GeneralRe: To find biggest of n numbers ? Pin
Richard MacCutchan13-Oct-17 23:33
mveRichard MacCutchan13-Oct-17 23:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.