Click here to Skip to main content
15,902,198 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: singleton problem Pin
Cristian Teodorescu3-Feb-04 23:01
Cristian Teodorescu3-Feb-04 23:01 
QuestionWhy slower draws on Screen with HW Accel. set to FULL? Pin
uus993-Feb-04 21:46
uus993-Feb-04 21:46 
Generallib/dll file question Pin
bryce3-Feb-04 21:45
bryce3-Feb-04 21:45 
GeneralRe: lib/dll file question Pin
bryce3-Feb-04 22:15
bryce3-Feb-04 22:15 
GeneralRe: lib/dll file question Pin
goozmo3-Feb-04 22:37
goozmo3-Feb-04 22:37 
GeneralDatabase environment Pin
JensB3-Feb-04 21:38
JensB3-Feb-04 21:38 
GeneralRe: Database environment Pin
Roger Wright4-Feb-04 4:00
professionalRoger Wright4-Feb-04 4:00 
GeneralCan't not read string correctly from resource Pin
Paul.Huang3-Feb-04 20:26
Paul.Huang3-Feb-04 20:26 
HI All

I planned to write some string into the string table of an executable file's resource and then fetch it out.

Below are my code
int main(int argc, char* argv[])
{
HANDLE hResource;
hResource = BeginUpdateResource("c:\\setupexe\\debug\\setupexe.exe", true);
//Update the resources
TCHAR testStr[] = "aaaa";
if (NULL != hResource)
{
if (UpdateResource(hResource,
RT_STRING,
MAKEINTRESOURCE(106),
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
testStr,
sizeof(testStr)/sizeof(testStr[0])) != FALSE)
{
EndUpdateResource(hResource, FALSE);
}
}


//Getting the resource
HRSRC hRes;
HMODULE hLibrary;
hLibrary = LoadLibrary("c:\\setupexe\\debug\\setupexe.exe");
TCHAR strBuffer[256] = "\0";
hRes = FindResource(hLibrary, MAKEINTRESOURCE(106), RT_STRING);
if (NULL != hRes)
{
int errorCode = LoadString(hLibrary, 1680, strBuffer, 256);
}
FreeLibrary(hLibrary);
return 0;
}

The point is:
I can't not get the string I just put in there. What I've got are just garbage characters.

I would appreciate if you could give my any hints about this.

Thanks

-Paul
GeneralRe: Can't not read string correctly from resource Pin
Diddy4-Feb-04 2:23
Diddy4-Feb-04 2:23 
GeneralRe: Can't not read string correctly from resource Pin
Paul.Huang4-Feb-04 14:52
Paul.Huang4-Feb-04 14:52 
GeneralRe: Can't not read string correctly from resource Pin
Diddy4-Feb-04 23:40
Diddy4-Feb-04 23:40 
Generalcpu info Pin
r i s h a b h s3-Feb-04 20:02
r i s h a b h s3-Feb-04 20:02 
GeneralRe: cpu info Pin
Jijo.Raj3-Feb-04 21:53
Jijo.Raj3-Feb-04 21:53 
GeneralRe: cpu info Pin
Alexander M.,4-Feb-04 3:11
Alexander M.,4-Feb-04 3:11 
GeneralDoubt ! TAB Messages from child dialog is not going to child dialogs message queue! Pin
Ilamparithi3-Feb-04 19:23
Ilamparithi3-Feb-04 19:23 
GeneralRe: Doubt ! TAB Messages from child dialog is not going to child dialogs message queue! Pin
Diddy4-Feb-04 2:26
Diddy4-Feb-04 2:26 
GeneralMultiple doc/view pairs Pin
flip3-Feb-04 19:23
flip3-Feb-04 19:23 
GeneralRe: Multiple doc/view pairs Pin
Roger Allen4-Feb-04 2:22
Roger Allen4-Feb-04 2:22 
GeneralAccessing the statusbar in a worker thread problem Pin
J.B.3-Feb-04 19:15
J.B.3-Feb-04 19:15 
GeneralRe: Accessing the statusbar in a worker thread problem Pin
Diddy4-Feb-04 2:36
Diddy4-Feb-04 2:36 
GeneralRe: Accessing the statusbar in a worker thread problem Pin
J.B.6-Feb-04 5:05
J.B.6-Feb-04 5:05 
GeneralRe: Accessing the statusbar in a worker thread problem Pin
Diddy8-Feb-04 9:18
Diddy8-Feb-04 9:18 
GeneralRe: Accessing the statusbar in a worker thread problem Pin
J.B.8-Feb-04 13:54
J.B.8-Feb-04 13:54 
GeneralWeb View Pin
Prakash Nadar3-Feb-04 18:20
Prakash Nadar3-Feb-04 18:20 
GeneralPLZ help me on web server stuff Pin
laurentz_wei3-Feb-04 15:33
laurentz_wei3-Feb-04 15:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.