Click here to Skip to main content
15,907,326 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerCross Post Pin
led mike23-Sep-08 4:45
led mike23-Sep-08 4:45 
QuestionCalling Windows.Form from MFC with /cli [modified] Pin
ToSchi9819-Sep-08 1:43
ToSchi9819-Sep-08 1:43 
AnswerRe: Calling Windows.Form from MFC with /cli Pin
Mark Salsbery19-Sep-08 6:58
Mark Salsbery19-Sep-08 6:58 
GeneralRe: Calling Windows.Form from MFC with /cli Pin
ToSchi9819-Sep-08 8:58
ToSchi9819-Sep-08 8:58 
GeneralRe: Calling Windows.Form from MFC with /cli Pin
Mark Salsbery19-Sep-08 10:44
Mark Salsbery19-Sep-08 10:44 
GeneralRe: Calling Windows.Form from MFC with /cli Pin
ToSchi9822-Sep-08 3:18
ToSchi9822-Sep-08 3:18 
GeneralRe: Calling Windows.Form from MFC with /cli Pin
Mark Salsbery22-Sep-08 4:50
Mark Salsbery22-Sep-08 4:50 
GeneralRe: Calling Windows.Form from MFC with /cli [modified] Pin
ToSchi9824-Sep-08 3:27
ToSchi9824-Sep-08 3:27 
Ok Mark i finally found the error. Below there is code of the function which is called in the OnInit() method of the Dialog from which the call to the C# dll is triggered. So far so good. The final Software works on XP and Vista (both VS Studio 2008 installed) and "with this function". On Win2K with Framework 2.0 SP1 it doesn´t work. When i comment these method out it also works on Win2K. I don´t really know why this happens and i only get an error report i can send to MS with the hint that something crashes in the mswks dll. I did not spend attention to this method for a long time because nothing everything seems to be ok there was never a crash at this point.

Greetings Torben

PS: I am sorry but in the whole very big program inherited from a very nice guy not one line of documentation can be found Big Grin | :-D

CString CSpliceCheckerDlg::GetVersionInfo()
{
  CString csRet;


  HMODULE  hLib = AfxGetResourceHandle();
  
  HRSRC hVersion = FindResource( hLib, 
    MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION );
  if (hVersion != NULL)
  {
    HGLOBAL hGlobal = LoadResource( hLib, hVersion ); 
    if ( hGlobal != NULL)  
    {  
  
      LPVOID versionInfo  = LockResource(hGlobal);  
      if (versionInfo != NULL)
      {
        DWORD vLen;
        BOOL retVal;    

        LPVOID retbuf=NULL;
    
        static TCHAR  fileEntry[256];

		VS_FIXEDFILEINFO *pFixedValue; 
        _stprintf(fileEntry, _T("\\"));
        retVal = VerQueryValue(versionInfo,fileEntry,&retbuf,(UINT *)&vLen);
		if (retVal) {
			pFixedValue = (VS_FIXEDFILEINFO *)retbuf;
			int i1 = pFixedValue->dwFileVersionMS;
			int i2 = pFixedValue->dwFileVersionLS>>16;
			int i3 = (pFixedValue->dwFileVersionLS&0xffff);
			if (!i3) {
				csRet.Format(_T("%d.%d"), i1, i2);
			}
			else {
				csRet.Format(_T("%d.%d.%d"), i1, i2, i3);
			}
		}
      }
    }
    UnlockResource( hGlobal );  
    FreeResource( hGlobal );  
  }
return csRet;
}


modified on Thursday, September 25, 2008 2:57 AM

QuestionRe: Calling Windows.Form from MFC with /cli Pin
Mark Salsbery24-Sep-08 5:55
Mark Salsbery24-Sep-08 5:55 
GeneralRe: Calling Windows.Form from MFC with /cli Pin
Mark Salsbery24-Sep-08 6:21
Mark Salsbery24-Sep-08 6:21 
GeneralRe: Calling Windows.Form from MFC with /cli Pin
ToSchi9824-Sep-08 20:56
ToSchi9824-Sep-08 20:56 
QuestionHow to create C# Control for any language Pin
Andy Rama17-Sep-08 23:16
Andy Rama17-Sep-08 23:16 
AnswerRe: How to create C# Control for any language Pin
Mark Salsbery18-Sep-08 4:14
Mark Salsbery18-Sep-08 4:14 
GeneralRe: How to create C# Control for any language Pin
Andy Rama18-Sep-08 21:18
Andy Rama18-Sep-08 21:18 
GeneralRe: How to create C# Control for any language Pin
Mark Salsbery19-Sep-08 5:41
Mark Salsbery19-Sep-08 5:41 
QuestionRe: How to create C# Control for any language Pin
Andy Rama22-Sep-08 20:04
Andy Rama22-Sep-08 20:04 
AnswerRe: How to create C# Control for any language Pin
Andy Rama22-Sep-08 23:32
Andy Rama22-Sep-08 23:32 
GeneralRe: How to create C# Control for any language Pin
Mark Salsbery23-Sep-08 5:22
Mark Salsbery23-Sep-08 5:22 
GeneralRe: How to create C# Control for any language Pin
Andy Rama23-Sep-08 19:22
Andy Rama23-Sep-08 19:22 
GeneralRe: How to create C# Control for any language Pin
Mark Salsbery24-Sep-08 4:45
Mark Salsbery24-Sep-08 4:45 
AnswerRe: How to create C# Control for any language Pin
Paul Conrad18-Sep-08 6:50
professionalPaul Conrad18-Sep-08 6:50 
QuestionRe: How to create C# Control for any language [modified] Pin
Andy Rama18-Sep-08 21:11
Andy Rama18-Sep-08 21:11 
AnswerRe: How to create C# Control for any language Pin
Paul Conrad19-Sep-08 4:02
professionalPaul Conrad19-Sep-08 4:02 
QuestionDll throws when loaded from a network path Pin
doug_ayers17-Sep-08 5:25
doug_ayers17-Sep-08 5:25 
AnswerRe: Dll throws when loaded from a network path Pin
Scott Dorman17-Sep-08 6:18
professionalScott Dorman17-Sep-08 6:18 

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.