BOOL CMy8App::InitInstance()
{
AfxEnableControlContainer();
    SetRegistryKey(COMPANY_KEY); // Standard initialization
// If you are not using these features and wish to reduce the size
//  of your final executable, you should remove from the following
//  the specific initialization routines you do not need.#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif // Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings();  // Load standard INI file options (including MRU) // 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(CMy8Doc),
RUNTIME_CLASS(CMainFrame),       // main SDI frame window
RUNTIME_CLASS(CMy8View));
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);
    BYTE* p;
UINT size;
WINDOWPLACEMENT *pwp2;
if(GetProfileBinary(SETTING_KEY,WINDOWPLACEMENT_KEY,pwp2,&size)) 

{
m_pMainWnd->SetWindowPlacement(pwp2);
delete[] pwp2;
}
else
{
m_pMainWnd->ShowWindow(m_nCmdShow);
} m_pMainWnd->UpdateWindow(); return TRUE;
}
我想用的就是在视图类的InitInstance() 中把存储在注册表中的程序的屏幕信息提取出来,,我定义了一个WINDOWPLACEMENT但是,老是在if语句判断的时候提示不能进行转换,,请问这个是什么事 啊,,,
怎么会导致的这个原因啊

解决方案 »

  1.   

    if(GetProfileBinary(SETTING_KEY,WINDOWPLACEMENT_KEY,&pwp2,&size)) 
      

  2.   

    if(GetProfileBinary(SETTING_KEY,WINDOWPLACEMENT_KEY,(LPBYTE *)&pwp2,&size))  
      

  3.   

    //看看MSDN上的例子
    CWinApp* pApp = AfxGetApp();const TCHAR* pszKey = _T("My Section");
    struct complex {
      double re, im;
    } myData = { 1.4142, -0.5 };// Write the information to the registry.pApp->WriteProfileBinary(pszKey, _T("ComplexData"), (LPBYTE)&myData, 
       sizeof(myData));// Read the information from the registry.complex* pData;
    UINT n;
    BOOL ret = pApp->GetProfileBinary(pszKey, _T("ComplexData"), (LPBYTE*)&pData, 
       &n);ASSERT(ret);
    ASSERT(n == sizeof(complex));
    ASSERT(myData.re == pData->re);
    ASSERT(myData.im == pData->im);
    delete [] pData; // free the buffer