Thread View: cn.bbs.comp.program
1 messages
1 total messages
Started by ����
Thu, 04 Jun 1998 00:00
resource problem
Author: ����
Date: Thu, 04 Jun 1998 00:00
Date: Thu, 04 Jun 1998 00:00
36 lines
1898 bytes
1898 bytes
�� .DLL �м��� .JPG �ļ����Զ����ʽ���Ϊ JPG��
��Դ��Ϊ FRAME��ʹ�õĹ����� Resource WorkShop.
���´�����ͼ�Ӵ� DLL �н�ͼ�������д���ļ���
���� VC(with Bound Check ) ���� WriteFile һ��ĵ�
��������Ƿ� ( �� p Ϊ Invalid argument )�� Ϊ�Σ�
#include <windows.h>
#include <stdio.h>
void main(void){
HINSTANCE hLib=LoadLibrary("Res.dll");
HANDLE f=CreateFile("out.jpg",
GENERIC_WRITE ,
0,
NULL,
CREATE_ALWAYS ,
FILE_ATTRIBUTE_ARCHIVE ,
0);
if (hLib){
HRSRC hRes=FindResource(hLib,"FRAME","JPG");
DWORD d=SizeofResource(hLib,hRes),d1;
if (hRes){
HGLOBAL h=LoadResource(hLib,hRes);
if (h){
LPVOID p=0;
p= LockResource(h);
WriteFile(f,p,d,&d1,0);
}
}
FreeLibrary(hLib);
}
CloseHandle(f);
}
--
�� ��Դ: �й�ƴ�BBSվ [bbs.ustc.edu.cn]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads