Click here to Skip to main content
15,914,074 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Word file with Visual c++ (MFC) Pin
C++NewBe26-May-04 7:21
C++NewBe26-May-04 7:21 
QuestionDoes C# has default SOAP client package? Pin
Jack Su15-Feb-04 1:58
Jack Su15-Feb-04 1:58 
GeneralProcessor or Mainboard's Serial Number Pin
Member 84094015-Feb-04 1:51
Member 84094015-Feb-04 1:51 
GeneralRe: Processor or Mainboard's Serial Number Pin
Toni7815-Feb-04 19:10
Toni7815-Feb-04 19:10 
GeneralRe: Processor or Mainboard's Serial Number Pin
David Crow16-Feb-04 3:13
David Crow16-Feb-04 3:13 
GeneralConvert virtual key code to human readable format Pin
User 665815-Feb-04 1:30
User 665815-Feb-04 1:30 
GeneralRe: Convert virtual key code to human readable format Pin
Antti Keskinen15-Feb-04 3:08
Antti Keskinen15-Feb-04 3:08 
QuestionWhy this code never works???!?? Pin
YaronNir15-Feb-04 1:26
YaronNir15-Feb-04 1:26 
Hi all,

I have created a new ATL-COM Object (supporting MFC)
I've defined a method that returns the workspace of the current project.
Here is the code i am using:

CWinApp* pApp = AfxGetApp();
ASSERT(NULL != pApp);

CString szWorkspace(_T(""));

POSITION posdt = pApp->GetFirstDocTemplatePosition();
	
while (NULL != posdt)
{
	CDocTemplate* pdt = pApp->GetNextDocTemplate(posdt);
	if (0 == strcmp("CProjectWorkspaceDocTemplate", 
		pdt->GetRuntimeClass()->m_lpszClassName))
	{
		POSITION posdoc = pdt->GetFirstDocPosition();
		if (NULL == posdoc) 
			break;
			CDocument* pdoc = pdt->GetNextDoc(posdoc);
		if (NULL == pdoc) 
			break;
			szWorkspace = pdoc->GetPathName();
		if (!szWorkspace.IsEmpty()) 
			break;
	}
}


trouble is , when i debug it this line returns NULL:
POSITION posdt = pApp->GetFirstDocTemplatePosition();


Why does it never succeed in getting the first doc template position?
can any1 help me here?

thanks in advanced
Yaron




Ask not what your application can do for you,
Ask what you can do for your application
AnswerRe: Why this code never works???!?? Pin
Antti Keskinen15-Feb-04 3:33
Antti Keskinen15-Feb-04 3:33 
GeneralRe: Why this code never works???!?? Pin
YaronNir15-Feb-04 5:33
YaronNir15-Feb-04 5:33 
GeneralRe: Why this code never works???!?? Pin
Antti Keskinen15-Feb-04 7:10
Antti Keskinen15-Feb-04 7:10 
GeneralRe: Why this code never works???!?? Pin
Antti Keskinen15-Feb-04 7:51
Antti Keskinen15-Feb-04 7:51 
GeneralRe: Why this code never works???!?? Pin
YaronNir15-Feb-04 20:58
YaronNir15-Feb-04 20:58 
GeneralRe: Why this code never works???!?? Pin
Antti Keskinen15-Feb-04 22:06
Antti Keskinen15-Feb-04 22:06 
GeneralRe: Why this code never works???!?? Pin
YaronNir15-Feb-04 22:10
YaronNir15-Feb-04 22:10 
GeneralRe: Why this code never works???!?? Pin
Antti Keskinen16-Feb-04 2:03
Antti Keskinen16-Feb-04 2:03 
GeneralRe: Why this code never works???!?? Pin
YaronNir16-Feb-04 2:15
YaronNir16-Feb-04 2:15 
GeneralRe: Why this code never works???!?? Pin
Antti Keskinen16-Feb-04 2:54
Antti Keskinen16-Feb-04 2:54 
GeneralRe: Why this code never works???!?? Pin
YaronNir16-Feb-04 3:19
YaronNir16-Feb-04 3:19 
GeneralRe: Why this code never works???!?? Pin
Antti Keskinen16-Feb-04 5:53
Antti Keskinen16-Feb-04 5:53 
GeneralRe: Why this code never works???!?? Pin
YaronNir16-Feb-04 6:12
YaronNir16-Feb-04 6:12 
QuestionHow to Insert Table in Rich Text Box Control Pin
Sumit Kapoor15-Feb-04 0:18
Sumit Kapoor15-Feb-04 0:18 
AnswerRe: How to Insert Table in Rich Text Box Control Pin
CodeBrain15-Feb-04 21:57
CodeBrain15-Feb-04 21:57 
GeneralDatabase Problem Pin
Ghasrfakhri14-Feb-04 23:00
Ghasrfakhri14-Feb-04 23:00 
GeneralRe: Database Problem Pin
Manfred Staiger16-Feb-04 0:37
Manfred Staiger16-Feb-04 0:37 

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.