Click here to Skip to main content
15,885,366 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getting Text from Seperate Dialog Pin
Gary R. Wheeler25-May-04 14:45
Gary R. Wheeler25-May-04 14:45 
GeneralRe: Getting Text from Seperate Dialog Pin
avenger_sb2525-May-04 18:10
avenger_sb2525-May-04 18:10 
GeneralVC++.NET compiler running in VC++6 Errors Pin
---Mark---25-May-04 13:31
---Mark---25-May-04 13:31 
GeneralRe: VC++.NET compiler running in VC++6 Errors Pin
Anonymous25-May-04 13:39
Anonymous25-May-04 13:39 
GeneralRe: VC++.NET compiler running in VC++6 Errors Pin
---Mark---25-May-04 13:43
---Mark---25-May-04 13:43 
GeneralRe: VC++.NET compiler running in VC++6 Errors Pin
Anonymous25-May-04 13:47
Anonymous25-May-04 13:47 
GeneralRe: VC++.NET compiler running in VC++6 Errors Pin
---Mark---25-May-04 13:53
---Mark---25-May-04 13:53 
GeneralExtracting files from resource Pin
Anonymous25-May-04 13:28
Anonymous25-May-04 13:28 
What I am trying to do is extract a file from a resource then write it into the system directory of windows. It compiles but it doesn't run correctly. I defined 1001 in resource.h and I included it also. I need help with this code here:

#include <windows.h>
#include "resource.h"
void main(void) {
char szFile[MAX_PATH];
char sysdir[MAX_PATH];
DWORD Size;
DWORD Written;

HINSTANCE hMod = GetModuleHandle(NULL);
HRSRC hRes = FindResource(hMod, MAKEINTRESOURCE(1001), RT_RCDATA);
Size = SizeofResource(hMod, hRes);
HGLOBAL hLoad = LoadResource(hMod, hRes);
LPVOID lpResLock = LockResource(hLoad);

GetSystemDirectory(sysdir, sizeof(sysdir));
strcat(sysdir, "\\abcdef.exe");
strcpy(szFile, sysdir);

HANDLE hMake = CreateFile(szFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, NULL | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM, NULL);
if (hMake != INVALID_HANDLE_VALUE) {
WriteFile(hMake, lpResLock, Size, &Written, NULL);
CloseHandle(hMake);
UnlockResource(hLoad);
FreeResource(hLoad);
}
}

If anybody has code similar to this that works please post it.
GeneralRe: Extracting files from resource Pin
gUrM33T25-May-04 18:04
gUrM33T25-May-04 18:04 
GeneralRe: Extracting files from resource Pin
Diddy26-May-04 0:20
Diddy26-May-04 0:20 
GeneralRe: Extracting files from resource Pin
Roger Allen26-May-04 2:41
Roger Allen26-May-04 2:41 
GeneralRe: Extracting files from resource Pin
David Crow26-May-04 3:33
David Crow26-May-04 3:33 
GeneralMake Window Stay On Top Pin
KingTermite25-May-04 12:56
KingTermite25-May-04 12:56 
GeneralRe: Make Window Stay On Top Pin
Christian Graus25-May-04 13:15
protectorChristian Graus25-May-04 13:15 
GeneralRe: Make Window Stay On Top Pin
KingTermite25-May-04 13:19
KingTermite25-May-04 13:19 
GeneralRe: Make Window Stay On Top Pin
Christian Graus25-May-04 13:22
protectorChristian Graus25-May-04 13:22 
GeneralVC7 compiler with VC6 IDE Pin
Jim A. Johnson25-May-04 8:19
Jim A. Johnson25-May-04 8:19 
GeneralRe: VC7 compiler with VC6 IDE Pin
Michael Dunn25-May-04 8:51
sitebuilderMichael Dunn25-May-04 8:51 
GeneralRe: VC7 compiler with VC6 IDE Pin
Jim A. Johnson25-May-04 11:55
Jim A. Johnson25-May-04 11:55 
GeneralRe: VC7 compiler with VC6 IDE Pin
Anonymous25-May-04 12:34
Anonymous25-May-04 12:34 
GeneralRe: VC7 compiler with VC6 IDE Pin
Jim A. Johnson25-May-04 15:08
Jim A. Johnson25-May-04 15:08 
GeneralRich Edit Control Pin
monrobot1325-May-04 7:29
monrobot1325-May-04 7:29 
GeneralRe: Rich Edit Control Pin
David Crow25-May-04 8:53
David Crow25-May-04 8:53 
GeneralRe: Rich Edit Control Pin
monrobot1325-May-04 10:47
monrobot1325-May-04 10:47 
GeneralRe: Rich Edit Control Pin
David Crow25-May-04 10:51
David Crow25-May-04 10:51 

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.