Solved

Custom resources

Posted on 2004-09-01
9
204 Views
Last Modified: 2013-11-20
Hi all,
  I have to add a custom resource to my SDK program.I added a text file and when i tried loading it using FindResource() and LoadResource(),its giving me error.

Can any one help
 
0
Comment
Question by:ArunaK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 11949950
What errors do you get? Please post some code.
0
 

Author Comment

by:ArunaK
ID: 11950045
The FindResour() is returning NULL and i got the error "Cannot find the resource".
The code is
   HRSRC hRes=FindResource(hInst,TEXT("IDI_TEXT1"),TEXT("TEXT"));
My resource is a text file of type"TEXT"

Thanx in advance
0
 
LVL 16

Expert Comment

by:nonubik
ID: 11950069
Try to see what error code you get

HRSRC hRes=FindResource(hInst,TEXT("IDI_TEXT1"),TEXT("TEXT"));
DWORD dwErr = GetLastResult();

and then find it's meaning by Error Lookup tool in VC++.
Is hInst properly set?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

by:nonubik
ID: 11950075
Sorry, forget about the result code, now I saw it :o)
How is hInst?
0
 

Author Comment

by:ArunaK
ID: 11950219
hInst is the handle to the current instance(Global Variable containing the instance handle which i got from WinMain())

0
 
LVL 16

Accepted Solution

by:
nonubik earned 50 total points
ID: 11950280
I think you shoud do
HRSRC hRes=FindResource(hInst,MAKEINTRESOURCE(IDI_TEXT1),TEXT("TEXT"));
0
 

Author Comment

by:ArunaK
ID: 11950401
Thanks for ur reply........it really helped me a lot


0
 
LVL 16

Expert Comment

by:nonubik
ID: 11950423
I see from your grade (B) that you are not pleased with the solution. Do you need to elaborate more?
http://www.experts-exchange.com/Programming/Programming_Languages/MFC/help.jsp#hi73
0
 

Author Comment

by:ArunaK
ID: 12014454
SORRY Thanks for ur reply.................
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question