locked
Why can't use part of the win32 api in windows metro style program ?

    Question

  • Hello:
     
     Because windows metro style program the default preprocessor definitions is (WINAPI_FAMILY=2), so win32 library part code disable.

    Is windows metro style program can't well support win32 api function?

    such as, win32 library(<stdlib.h>) as part of the code:

    ----------------------------------------------------------------------------------------------------------------

    #ifndef _CRT_USE_TAILORED_APP
    _Check_return_ _CRTIMP _CRT_INSECURE_DEPRECATE(_dupenv_s) char * __cdecl getenv(_In_z_ const char * _VarName);
    #if __STDC_WANT_SECURE_LIB__
    _Check_return_opt_ _CRTIMP errno_t __cdecl getenv_s(_Out_ size_t * _ReturnSize, _Out_writes_opt_z_(_DstSize) char * _DstBuf, _In_ rsize_t _DstSize, _In_z_ const char * _VarName);
    #endif
    __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(errno_t, getenv_s, _Out_ size_t *, _ReturnSize, char, _Dest, _In_z_ const char *, _VarName)
    #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
    #pragma push_macro("_dupenv_s")
    #undef _dupenv_s
    #endif

    _Check_return_opt_ _CRTIMP errno_t __cdecl _dupenv_s(_Outptr_result_buffer_maybenull_(*_PBufferSizeInBytes) _Outptr_result_z_ char **_PBuffer, _Out_opt_ size_t * _PBufferSizeInBytes, _In_z_ const char * _VarName);

    #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
    #pragma pop_macro("_dupenv_s")
    #endif
    #endif /* _CRT_USE_TAILORED_APP */

    ----------------------------------------------------------------------------------------------------------------

    When WINAPI_FAMILY=2, the above code is not available.

    In the windows metro style program how use of it?

    Friday, January 06, 2012 6:11 AM

Answers