What is wrong with this function that I can not get resource content?

Marcone marcone at email.com
Wed Feb 5 18:49:29 UTC 2020


// Function get_resource()
void get_resource(const(wchar)* id, const(wchar)* tipo, 
const(wchar)* path_name){
	HRSRC file = FindResource(null, id, tipo);
	DWORD size = SizeofResource(NULL, file);
	HGLOBAL load = LoadResource(NULL, file);
	HANDLE new_file = CreateFile(path_name, GENERIC_WRITE, 0, NULL, 
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
	WriteFile(new_file, load, size, cast(uint*) 0, null);
	CloseHandle(new_file);
}

void main(){
	get_resource("300", "BMP", "melancia.bmp");
}


More information about the Digitalmars-d-learn mailing list