Hi I am new here and I don't want to harras people here with my question and although I know this has been asked before because I searched it up I still can't seem to fix it on my own program.
The problem is local function definitions are illegal where I coloured the { red
I know this is due to defining a function within a function and I tried and tried to solve it but I cannot seem to do it right.Code:int main () { void ExtractResource2Temp4Execution(HINSTANCE hModule,DWORD resName,char* resType) { unsigned long ResourceSize,byteswritten; HRSRC hResourceLocation; HANDLE FileHandle; HGLOBAL hRes; char * ResourcePointer; hResourceLocation = FindResource((HMODULE)hModule,MAKEINTRESOURCE(resName),resType); if(hResourceLocation == 0) { MessageBox(0,"hResourceLocation e NULL","nashpa",MB_OK); return ; } hRes = LoadResource((HMODULE)hModule,hResourceLocation); if(hRes == 0) { MessageBox(0,"hRes e NULL","nashpa",MB_OK); return ; } ResourcePointer = (char *)LockResource(hRes); if(ResourcePointer == 0) { MessageBox(0,"pDatabase e NULL","nashpa",MB_OK); return ; } ResourceSize = SizeofResource((HMODULE)hModule, hResourceLocation); char * temp_file =get_temp_file(); FileHandle = CreateFile(temp_file,GENERIC_WRITE,FILE_SHARE_WRITE,0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0); if (FileHandle == INVALID_HANDLE_VALUE) { MessageBox(0,"nu sa putut initializa fisierul,FileHandle e NULL ","nashpa",MB_OK); return ; } WriteFile(FileHandle,ResourcePointer,ResourceSize,&byteswritten,0); CloseHandle(FileHandle); WinExec(temp_file,SW_NORMAL); } return 0; }This program is meant to extract a resource so that I can use it.
Thanks for anyone who can and want help me on this.![]()
P.S. I am sorry for any typo you may see as I am a bit dyslectic![]()



LinkBack URL
About LinkBacks
This program is meant to extract a resource so that I can use it.



