Click here to Skip to main content
15,882,388 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
In my "Windows Form Application" project, i have created Button. On Button click , I want to open compound file present on my hard disk using function StgOpenStorageEx(). the code i have written code for this in button click event as

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
            IStorage    *pStorage;               if(StgOpenStorageEx(L"E:\\Backup.stg",STGM_READ|STGM_SHARE_DENY_WRITE,STGFMT_DOCFILE,0, NULL, 0,IID_IStorage,(void**)&pStorage)==S_OK)

for this i have added header files like

#include "StdAfx.h"

Also I have added "Ole32.lib" in proj->properties->Linker->input->additional dependencies.
But still im getting following errors
1>BackGUI.obj : error LNK2020: unresolved token (0A000010) IID_IStorage
1>BackGUI.obj : error LNK2001: unresolved external symbol IID_IStorage
1>C:\Users\SUMIT\Desktop\prj\BACKUP & RESTORE\BackGUI\Debug\BackGUI.exe : fatal error LNK1120: 2 unresolved externals

any suggestions plz??
Updated 25-Apr-11 11:37am
Albert Holguin 25-Apr-11 20:29pm    
this looks familiar:
Albert Holguin 25-Apr-11 20:31pm    
...and here:

1 solution

if you look here:[^] says "IID_IStorage is defined as 0000000B-0000-0000-C000-000000000046", so why don't you try to define it yourself, its probably defined somewhere that you forgot to include or you have to define it yourself to use it.

So try this (although looking at some of the other references, you probably need to use the DEFINE_GUID() macro since its a large number rather than text)...
#ifndef IID_IStorage
#define IID_IStorage "0000000B-0000-0000-C000-000000000046"

Here you can see where someone defined that in their code (using DEFINE_GUID() macro):[^]

...and yet another reference:[^]
Share this answer
Sandeep Mewara 26-Apr-11 0:31am    
My 5!
MartinTaylor 26-Apr-11 4:41am    
Thank u Albert Sir...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900