Click here to Skip to main content
15,885,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: id3 tag for wma file Pin
Christian Graus17-Dec-03 16:28
protectorChristian Graus17-Dec-03 16:28 
GeneralRe: id3 tag for wma file Pin
qdping17-Dec-03 16:39
qdping17-Dec-03 16:39 
GeneralRe: id3 tag for wma file Pin
Bob Stanneveld17-Dec-03 21:13
Bob Stanneveld17-Dec-03 21:13 
GeneralRe: id3 tag for wma file Pin
qdping17-Dec-03 21:31
qdping17-Dec-03 21:31 
GeneralRe: id3 tag for wma file Pin
Bob Stanneveld18-Dec-03 21:14
Bob Stanneveld18-Dec-03 21:14 
GeneralRe: id3 tag for wma file Pin
qdping18-Dec-03 21:55
qdping18-Dec-03 21:55 
GeneralRe: id3 tag for wma file Pin
Bob Stanneveld19-Dec-03 4:44
Bob Stanneveld19-Dec-03 4:44 
QuestionHow to initialize SDI Doc/View interface from MFC-based dll Pin
JoeSchmoe00717-Dec-03 13:36
JoeSchmoe00717-Dec-03 13:36 
I am trying to create MFC-based dll that will present SDI Doc/View interface
to the user.
[my question is at the end of this rather lengthy post]

This dll will be called from Win32 application that is not MFC based (also,
this app is
written in C, not in C++).

I created MFC-based dll project (called MFCDLL) using the Wizard.

In this project I created following classes:

CPrintingDoc (derived from CDocument)
CPrintingView (derived from CView)
CMainFrame (derived from CFrameWnd)

I created an exported function in this dll:

extern "C" __declspec(dllexport) int SomeFunction(int n)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
theApp.Initialize();
return ++n;
}

My intent is that Win32 application calls SomeFunction(), and SomeFunction
initializes Doc/View environment. Related piece of code looks like this:

BOOL CMFCDLLApp::Initialize()
{
AfxEnableControlContainer();

// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.

CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CPrintingDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CPrintingView));
AddDocTemplate(pDocTemplate);

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;

// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

return TRUE;
}

Essentially I replicated by hand the code that wizard generates for the
MFC-based .exe application

I also created String Table resource in this dll and added the following
string to it:

IDR_MAINFRAME TEST\n\nTEST\n\n\nTEST.Document\nTEST Document

When I start Win32 application and call SomeFunction() I get the dialog box
with message:

"Failed to create empty document",

and the view is not created.

Stepping through the code I found that the document is actually successfully
created
in function

CDocument* CSingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName,
BOOL bMakeVisible)

This function is in file DOCSINGL.CPP (MFC source code). Document is created
in line 112:

[line 112] pDocument = CreateNewDocument();

The problem lies further in the same function, when in line 132 it attempts
to create the
frame:

[line 132] pFrame = CreateNewFrame(pDocument, NULL);

This function call returns NULL, the frame is not created, and this is why I am receiving this error message.

So my understanding at this point is that I maybe have to create this frame
window
myself somewhere in CMFCDLLApp::Initialize() before

if (!ProcessShellCommand(cmdInfo))

line (the failed attempt of frame creation is deep inside
ProcessShellCommand())

Is that right ? How would I do this ?

Or maybe I am going in the completely wrong direction - in that case please
suggest what
I need to do differently


QuestionHow to call a dll from MFC SDI application? Pin
Binayak17-Dec-03 13:00
Binayak17-Dec-03 13:00 
AnswerRe: How to call a dll from MFC SDI application? Pin
Prakash Nadar17-Dec-03 16:46
Prakash Nadar17-Dec-03 16:46 
General..\\..\\help in remembering what all this means Pin
Steve Messer17-Dec-03 12:55
Steve Messer17-Dec-03 12:55 
GeneralRe: ..\\..\\help in remembering what all this means Pin
Terry O'Nolley17-Dec-03 13:27
Terry O'Nolley17-Dec-03 13:27 
GeneralRe: ..\\..\\help in remembering what all this means Pin
Steve Messer17-Dec-03 14:19
Steve Messer17-Dec-03 14:19 
Questionmultiple executables in the same project? Pin
luddet17-Dec-03 12:39
luddet17-Dec-03 12:39 
AnswerRe: multiple executables in the same project? Pin
Anthony_Yio17-Dec-03 16:03
Anthony_Yio17-Dec-03 16:03 
GeneralRe: multiple executables in the same project? Pin
luddet17-Dec-03 16:33
luddet17-Dec-03 16:33 
GeneralRe: multiple executables in the same project? Pin
Anthony_Yio17-Dec-03 17:17
Anthony_Yio17-Dec-03 17:17 
GeneralRe: multiple executables in the same project? Pin
luddet18-Dec-03 4:43
luddet18-Dec-03 4:43 
GeneralRe: multiple executables in the same project? Pin
John M. Drescher19-Dec-03 8:13
John M. Drescher19-Dec-03 8:13 
GeneralRe: multiple executables in the same project? Pin
luddet20-Dec-03 3:52
luddet20-Dec-03 3:52 
GeneralResource Only DLL question Urgent! Pin
Binayak17-Dec-03 11:24
Binayak17-Dec-03 11:24 
GeneralRe: Resource Only DLL question Urgent! Pin
Prakash Nadar17-Dec-03 16:42
Prakash Nadar17-Dec-03 16:42 
GeneralBest database classes for this purpose: not really a programming question Pin
pankajdaga17-Dec-03 11:21
pankajdaga17-Dec-03 11:21 
GeneralRe: Best database classes for this purpose: not really a programming question Pin
John M. Drescher17-Dec-03 17:09
John M. Drescher17-Dec-03 17:09 
Generalquick question Pin
Qbus17-Dec-03 10:41
Qbus17-Dec-03 10:41 

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.