• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FindResourceW函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FindResourceW函数的典型用法代码示例。如果您正苦于以下问题:C++ FindResourceW函数的具体用法?C++ FindResourceW怎么用?C++ FindResourceW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FindResourceW函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_find_resource

static void test_find_resource(void)
{
    HRSRC rsrc;

    rsrc = FindResourceW( GetModuleHandleW(NULL), MAKEINTRESOURCEW(1), (LPCWSTR)RT_MENU );
    ok( rsrc != 0, "resource not found\n" );
    rsrc = FindResourceExW( GetModuleHandleW(NULL), (LPCWSTR)RT_MENU, MAKEINTRESOURCEW(1),
                            MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ));
    ok( rsrc != 0, "resource not found\n" );
    rsrc = FindResourceExW( GetModuleHandleW(NULL), (LPCWSTR)RT_MENU, MAKEINTRESOURCEW(1),
                            MAKELANGID( LANG_GERMAN, SUBLANG_DEFAULT ));
    ok( rsrc != 0, "resource not found\n" );

    SetLastError( 0xdeadbeef );
    rsrc = FindResourceW( GetModuleHandleW(NULL), MAKEINTRESOURCEW(1), (LPCWSTR)RT_DIALOG );
    ok( !rsrc, "resource found\n" );
    ok( GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND, "wrong error %u\n", GetLastError() );

    SetLastError( 0xdeadbeef );
    rsrc = FindResourceW( GetModuleHandleW(NULL), MAKEINTRESOURCEW(2), (LPCWSTR)RT_MENU );
    ok( !rsrc, "resource found\n" );
    ok( GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND, "wrong error %u\n", GetLastError() );

    SetLastError( 0xdeadbeef );
    rsrc = FindResourceExW( GetModuleHandleW(NULL), (LPCWSTR)RT_MENU, MAKEINTRESOURCEW(1),
                            MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ) );
    ok( !rsrc, "resource found\n" );
    ok( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND, "wrong error %u\n", GetLastError() );

    SetLastError( 0xdeadbeef );
    rsrc = FindResourceExW( GetModuleHandleW(NULL), (LPCWSTR)RT_MENU, MAKEINTRESOURCEW(1),
                            MAKELANGID( LANG_FRENCH, SUBLANG_DEFAULT ) );
    ok( !rsrc, "resource found\n" );
    ok( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND, "wrong error %u\n", GetLastError() );
}
开发者ID:DeltaYang,项目名称:wine,代码行数:35,代码来源:resource.c


示例2: OleUIPasteSpecialW

/***********************************************************************
 *           OleUIPasteSpecialW (OLEDLG.22)
 */
UINT WINAPI OleUIPasteSpecialW(LPOLEUIPASTESPECIALW ps)
{
    LPCDLGTEMPLATEW dlg_templ = (LPCDLGTEMPLATEW)ps->hResource;
    UINT ret;

    TRACE("(%p)\n", ps);

    if(TRACE_ON(ole)) dump_pastespecial(ps);

    if(!ps->lpSrcDataObj)
        OleGetClipboard(&ps->lpSrcDataObj);

    if(ps->hInstance || !ps->hResource)
    {
        HINSTANCE hInst = ps->hInstance ? ps->hInstance : OLEDLG_hInstance;
        const WCHAR *name = ps->hInstance ? ps->lpszTemplate : MAKEINTRESOURCEW(IDD_PASTESPECIAL4);
        HRSRC hrsrc;

        if(name == NULL) return OLEUI_ERR_LPSZTEMPLATEINVALID;
        hrsrc = FindResourceW(hInst, name, MAKEINTRESOURCEW(RT_DIALOG));
        if(!hrsrc) return OLEUI_ERR_FINDTEMPLATEFAILURE;
        dlg_templ = LoadResource(hInst, hrsrc);
        if(!dlg_templ) return OLEUI_ERR_LOADTEMPLATEFAILURE;
    }

    ret = DialogBoxIndirectParamW(OLEDLG_hInstance, dlg_templ, ps->hWndOwner, ps_dlg_proc, (LPARAM)ps);

    return ret;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:32,代码来源:pastespl.c


示例3: AtlAxCreateDialogW

/***********************************************************************
 *           AtlAxCreateDialogW           [[email protected]]
 *
 * See AtlAxCreateDialogA
 *
 */
HWND WINAPI AtlAxCreateDialogW(HINSTANCE hInst, LPCWSTR name, HWND owner, DLGPROC dlgProc ,LPARAM param)
{
    HRSRC hrsrc;
    HGLOBAL hgl;
    LPCDLGTEMPLATEW ptr;
    LPDLGTEMPLATEW newptr;
    HWND res;

    TRACE("(%p %s %p %p %lx)\n", hInst, debugstr_w(name), owner, dlgProc, param);

    hrsrc = FindResourceW( hInst, name, (LPWSTR)RT_DIALOG );
    if ( !hrsrc )
        return NULL;
    hgl = LoadResource (hInst, hrsrc);
    if ( !hgl )
        return NULL;
    ptr = LockResource ( hgl );
    if (!ptr)
    {
        FreeResource( hgl );
        return NULL;
    }
    newptr = AX_ConvertDialogTemplate( ptr );
    if ( newptr )
    {
            res = CreateDialogIndirectParamW( hInst, newptr, owner, dlgProc, param );
            HeapFree( GetProcessHeap(), 0, newptr );
    } else
        res = NULL;
    FreeResource ( hrsrc );
    return res;
}
开发者ID:Fredz66,项目名称:wine,代码行数:38,代码来源:atl_ax.c


示例4: EngFindResource

/*
 * @implemented
 */
PVOID WINAPI
EngFindResource(HANDLE h,
                int iName,
                int iType,
                PULONG pulSize)
{
    HRSRC HRSrc;
    DWORD Size = 0;
    HGLOBAL Hg;
    LPVOID Lock = NULL;

    if ((HRSrc = FindResourceW( (HMODULE) h, MAKEINTRESOURCEW(iName), MAKEINTRESOURCEW(iType))))
    {
        if ((Size = SizeofResource( (HMODULE) h, HRSrc )))
        {
            if ((Hg = LoadResource( (HMODULE) h, HRSrc )))
            {
                Lock = LockResource( Hg );
            }
        }
    }

    *pulSize = Size;
    return (PVOID) Lock;
}
开发者ID:mutoso-mirrors,项目名称:reactos,代码行数:28,代码来源:eng.c


示例5: get_first_resource

/***********************************************************************
 *              get_first_resource
 *
 * Helper for create_app_icon_images().  Enum proc for EnumResourceNamesW()
 * which just gets the handle for the first resource and stops further
 * enumeration.
 */
static BOOL CALLBACK get_first_resource(HMODULE module, LPCWSTR type, LPWSTR name, LONG_PTR lparam)
{
    HRSRC *res_info = (HRSRC*)lparam;

    *res_info = FindResourceW(module, name, (LPCWSTR)RT_GROUP_ICON);
    return FALSE;
}
开发者ID:Kelimion,项目名称:wine,代码行数:14,代码来源:image.c


示例6: GetDialogType

/////////////////////////////////////////////////////////////////////////////
// LaunchUrlmonDialog
/////////////////////////////////////////////////////////////////////////////
int LaunchUrlmonDialog
(
    IN HWND     hWnd,
    IN DWORD    dwAction,
    IN DWORD    dwPermissions,
    IN LPCTSTR  lpszText
)
{
    int iRet = ERROR_CALL_NOT_IMPLEMENTED;

    UMDLGPARAMS umparams;
    
    umparams.eDlgType   = GetDialogType(dwAction, dwPermissions);
    umparams.pszMsg     = lpszText;

    iRet = DialogBoxIndirectParamW(HINST_RESDLL,
                                   (LPCDLGTEMPLATEW)LoadResource(HINST_RESDLL,
                                                    FindResourceW(HINST_RESDLL,
                                                        MAKEINTRESOURCEW(IDD_URLMON),
                                                        RT_DIALOG)),
                                   SHGetLastActiveWindow(hWnd), 
                                   (DLGPROC)UrlmonDialogProc, 
                                   (LPARAM)&umparams);

    return iRet;
}
开发者ID:NemProjects,项目名称:WLAN,代码行数:29,代码来源:urlmonui.cpp


示例7: ShellAboutW

/*************************************************************************
 * ShellAboutW                [SHELL32.289]
 */
BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
                         HICON hIcon )
{
    ABOUT_INFO info;
    HRSRC hRes;
    DLGTEMPLATE *DlgTemplate;
    BOOL bRet;

    TRACE("\n");

    // DialogBoxIndirectParamW will be called with the hInstance of the calling application, so we have to preload the dialog template
    hRes = FindResourceW(shell32_hInstance, MAKEINTRESOURCEW(IDD_ABOUT), (LPWSTR)RT_DIALOG);
    if(!hRes)
        return FALSE;

    DlgTemplate = (DLGTEMPLATE *)LoadResource(shell32_hInstance, hRes);
    if(!DlgTemplate)
        return FALSE;

    info.szApp        = szApp;
    info.szOtherStuff = szOtherStuff;
    info.hIcon        = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );

    bRet = DialogBoxIndirectParamW((HINSTANCE)GetWindowLongPtrW( hWnd, GWLP_HINSTANCE ),
                                   DlgTemplate, hWnd, AboutDlgProc, (LPARAM)&info );
    return bRet;
}
开发者ID:GYGit,项目名称:reactos,代码行数:30,代码来源:shell32_main.c


示例8: ANIMATE_LoadResW

static BOOL ANIMATE_LoadResW(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPCWSTR lpName)
{
    static const WCHAR aviW[] = { 'A', 'V', 'I', 0 };
    HRSRC 	hrsrc;
    MMIOINFO	mminfo;
    LPVOID	lpAvi;

    hrsrc = FindResourceW(hInst, lpName, aviW);
    if (!hrsrc)
	return FALSE;

    infoPtr->hRes = LoadResource(hInst, hrsrc);
    if (!infoPtr->hRes)
 	return FALSE;

    lpAvi = LockResource(infoPtr->hRes);
    if (!lpAvi)
	return FALSE;

    memset(&mminfo, 0, sizeof(mminfo));
    mminfo.fccIOProc = FOURCC_MEM;
    mminfo.pchBuffer = lpAvi;
    mminfo.cchBuffer = SizeofResource(hInst, hrsrc);
    infoPtr->hMMio = mmioOpenW(NULL, &mminfo, MMIO_READ);
    if (!infoPtr->hMMio) 
    {
	FreeResource(infoPtr->hRes);
	return FALSE;
    }

    return TRUE;
}
开发者ID:AndreRH,项目名称:wine,代码行数:32,代码来源:animate.c


示例9: GetManifestStringFromModule

BOOL
GetManifestStringFromModule(HMODULE mod, LPSTR manifest, SIZE_T size)
{
	HRSRC rsrc = FindResourceW(mod, MAKEINTRESOURCE(1), RT_MANIFEST);
	if(!rsrc)
		return FALSE;

	ULONG rsrc_size = SizeofResource(mod, rsrc);

	HGLOBAL grsrc = LoadResource(mod, rsrc);
	if(!grsrc)
		return FALSE;

	PVOID prsrc = LockResource(grsrc);
	if(!prsrc)
	{
		FreeResource(grsrc);
		return FALSE;
	}

	ByteBuffer tmp;
	tmp.resize(rsrc_size);
	memcpy(&tmp[0], prsrc, rsrc_size);
	tmp.push_back(0);

	StringCbCopyA(manifest, size, (LPCSTR) &tmp[0]);

	UnlockResource(prsrc);
	FreeResource(grsrc);
	return TRUE;

}
开发者ID:amorvita,项目名称:karma,代码行数:32,代码来源:dump_manifest.cpp


示例10: SH_CreatePropertySheetPage

HPROPSHEETPAGE
SH_CreatePropertySheetPage(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle)
{
    HRSRC hRes = FindResourceW(shell32_hInstance, MAKEINTRESOURCEW(wDialogId), (LPWSTR)RT_DIALOG);
    if (hRes == NULL)
    {
        ERR("failed to find resource id\n");
        return NULL;
    }

    LPVOID pTemplate = LoadResource(shell32_hInstance, hRes);
    if (pTemplate == NULL)
    {
        ERR("failed to load resource\n");
        return NULL;
    }

    PROPSHEETPAGEW Page;
    memset(&Page, 0x0, sizeof(PROPSHEETPAGEW));
    Page.dwSize = sizeof(PROPSHEETPAGEW);
    Page.dwFlags = PSP_DLGINDIRECT;
    Page.pResource = (DLGTEMPLATE*)pTemplate;
    Page.pfnDlgProc = pfnDlgProc;
    Page.lParam = lParam;
    Page.pszTitle = pwszTitle;

    if (pwszTitle)
        Page.dwFlags |= PSP_USETITLE;

    return CreatePropertySheetPageW(&Page);
}
开发者ID:RareHare,项目名称:reactos,代码行数:31,代码来源:filedefext.cpp


示例11: add_authors

static void add_authors( HWND list )
{
    static const WCHAR eol[] = {'\r','\n',0};
    static const WCHAR authors[] = {'A','U','T','H','O','R','S',0};
    WCHAR *strW, *start, *end;
    HRSRC rsrc = FindResourceW( shell32_hInstance, authors, (LPCWSTR)RT_RCDATA );
    char *strA = LockResource( LoadResource( shell32_hInstance, rsrc ));
    DWORD sizeW, sizeA = SizeofResource( shell32_hInstance, rsrc );

    if (!strA) return;
    sizeW = MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, NULL, 0 ) + 1;
    if (!(strW = HeapAlloc( GetProcessHeap(), 0, sizeW * sizeof(WCHAR) ))) return;
    MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW );
    strW[sizeW - 1] = 0;

    start = strpbrkW( strW, eol );  /* skip the header line */
    while (start)
    {
        while (*start && strchrW( eol, *start )) start++;
        if (!*start) break;
        end = strpbrkW( start, eol );
        if (end) *end++ = 0;
        SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start );
        start = end;
    }
    HeapFree( GetProcessHeap(), 0, strW );
}
开发者ID:bdidemus,项目名称:wine,代码行数:27,代码来源:shell32_main.c


示例12: GetMemory

    // Fills the structure in mk_Memory with a pointer to the resource in memory
    // mk_Resource.sw_Module may be = "" if the cabinet is in the EXE which created the process.
    BOOL GetMemory()
    {
        CStrW sw_ResName = mk_Resource.sw_Name;
        if (mk_Resource.u32_ID) sw_ResName.FormatResource(mk_Resource.u32_ID);

        WCHAR* u16_Module = 0; // Resource is in the calling process
        if (mk_Resource.sw_Module.Len())
            u16_Module = mk_Resource.sw_Module;

        // Load the resource (via Filemapping, there is no memory consumption here)
        HMODULE h_DLL      = GetModuleHandleW(u16_Module);
        HRSRC   h_Resource = FindResourceW(h_DLL, sw_ResName, mk_Resource.sw_Type);
        HGLOBAL h_Global   = LoadResource (h_DLL, h_Resource);

        mk_Memory.p_Addr   = LockResource  (h_Global);
        mk_Memory.s32_Size = SizeofResource(h_DLL, h_Resource);
        mk_Memory.s32_Pos  = 0;

        if (mk_Memory.p_Addr == 0 || mk_Memory.s32_Size == 0)
        {
            mi_Error.Set(FDIERROR_INVAL_RESOURCE,0,0);
            return FALSE;
        }
        return TRUE;
    }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:27,代码来源:ExtractResource.hpp


示例13: FindResourceW

bool KAppRes::PrepareRes()
{
    bool retval = false;
    KFilePath pathRes = KFilePath::GetFilePath(g_hInstance);
    HRSRC hResInfo = NULL;
    HGLOBAL hResDat = NULL;
    PVOID pResBuffer = NULL;
    DWORD dwResBuffer;
    wchar_t szTempPath[MAX_PATH] = { 0 };
    wchar_t szTempFilePath[MAX_PATH] = { 0 };
    //BOOL fRetCode;
    //DWORD dwWritten;

    pathRes.RemoveExtension();
    pathRes.AddExtension(L"kui");

    if (GetFileAttributesW(pathRes) != INVALID_FILE_ATTRIBUTES)
    {
        m_strResPackPath = pathRes.value();
    }
    else
    {
        hResInfo = FindResourceW(_ModulePtr->GetResourceInstance(), L"kuires.dat", L"SKIN");
        if (!hResInfo)
            goto clean0;
        
        hResDat = LoadResource(_ModulePtr->GetResourceInstance(), hResInfo);
        if (!hResDat)
            goto clean0;

        pResBuffer = LockResource(hResDat);
        if (!pResBuffer)
            goto clean0;

        dwResBuffer = SizeofResource(_ModulePtr->GetResourceInstance(), hResInfo);
		m_memZipRes.SetData(pResBuffer, dwResBuffer);

       /* GetTempPathW(MAX_PATH, szTempPath);
        GetTempFileNameW(szTempPath, L"kui", 0, szTempFilePath);
        m_hTempRes = CreateFileW(szTempFilePath, GENERIC_ALL, FILE_SHARE_READ, NULL, 
            CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL);
        if (INVALID_HANDLE_VALUE == m_hTempRes)
            goto clean0;

        fRetCode = WriteFile(m_hTempRes, pResBuffer, dwResBuffer, &dwWritten, NULL);
        if (!fRetCode)
            goto clean0;

        fRetCode = FlushFileBuffers(m_hTempRes);

        m_strResPackPath = szTempFilePath;*/
    }
    
    retval = true;

clean0:
    return retval;
}
开发者ID:dreamsxin,项目名称:PcManager,代码行数:58,代码来源:kscres.cpp


示例14: WriteAppletToFile

BOOL WINAPI WriteAppletToFile(HANDLE FileHandle)
{
	BOOL    Success = FALSE;
	HRSRC   ResourceHandle = NULL;
	HGLOBAL Resource = NULL;
	DWORD   BytesCount = 0;
	LPVOID  Bytes = NULL;

	ResourceHandle = FindResourceW(
		g_ModuleHandle,
		MAKEINTRESOURCEW(IDR_X64_EXE),
		RT_RCDATA
	);

	if (!ResourceHandle)
		return FALSE;

	BytesCount = SizeofResource(
		g_ModuleHandle,
		ResourceHandle
	);

	Resource = LoadResource(
		g_ModuleHandle, 
		ResourceHandle
	);

	if (!Resource)
		goto Cleanup;

	Bytes = LockResource(Resource);

	if (!Bytes)
		goto Cleanup;

	Success = WriteFile(
		FileHandle,
		Bytes,
		BytesCount,
		NULL,
		NULL
	);

Cleanup:

	if (Bytes)
		UnlockResource(Bytes);

	if (Resource)
		FreeResource(Resource);

	return Success;
}
开发者ID:the-ress,项目名称:HideConsoleOnClose,代码行数:53,代码来源:wow64.c


示例15: loadResourceWin32

Resource loadResourceWin32(int name) {
    HMODULE handle = GetModuleHandle(L"jsrdbg");
    HRSRC rc = FindResourceW(handle, MAKEINTRESOURCE(name), RT_RCDATA);
    if (rc == nullptr) {
        auto errnum = GetLastError();
        throw std::runtime_error("Failed loading resource: " + systemErrorString(errnum));
    }
    HGLOBAL rcData = LoadResource(handle, rc);
    auto len = SizeofResource(handle, rc);
    auto addr = static_cast<void*>(LockResource(rcData));
    return Resource(addr, len);
}
开发者ID:swojtasiak,项目名称:jsrdbg,代码行数:12,代码来源:res_manager.cpp


示例16: pySetup

void pySetup()
{
    // Set Menu Icon
    ICONDATA pyIcon;
    HRSRC hRes = FindResourceW(hInst, MAKEINTRESOURCEW(IDB_PNG1), L"PNG");
    HGLOBAL hMem = LoadResource(hInst, hRes);
    pyIcon.data = LockResource(hMem);
    pyIcon.size = SizeofResource(hInst, hRes);
    _plugin_menuseticon(hMenu, &pyIcon);
    FreeResource(hMem);

    // Register menu entry
    _plugin_menuaddentry(hMenu, MENU_TEMPLATE, "Template"); // edit this (name in subwindow)
}
开发者ID:mrexodia,项目名称:x64dbgpy-Plugin-Template,代码行数:14,代码来源:plugin.cpp


示例17: register_fake_dll

static void register_fake_dll( const WCHAR *name, const void *data, size_t size )
{
    static const WCHAR atlW[] = {'a','t','l','.','d','l','l',0};
    static const WCHAR moduleW[] = {'M','O','D','U','L','E',0};
    static const WCHAR regtypeW[] = {'W','I','N','E','_','R','E','G','I','S','T','R','Y',0};
    static const WCHAR manifestW[] = {'W','I','N','E','_','M','A','N','I','F','E','S','T',0};
    const IMAGE_RESOURCE_DIRECTORY *resdir;
    LDR_RESOURCE_INFO info;
    HRESULT hr = S_OK;
    HMODULE module = (HMODULE)((ULONG_PTR)data | 1);
    HRSRC rsrc;

    if ((rsrc = FindResourceW( module, manifestW, MAKEINTRESOURCEW(RT_MANIFEST) )))
    {
        char *manifest = LoadResource( module, rsrc );
        register_manifest( name, manifest, SizeofResource( module, rsrc ), data, size );
    }

    info.Type = (ULONG_PTR)regtypeW;
    if (LdrFindResourceDirectory_U( module, &info, 1, &resdir )) return;

    if (!registrar)
    {
        /* create the object by hand since we can't guarantee that atl and ole32 are registered */
        IClassFactory *cf;
        HRESULT (WINAPI *pDllGetClassObject)( REFCLSID clsid, REFIID iid, LPVOID *ppv );
        HMODULE atl = LoadLibraryW( atlW );

        if ((pDllGetClassObject = (void *)GetProcAddress( atl, "DllGetClassObject" )))
        {
            hr = pDllGetClassObject( &CLSID_Registrar, &IID_IClassFactory, (void **)&cf );
            if (SUCCEEDED( hr ))
            {
                hr = IClassFactory_CreateInstance( cf, NULL, &IID_IRegistrar, (void **)&registrar );
                IClassFactory_Release( cf );
            }
        }
        if (!registrar)
        {
            ERR( "failed to create IRegistrar: %x\n", hr );
            return;
        }
    }

    TRACE( "registering %s\n", debugstr_w(name) );
    IRegistrar_ClearReplacements( registrar );
    IRegistrar_AddReplacement( registrar, moduleW, name );
    EnumResourceNamesW( module, regtypeW, register_resource, (LONG_PTR)&hr );
    if (FAILED(hr)) ERR( "failed to register %s: %x\n", debugstr_w(name), hr );
}
开发者ID:CSRedRat,项目名称:RosWine,代码行数:50,代码来源:fakedll.c


示例18: FindResourceW

// 有BUG得到的 bitmap大小为0
Gdiplus::Bitmap* PictureManager::LoadBitmapFromResource( 
    HMODULE module, UINT resID, LPCTSTR resType )
{
    Gdiplus::Bitmap* bitmap = nullptr;
    do 
    {
        HRSRC hRsc = FindResourceW(module, MAKEINTRESOURCE(resID), resType);
        if (!hRsc)
        {
            DWORD err = GetLastError();
            break;
        }
        int sizeRsc = SizeofResource(module, hRsc);
        auto FreeResouceFun = [](HGLOBAL h)
        {
            FreeResource(h);
        };
        std::unique_ptr < std::remove_pointer<HGLOBAL>::type,
            std::function<void(HGLOBAL p) >>
            hGlobalRes(LoadResource(module, hRsc), FreeResouceFun);
        if (!hGlobalRes)
        {
            break;
        }

        auto GlobalFreeFun = [](HGLOBAL global)
        {
            //GlobalFree(global);
        };
        std::unique_ptr < std::remove_pointer<HGLOBAL>::type,
            std::function<void(HGLOBAL) >>
            global2(GlobalAlloc(GMEM_MOVEABLE, sizeRsc), GlobalFreeFun);
        if (!global2)
        {
            break;
        }

        if (!CopyToDestGlobal(hGlobalRes.get(), global2.get(), sizeRsc))
            break; 

        LPSTREAM stream;
        HRESULT hr = CreateStreamOnHGlobal(global2.get(), TRUE, &stream);
        if (!SUCCEEDED(hr))
        {
            break;
        }
        bitmap = Gdiplus::Bitmap::FromStream(stream);
    } while (0);
    return bitmap;
}
开发者ID:winwingy,项目名称:Study,代码行数:51,代码来源:PictureManager.cpp


示例19: bootJar

AVIAN_EXPORT const uint8_t* bootJar(unsigned* size)
{
  if (HRSRC hResInfo = FindResourceW(
          NULL, RESID_BOOT_JAR, reinterpret_cast<LPCWSTR>(RT_RCDATA))) {
    if (HGLOBAL hRes = LoadResource(NULL, hResInfo)) {
      *size = SizeofResource(NULL, hResInfo);
      return (const uint8_t*)LockResource(hRes);
    }
  }

  fprintf(stderr, "boot.jar resource not found\n");

  *size = 0;
  return NULL;
}
开发者ID:AnthonyWilshaw,项目名称:avian,代码行数:15,代码来源:embedded-loader.cpp


示例20: OnCreateDialogParamW

HWND WINAPI OnCreateDialogParamW(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
{
	//typedef HWND (WINAPI* OnCreateDialogParamW_t)(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
	ORIGINALFASTEX(CreateDialogParamW,NULL);
	HWND hWnd = NULL;
	BOOL bAttachGui = FALSE, bStyleHidden = FALSE;
	LPCDLGTEMPLATE lpTemplate = NULL;
	DWORD lStyle = 0; //lpTemplate ? lpTemplate->style : 0;
	DWORD lStyleEx = 0; //lpTemplate ? lpTemplate->dwExtendedStyle : 0;

	// Загрузить ресурс диалога, и глянуть его параметры lStyle/lStyleEx
	HRSRC hDlgSrc = FindResourceW(hInstance, lpTemplateName, RT_DIALOG);
	if (hDlgSrc)
	{
		HGLOBAL hDlgHnd = LoadResource(hInstance, hDlgSrc);
		if (hDlgHnd)
		{
			lpTemplate = (LPCDLGTEMPLATE)LockResource(hDlgHnd);
			if (lpTemplate)
			{
				lStyle = lpTemplate ? lpTemplate->style : 0;
				lStyleEx = lpTemplate ? lpTemplate->dwExtendedStyle : 0;
			}
		}
	}

	if ((!lpTemplate || CheckCanCreateWindow(NULL, (LPWSTR)32770, lStyle, lStyleEx, hWndParent, bAttachGui, bStyleHidden))
		&& F(CreateDialogParamW) != NULL)
	{
		//if (bAttachGui)
		//{
		//	x = grcConEmuClient.left; y = grcConEmuClient.top;
		//	nWidth = grcConEmuClient.right - grcConEmuClient.left; nHeight = grcConEmuClient.bottom - grcConEmuClient.top;
		//}

		hWnd = F(CreateDialogParamW)(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam);
		DWORD dwErr = GetLastError();

		if (hWnd && bAttachGui)
		{
			OnGuiWindowAttached(hWnd, NULL, NULL, (LPCWSTR)32770, lStyle, lStyleEx, bStyleHidden);

			SetLastError(dwErr);
		}
	}

	return hWnd;
}
开发者ID:VladimirTyrin,项目名称:ConEmu,代码行数:48,代码来源:hkDialog.cpp



注:本文中的FindResourceW函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FindSection函数代码示例发布时间:2022-05-30
下一篇:
C++ FindResource函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap