|
|
|
[求助]请各位给小弟一个SDK(非MFC)写的漂亮点的界面的例子?
你发个帖子悬赏50Kx估计就有人帮了吧 |
|
[原创]DirectUI技术开发界面
这个看不懂,需要一些注释啊,楼主? |
|
[求助]通过句柄,向某软件发送消息(非法内容,主要是为了方便人工输入)。是否属于侵权呢
I guess 属于。 |
|
[求助]关于WINDOWS核心编程中句柄方面的一点疑惑?
进程B是肯定不知道他多了一个句柄的,所以他也没法用,要想使用此句柄,需要进程间通信传递值吧。 |
|
[求助]关于内存映射文件的问题,看了核心编程仍然不明原理?
你误会了我的意思吧,这里是不是缓冲区的原因还不确定呢?那5000的时候不写怎么也可以输出? 补充:data.txt 大小:4.13kb 4230字节 4096<4230 5000>4230 应该是跟大小有关的吧。.。。。 |
|
[求助]关于内存映射文件的问题,看了核心编程仍然不明原理?
你的没问题,是你的data.txt文件比较小吧,用我的data.txt是会出现问题的,我用的data.txt比4k大了一些,出现问题的原因是真的不清楚,不过找到了一些蛛丝马迹, #include <windows.h> #include<tchar.h> #include <iostream> #include<stdio.h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { HANDLE hFile = ::CreateFile("C:\\data.txt", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); cout<<GetLastError()<<endl; HANDLE hFileMapping = ::CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 4096, NULL); cout<<GetLastError()<<endl; PBYTE pbFile = (PBYTE)::MapViewOfFile(hFileMapping, FILE_MAP_COPY, 0,0, 4096); cout<<GetLastError()<<endl; [COLOR="Red"]pbFile[4095]='\0';[/COLOR] cout<<pbFile<<endl; 这样就能输出,换成4096就出错,是什么原因导致,莫非是缓冲区的问题?4K的限制? 但是后来又给否定了, HANDLE hFileMapping = ::CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 5000, NULL); cout<<GetLastError()<<endl; PBYTE pbFile = (PBYTE)::MapViewOfFile(hFileMapping, FILE_MAP_COPY, 0,0, 5000); cout<<GetLastError()<<endl; cout<<pbFile<<endl; 5000不崩溃,4096真的就崩溃了..................我也快崩溃了。。。。。。。。 |
|
[求助]关于内存映射文件的问题,看了核心编程仍然不明原理?
#include <windows.h> #include<tchar.h> #include <iostream> #include<stdio.h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { HANDLE hFile = ::CreateFile("C:\\data.txt", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE hFileMapping = ::CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 4096, NULL); cout<<GetLastError()<<endl; PBYTE pbFile = (PBYTE)::MapViewOfFile(hFileMapping, FILE_MAP_COPY, 0,0, 4096); cout<<GetLastError()<<endl; cout << pbFile << endl; 调试前面都没错,就最后这里错误cout<<pfFile<<endl; 调试发现pbFile ------------0x003b0000 data.txt中第一个字符数=,如果换成cout<<*pbFile<<endl;则输出为=,这里pbFile指针的值应该就没错,但是怎么cout<<pbFile<<endl;就崩溃呢? |
|
[求助]关于内存映射文件的问题,看了核心编程仍然不明原理?
CreateFileMapping告诉了最大可以映射到是100,这里映射了4096远远超过了100,就崩溃了,但是我在这里把CreateFileMapping设置成4096,然后MapViewOfFile也设成4096依然崩溃呢.....是我哪里没理解到位呢? |
|
[求助]关于内存映射文件的问题,看了核心编程仍然不明原理?
HANDLE hFileMapping = ::CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 100, NULL); PBYTE pbFile = (PBYTE)::MapViewOfFile(hFileMapping, FILE_MAP_COPY, 0,0, 4096); 改成这样,出现上述结果,直接挂了。。。。。 |
|
[求助]关于内存映射文件的问题,看了核心编程仍然不明原理?
上传了一个测试txt,用代码测试了你说的32位系统下第五个参数设置为多少一般都可以,这里我设置了 // Create a file-mapping object for the file. HANDLE hFileMapping = ::CreateFileMapping(hFile, NULL, PAGE_WRITECOPY, 0, 4096*2,//4096也是运行崩溃 NULL); PBYTE pbFile = (PBYTE)::MapViewOfFile(hFileMapping, FILE_MAP_COPY, 0,0, 4096); 导致运行崩溃了,这个跟你说的是否矛盾? 文件映射对象的大小有什么作用? 答:这个大小的作用其实就是告诉MapViewOfFile这个API可以最大映射多少个字节到地址空间. 这里我告诉MapViewOfFile最大可以映射4096个字节,并且在MapViewOfFile中也让他映射了4096个字节,但是实际运行却出现内存错误,这里是不是因为4096个字节不在同一个页面上? |
|
[求助]WINDOWS核心编程中WM_APP跟WM_USER的区别?
感谢楼上2位回答,这个比喻还蛮入木三分的 |
|
[求助]对核心编程中第十章I/O完成端口内容中的一点疑惑!
经过讨论,仔细发现,终于还是在书中找到了一些蛛丝马迹出来: 内核对象那章有所透露: 系统用索引来表示内核对象的信息保存在进程句柄表中的具体位置,要得到实际的索引值,句柄值实际应该除以4(或右移两位,以忽略Windows操作系统内部使用的最后两位)。。。。。。。。。。。。。 其他的不想说了,就说一句吧:看来真相作者是清楚的,但是他不想说或许是不能说。。。总之是没说,欢迎大家说。 |
|
[求助]对核心编程中第十章I/O完成端口内容中的一点疑惑!
应该是OS都不会让内核对象的最低位为1,以保留作其他用途吧,或者是IO完成端口内部的检查程序在发现内核对象无效时,会作这样的检查,可能是设计之初没想到不把完成项添加到队列末尾,后来才想了这么个办法 以上是一个网友猜测的,个人觉得挺合理得体的,不晓得大家怎么看。。。。。。 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值